Getting Started on Cloud Computing: Useful Commands

Command Action
whoami Print your username
pwd Print current working directory
cd name Move to directory called name
cd .. Move up one directory
mkdir name Creates a directory called name
ls List files in current working directory
ls -l List files in current working directory (long format)
ls --help Help for the ls command
man ls Read the manual of the ls command. Quit by pressing Q
tree -L 2 Shows a file and directory tree of depth 2.
nano file Opens a file called file in the nano editor.
Save your edits with Ctrl+O and quit nano with Ctrl+X
cat file Print the contents of the file called file to the terminal
mv from to Move or rename a file called from to new location or name to
rm file Delete a file called file
rm -rf dir Delete director called dir and all files and subdirectories it contains.
Be very careful with this!
wget url Download the file specified by URL url and save it as a file
head -n 5 file Shows the first 5 lines of file
tail -n 5 file Shows the first 5 lines of file
less file Read file interactively. Exit by pressing Q
python3 file Run the python code in file with the Python interpreter
Rscript file Run the R code in file with the R interpreter
javac files Compile one or multiple .java source code files to .class bytecode files.
java ClassName Run the program starting from the main method in class ClassName
command < file Runs command and sends the contents of file to the standard in of that process as if someone was typing it into the terminal while that process is running.
crontab -e Edit your user's cron table that specifies scheduled tasks
date Prints the current date and time
tmux new -s name Create a new virtual terminal session with name name
tmux Create a new virtual terminal session
tmux ls List existing tmux virtual terminal sessions
tmux detach
or press Ctrl + B, then D
Detach from the current virtual terminal
tmux attach -t name Enter the virtual terminal sessions called name
tmux kill-session -t name Ends the virtual terminal session called name.
This ends all programs running in it.
exit Leaves the virtual terminal (if inside one).
Closes the connection if you perform it in the shell directly.
htop Check resource consumption.
Press F10 or click F10Quit to exit.