2. Codecademy: Learn the Command Line Flashcards
(Left angle bracket)
Redirect standard output to a command.
For some reason, the app is deleting the actual less than symbol, also referred to as the left angle bracket
’ > ‘
Redirect standard output of a command to a file, overwriting its previous contents.
’»_space; ‘
Redirect standard output of a command, appending original contents of a file.
’ | ‘
Pipe symbol; Redirect standard output of a command to another command.
*
The asterisk acts as a wildcard to select files and directories.
(E.g., cp m*.txt Movies/ copies all .txt files stating with the letter ‘m’ into the Movies/ directory)
wc
Output number of lines, words, and characters
sort
Order the contents of the standard input alphabetically for the standard output.
uniq
Filter out adjacent, duplicate lines in a file.
(best used in a pipeline with ‘sort’ e.g.,
$sort deserts.txt | uniq
which sorts the contents of desert.txt alphabetically, making duplicates adjacent and filtering them out of the output of the uniq command)
-r or -R
Meaning “recursive,” when following a command it acts as an option
(See rm -r and grep -R)
ls -a
List all files and directories in the working directory, including any hidden files (files starting with ‘ . ‘ are hidden by default)
ls -l
List all files and directories in long format
ls -t
List all files and directories by date last modified
ls -alt
List all files and directories, including hidden files, in long format, by date last modified
(ls options can be combined in any combination, e.g., ls -al, ls -at, ls -lt)
rm -r
Remove directory and all of its contents (permanently!!)
-i
disregard case/case insensitive