Command Line - Cheatsheet: S.N Purpose Command
Command Line - Cheatsheet: S.N Purpose Command
6 LIST ALL OPTIONS All contents, including hidden files and -alt
directories, in long format, ordered by
the date and time they were last
modified
13 COPY FILE1,FILE2 Copy the contents of a source file into cp file1.text file2.txt
a destination file
14 COPY Copy a file to a destination directory cp file.txt directory/
FILE,DIRECTORY
26 MOVE FILE1,FILE2 Move the contents of a source file into mv file1.txt file2.txt
a destination file
37 REDIRECTING > To redirect output by taking the echo "Hello" > file.txt
OUTPUT output from the command on the left
and passing as input to the file on the
right.
39 GREP SEARCH To search files for lines that match a grep ‘hello’ file.txt
pattern and returns the results.
The lines in the file file.txt which
contain “hello” will be returned.
40 CASE INSENSITIVE -i can be used to search files for lines grep -i XXX
SEARCH that match a pattern, case insensitive continents.txt
and returns the results.
grep searched for
capital or lowercase strings
that match “XXX”
in continents.txt
48 EXPORT COMMAND The given variable available to all child export USER="ALEXA"
sessions initiated from the current
session export USER="Jane
This command will make the Doe"
environment variable: USER
available
To all child sessions with the
value "ALEXA"
SORT UNIQ file uniq is to call sort to alphabetize a file, sort file.txt | uniq
and “pipe” the standard output to uniq.
By piping sort file.txt to uniq, all
duplicate lines are alphabetized (and
thereby made adjacent) and filtered
out.
55 SORT UNIQ file,file Sending filtered contents to uniq- Sort file.txt |uniq-file.txt
file.txt, To view with the cat command.
56 QNIQ-NO DUPLICATE To create a new file named uniq- Sort file.txt | uniq>uniq-
file.txt that contains a sorted version file.txt
of file.txt with no duplicates.
66 OPEN BASH To open and edit the bash profile nano ~/.bash_profile