sudo
: allows root level permisson
alias
: allows for reassignment of a command (e.g. alias open="xdg-open" will change the command "xdg-open" to "open")
man [command]
: Displays manual for the specified [command].
pwd
: Shows the current user directory listed. Given from the absolute path (root).
ls
: Shows what files are in the current directory.
ls -a
: Shows all files in the current directory (including hidden files).
cd [name]
: Go to specified directory.
cd ..
: Go one directory up (back to previous directory).
cd /
: Go to root directory.
cd ~
: Go to user directory.
mkdir [name]
: Creates a new folder in the current directory.
rmdir [name]
: Removes the file specified (This only works on empty folders. For folders containing files see rm -r).
rm -r [name]
: Removes a folder that is either empty or contains files.
rm [name]
: Removes the file specified.
rm -i
: Interactive Requires user confirmation before deletion.
rm -f
: Force removes a file (Works on write-protected files).
touch [name]
: Creates a file (specified file type i.e. .txt, .html, .js etc).
cat > [name]
: Creates a text file and allows user to type contents into Terminal.
open [name]
: Opens a file in the current diretory ("xdg-open" in Ubuntu).
gedit [name]
: Opens a file using GNOME text editor (Ubuntu).
open -a [name]
: Opens the specified application.
code .
: Opens Visual Studio Code.
open -a "Visual Studio Code" [name]
: Opens the specified file [name] with the specified application.
cp [name] [new_name]
: Copies the [name] file to [new_name].
mv [name] [new_name]
: Renames [name] to [new_name].
mv [name] [location]
: Moves specified file to the location specified.
cat [name]
: Displays a concatenated version of the files contents.
cat >> [name]
: Appends user input to specified text file.
cat [name] [other_name]
: Combines [name] and [other_name] text files.
head -[number]
: Displays the first [number] of lines in a text file.
tail -[number]
: Displays the last [number] of lines in a text file.
less [name]
: Displays large text files. Allows the user to scroll through the file ("q" quits the file).
[command1] | [command2]
: Pipe the output from [command1] into [command2] (e.g. whois google.com | head = returns the whois of google.com passed through the head command to only return the first 10 lines)
find [folder] -name [name]
: Finds the file [name] in the specified [folder].
grep [word] [name]
: Search for a specified [word] in the specified text file [name].
grep [word] [name] -v
: Displays all lines that do not match the specified [word].
grep [word] [name] -n
: Displays the line number where the specified [word] can be located in the text file preceeding the text.
grep [word] [name] -c
: Displays the line number where the specified [word] can be located in the text Standalone
grep [word] [name] -i
: Ignores the case of the specified [word].
wc [name]
: Displays the line count, the word count and the character count of the specified text file.
wc [name] -l
: Displats the line count of the text file.
wc [name] -w
: Displats the word count of the text file.
wc [name] -c
: Displats the character count of the text file.
history
: Displays the history of commands passed into Terminal.
whoami
: Displays the current user.
ls -l
: Displays file permissions.
If the first character in the file permissions is "-" this denotes that it is a file.
If the first character in the file permissions is "d" this denotes that it is a directory.
"r" : Read permission access.
"w" : Write permission access.
"x" : Execute permission access.
"-" : Excluding first character Access to that element is unavailable for that user.
chmod [permission] [name]
: Changes the permissions of the specified file.
7 is rwx (e.g. 777 = user, group and global can all rwx)
6 is rw (e.g. 766 = user can rwx but group and global can only rw)
5 is rx (e.g. 755 = user can rwx but group and global can only rx)
4 is r (e.g. 744 = user can rwx but group and global can only r)
-rw-rw-r-- 1 luke luke 0 Oct 23 19:18 goodbye.txt
drwxrwxr-x 2 luke luke 4096 Oct 23 18:11 Makers
The first character denotes file/directory(folder).
2, 3, 4 characters denote permissions for the current user.
5, 6, 7 characters denote permissions for the group.
8, 9, 10 characters denote permissions for the global.
env
: Displays environment variables.
echo $[variable]
: Displays specified environment [variable].
rvm use [version]
: Switches version of Ruby currently being used to [version].
ps
: Displays current processes.
ps x
: Displays all processes currently running on the computer.