Quick reference for shell commands in the Cloud Basics articles

Although you can set up your VM with a remote desktop (see the Nectar Tutorials), the most efficient way to use your linux VM is by command-line.

There are some excellent tutorials for basic shell commands (also called unix or bash commands). Codecademy offers an excellent, free, interactive tutorial that you can complete within your browser on any operating system.

You may also like to print off a cheatsheet of shell commands, such as this simple one page sheet, or one of these more thorough references: Learncodethehardway or GitHubGist

Here are some particular commands used in the Cloud Basics articles, for quick reference.

Commands to use on your Mac/Linux to set up your NeCTAR connection

CommandAction
ssh-keygen -t rsa -f Nectar_Keygenerate a keypair locally
chmod 600 ~/.ssh/Nectar_Keysecure your private key
ssh -i Nectar_Key ubuntu@XX.XX.XX.XXSSH access to the VM

Commands to enter on your VM console during set-up

CommandAction
sudo passwd ubuntuset a password for user 'ubuntu'
sudo chown ubuntu /mntmake the ephemeral disk writable
sudo mkfs.ext4 /dev/vdcformat a new, empty volume
sudo mkdir /volume_namecreate an empty directory for the volume
sudo mount /dev/vdc /volume_name -t automount the volume
sudo chown ubuntu /volume_namemake the mounted volume writable
lsblk -llist the block storage
df -hTdisplay the disk usage
du -h <path/to/directory>display directory and file sizes
topactivity monitor for your VM
pslist the running processes on your VM (with PID#)
kill <PID#>terminate the process by PID number
control + 'c'stops a process running in your terminal
sudo apt-get updateupdates the list of packages available to install
sudo apt-get upgradeupgrades the installed packages
apt-cache search <name>search for a package to install
sudo apt-get install <name>install a package
nohup <normal commands go here> 2>&1 &keep a job running in the background
jobslist the active jobs (with job numbers)
control + 'z'pause a job running in the foreground
disown %ndetach a (paused) job from the terminal session (n=job number)
bg %nmove a (paused) job to the background (n=job number)