Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

When I first migrated from Windows to Ubuntu, by far the most daunting thing I had to do was use the command line.

Typing commands is an alien experience when you've only ever been used to pointing and clicking.

When I talk to new Ubuntu users, they are often uneasy with the idea of talking directly to their computer.

Is there a simple and friendly guide to help new users get acquainted with the command line?

Do you have any tips to make the experience easier or more fun?

share|improve this question
For what it's worth, Ubuntu tries hard (at least, harder than any other Linux distribution) not to make you use the command line if you don't want to. But there will always be things that are much easier/quicker to do on the command line than in a GUI. So it's a good idea to learn about it (and a good question). –  David Z Jul 31 '10 at 16:58

13 Answers 13

up vote 15 down vote accepted

If you are looking for a good guide to learn the command line, my favorite is

The guide will show you the basics of the command line, and will even guide you into writing useful shell scripts.

That said, most user will not need to use the command line for most day to day operations. I do not think that the command line should discourage users from migrating to Ubuntu. But once you learn the power of the command line, you won't be able to live without it!

share|improve this answer

I have been reading Official Ubuntu Server Book, The (2nd Edition) to learn system administration, and not only have I become more adept at using the command line, but I've also begun to learn the inner workings of the OS itself.

Using the Ubuntu Server Edition helps me to learn the command line easier, because I don't have the GUI to fallback on.

share|improve this answer

I recommand to use CLI Companion:

CLI Companion is a tool to store and run Terminal commands from a GUI. People unfamiliar with the Terminal will find CLI Companion a useful way to become acquainted with the Terminal and unlock its potential. Experienced users can use CLI Companion to store their extensive list of commands in a searchable list.

enter image description here

You get it by running:

sudo add-apt-repository ppa:clicompanion-devs/clicompanion-nightlies
sudo apt-get update
sudo apt-get install clicompanion

If you don't want to add the PPA try this file for 12.04 (latest version 1.1-6, released on 2012-04-14 - check this page for newer versions.) - or remove the PPA after installing with sudo add-apt-repository -r ppa:clicompanion-devs/clicompanion-nightlies .

share|improve this answer

1) Tab completion:

A giant time saver. If you are typing a command, you need only type enough of the command to provide an initial segment that can only be extended in a single way and then can press TAB once to expand your initial segment to the entire command. So, for instance, on my system umo TAB expands to umount. (On my system as what initial segments are extendable only in one way is a function of what you have installed, etc.) If you do not type enough to make the completion unambiguous, TAB will not expand, but a second TAB will display a list of possible completions. So, on my system, um TAB TAB yields:

umask       umax_pp     umount      umount.hal

Tab completion also works on paths: cd /home/me/docs/reallylo TAB will, if unique, expand to cd /home/me/docs/reallylongdirname and, if not unique, offer a list of candidate continuations as with um above.

2) man some-command or some-command --help or some-command -h:

If you cannot recall how a command works, you can get documentation right there in the shell. man usually provides the most detail. Usually one or both of the --help and -h arguments to a command provides a short summary.

3) head:

man some-command takes over the terminal and prevents you from entering commands while the man text is displayed. man some-command | head will display the first 10 lines. man some-command | head -n will display the first n lines. In both cases, you get your prompt back, so that you can have the man text on screen as you enter your command.

share|improve this answer
When I use man some-command, man allows me to scroll up and down through the page. Is that not usual? –  mac9416 Jul 31 '10 at 16:28
@mac9416: Indeed. I'd never tried that before :-[ Modified the answer to take this into account. Thanks! –  vanden Jul 31 '10 at 16:34
Yes, man uses a pager (usually less). If you want to examine a file in a similar way, type less somefile. If you do get used to vim, you can use jk keys to scroll. –  Umang Aug 1 '10 at 5:06
In all fairness, tab completion is not available in all shells. –  Nathan Osman Aug 4 '10 at 19:19
@George Edison: True enough. But, if it is a new user at issue (as it is in the question), they will not be very likely to have changed the shell from the default and thus will have tab completion. –  vanden Aug 7 '10 at 19:43

The Ubuntu Pocket Guide and Reference features a chapter on using the command line. It'll quickly get you up and running with the command line.

Also it is free to download or read online.

