As someone who has always been a little tentative when it comes to command line action I thought I’d share some of the commands I use regularly when I do foray into terminal-dom. Hopefully you’ll find them useful and they’ll help you become more productive from the command line.


My favourite (probably because I make lots of mistakes) is simply hitting ctrl-u to delete a whole line you’ve just entered. I use this countless times a day.


mkdir is something I use on a regular basis to create directories. To make subdirectories I used to make the parent dir then cd into that, then make the next dir. It was an arduous process, until someone told me about mkdir -p

# mkdir -p for nested directory structure
mkdir -p parentdir/childdir/etc


Another very useful command is !!. This runs the last command you ran so is particularly useful when a command fails because you don’t have the right permissions, just use sudo !!.

# this will fail unless run as sudo
chown -R User Directory
# so instead of typing it out again use
sudo !!

On top of that you can also use !{a letter}, this runs the last command you ran starting with that letter. E.g. !c to run the last chown command.

&, jobs, kill

Sometimes you run commands that produce lots of output, such as, a server. Often you want to leave these running and carry using the same shell. To do this you need to make the process run in the background. Putting a & after the command will do the trick.

# use & after the command to run in background
servedir &
# a number will be printed to the terminal
# e.g. [2] 9502, remember this
# use with the kill command to stop it running
kill -9 9502
# use the 'jobs' command to show background jobs
# to get the pids of running background tasks use
jobs -p


wget is a command I love. How often do you need a resource from the web in your current directory? Well if you know its URI then all you need to do is use wget to download it.

# e.g. download the latest version of jquery
# or if you want to change the filename whilst downloading use the -O arg
wget -O jquery_latest.js

That is the basic way to use wget but it can do a lot more. Have an explore, there are loads to wget tutorials out there with loads more info.


My trips to the command line are often made because I need to install something or set something up for a project. When doing this I’m usually following a set of instructions which is when I’ll notice new commands that people use. However when the time comes to use it I’ve more often than not forgotten how best to use it. Fear not that is when the history comes to the rescue. Use

# history -- returns a list of the commands you've used recently
# add a number to only return a set number of commands
history 25
# to look for a specific command pipe output to the search command grep
# e.g. history | grep 
history | grep git

See, the terminals not really that scary a place, if I can start to get to grips with it then everyone else will be able to. I think the key is throwing yourself in and looking to improve what you do there and become more efficient.

Anyway, hopefully that was useful for some people. Please share your favourite terminal tips/commands in the comments below…