Command line cheat sheet

Last updated by Juho Jaakkola

Bacic commands for Linux command line

Moving in directories

You can change the directory using the cd command (= change directory). Without arguments it goes to your home directory:


So it's the same as:

cd /home/username

Go to the parent directory:

cd ..


Listing contents of a directory

List the contents of the current directory:


Same list with more details:

ls -l


Getting Elgg from git:

Go under your server's wwwroot (the location may vary depending on your server):

cd /home/username/public_html/

Then clone Elgg from Github:

git clone

Go inside the cloned directory:

cd Elgg

See which git branch your local repository is currently on:

git branch

This lists also the remote (e.g. Github) branches:

git branch -a


Switching branches

You can checkout a new branch from Github:

git checkout -b 1.x origin/1.x

git branch now gives an updated listing:

git branch

You can switch between existing branches with:

git checkout <branch name>