share|improve this answer

I learned a ton about using the command line and getting comfortable with working within it from reading The Bash Cookbook from O'Reilly and Associates. It's a book about Bash scripting, but the bite sized chunks of the cookbook format make it very accessible. As a side benefit, if you think "Gee, I'd sure like to do X, but I don't know how," you can use the table of contents to look up X (and Y and Z for that matter) and get a good idea on how to do it (and a decent explanation of how it works with pointers to other recipes and resources that can further expand your understanding).

share|improve this answer

To learn how to use a command add a space and then "--help" to the end of it - this tells you how to use it and gives a list of options.


cp --help
share|improve this answer

history | grep SOMETHING — finds command you used before that contains SOMETHING.

fortune ­— :-)

share|improve this answer
For this, I use Ctrl+R SOMETHING (with the difference that this gives the last occurrence). Repeat Ctrl+R to find more occurrences of SOMETHING in the command history. –  Bert Van Vreckem Aug 2 '10 at 19:17

"apropos" (or it's equivalent: "man -k") to find a command to do something.

$ apropos [my query]

For instance, to find the command to copy files:

$ apropos copy

will list a bunch of commands, of which

cp (1) - copy files and directories

is one.

"cp" is the command and "1" is the section from the manuals where it appears. Section 1 is general user commands (other sections include things like library calls, which you won't be interested in). To restrict the search to just section 1 use:

$ apropos -s1 [my query]

To then find out more about the command use "man". e.g.

$ man cp
share|improve this answer
+1 for being the first one to mention man. Bravo! –  jathanism Aug 4 '10 at 7:38

Try using fish

fish is a user friendly command line shell for UNIX-like operating systems such as Linux.

Amongst other things it features more advanced tab completion than bash which can be very helpful while learning.

alt text

share|improve this answer
Thanks..Nice utility –  User Jul 31 '10 at 23:31
I love the history search feature. Just type anything, hit the up arrow key and you are searching in your history for those same words. Great time-saver. –  Javier Rivera Aug 2 '10 at 16:47
the link to is outdated. is the new one. –  NES Jan 11 '11 at 22:10

Find an Ubuntu book with good command line index, zerox it and place it near the computer. Force yourself to use it. A good resource is the book "Ubuntu Linux Toolbox 1000+ commands", covers all you need to know (

However, if you don't run a server, in Ubuntu desktop almost everything is available with the GUI.

share|improve this answer

Here are some common commands for manipulating the filesystem:

  • cp [src] [dest] - copies src to dest
  • mv [src] [dest] - moves src to dest (also used for renaming)
  • cd [dir] - changes current directory to dir
  • pwd - prints the current directory
  • cat [file] - prints the contents of file to the screen
  • rm [file] - removes a file1
  • rmdir [dir] - removes an empty directory

Prefixing any of the commands with sudo causes the command to be executed as the root user.

1 - don't type sudo rm -rf / as it will erase the filesystem

share|improve this answer
Heh, +1 for the sudo rm warning :) –  Nicholas Knight Jul 31 '10 at 20:31
Don't forget a note about the infamous forkbomb ":(){ :|:& };:" that essentially forks an infinite number of new processes and gradually slowing the system until the it runs out of resources requiring a system restart. For more info see –  Evan Plaice Sep 10 '10 at 7:11

Switch to zsh!

While it is very much like bash, it has a lot of nice additional features out of the box (like for example typo correction, even in a preceding path component or a useful widget to call help for the current command (via run-help; I press ESC-h after e.g. having typed mplayer, and it opens the man page. After closing it I'm back at the old line)).

I recommend the following book, which covers zsh, bash and some other shells:
From Bash to Z Shell: Conquering the Command Line. While it is a few years old already, I'm glad this had not turned me away from buying it. This recommendation also holds if you do not want to switch to zsh.

I have been using the command line a lot since a few years (locally and via SSH), I've only recently made the switch to zsh myself (mostly because of my custom bash prompt, which is not compatible). Here is my zsh config (integrated in my dotfiles repository).

You can use chsh -s /bin/zsh to switch your shell (via /etc/passwd), or just call it from your current shell, i.e. type zsh in your bash prompt (you likely have to install it first though (sudo apt-get install zsh).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.