cdcd~# Will take you homecd../# Will move you up one directorycd../../# Will move you up two directoriescd/# Will take you to root
LS
Lists directory contents
lsls-a# Produces directory structure as wellls-al# Produces comprehensive list of directory files and permissions
RM
Removes a file or folder
rmrmfilename.txt# Removal of a filermdir-r/DirectoryName# Forces removal of directory and all files
MKDIR
Creates a new folder / directory
mkdirDirectoryName
CAT
Displays contents of a file
cattestFile.txt
ECHO
Prints out text to terminal, or additionally to a file
echo"My String"# My stringecho"My String">temp.txt# Writes My String to temp.txt filecattemp.txt# My Stringecho"My new string">>temp.txt# Appends content of text to filecattemp.txt# My String My new string
MV
Moves a file
mkdirNewFolder# Creates a new folder named NewFolderecho"My Text">NewFile.txt# Creates NewFile.txt with your contentmvNewFile.txtNewFolder# Moves your textfile to your folder
WHOAMI
Displays the current active user
whoami
MAN
Manual, displays information on commands
manls
WHICH
Displays which and where the specified program is installed
whichpython3# /usr/bin/python3
ALIAS
Creates a macro shortcut command
alias temp='ls -a'temp# . .. NewFolderls-a# . .. NewFolder
Advanced Linux Commands
STDERR
Print error message to a specified file
echo"hello"2>log.txt# No Errors, does not print anythingechoNotAFunction2>>log.txt# Appends NotAFunction: command not found
STDOUT
Prints output to a specified file
echo"hello">log.txt2>&1# Direct any error messages into file
FIND
Find a file by type
find/-typef-namelog.txt2>/dev/null# Find type file with name log.txt# If there are any errors, direct them to null to be deleted
TEE
Print output of a command and store the output into a file
ls|teeoutput.txt
CUT
Access particular byte of data in a file
catlog.txt# hicatlog.txt|cut-c1# hcatlog.txt|cut-c2# i
NL
Display file with line numbers
nllog.txt# 1 hi# 2 hello
HEAD
Display content of a file starting at top
head-3log.txt
TAIL
Display content of a file starting from bottom
tail-10log.txt
SORT
Sort the contents of a file
sort-rlog.txt# Reverses order of contentssortlog.txt|uniq# Removes duplicate content
WC
Display content information about a file
wclog.txt# 7 7 59 log.txt# Number of Lines | Number of Words | Bytes or Characters | File Namewc-llog.txt# 7 log.txt# Number of lines | File Name
FILE
Displays information about a file
filelog.txt# log.txt: ASCII text
GREP
Match a pattern of a string to search file content
catlog.txt|grep"hello"# Returns only content that contains "hello"grep"hello"log.txt# Performs the same