Command Line Interface/Commands (II) Flashcards
print out just the first few lines of a file
head ________
(name of file)
print out the last few lines of a file
tail _______
(name of file)
print out a screen’s worth at a time of a file’s contents
more ________
(name of file)
Type q to leave this mode
When you need to enter navigation mode to read a file (up/down a line at a time, etc.), how do you this?
less _________
(name of file)
In this mode, you can use the up/down arrows to move a line at a time, or you can use the “fn” key + up/down arrows to move a page at a time
Type q to leave this mode
how do you exit/close the command line?
exit
how do you clear your screen of text
clear
but you can still scroll up to see everything you have typed before entered this command
list only certain files in your current directory
ls /* _______
(pattern)
ls /* or
(this will list only the files that end with the letters “or” )
make a set of nested directories
mkdir -p ______/______/_______/etc.
(list the names of all the directories you want)
view a diagram of all your directories, sub-directories and files
tree _______________
(directory name you want to start the tree from)
exit a process (infinite loop, long-running process, freeze)
ctrl + c
list all the files AND the hidden files in a directory
ls -a __________
(name of directory)
find the location of a default executable
this command will show the path to the file
which _________
(name of command)
Example:
which touch
/bin/touch
in your current directory, move only files that fit a pattern to another directory
mv . /*_____ _________
(pattern) (destination folder)
Example:
mv . /*.txt ../..
- is the “glob operator” or “splat operator”
list only the hidden files in a directory
ls -d .*
move all the files from your current directory to another folder
mv * ____________
(destination folder)