Xubuntu Offline Documentation

Chapter 12. The command line

Table of Contents

Running commands with administrative rights
Common commands

While Xubuntu, including the default applications and the applications in the Ubuntu repositories, comes with graphical user interfaces to accomplish most tasks, sometimes you might want or need to use a command line to achieve your goal - or just achieve it faster.

To start the default terminal emulator and get to the command line, either

There is a great tutorial on using the command line in the Ubuntu community wiki.

Running commands with administrative rights

When working on the command line, any command can be run as an administrator by prefixing the command with sudo. Sudo will remember your password for 15 minutes to allow you to perform multiple administrative tasks without being prompted for a password each time.

[Note]

If the program you wish to run as an administrator is graphical, such as the Leafpad text editor, you should use the command gksudo instead of sudo, even if you are running the application from the command line.

[Warning]

Be careful when using sudo; you might damage your system if you type the wrong command! As a general rule, only use sudo when absolutely necessary. When you use sudo from a terminal, be sure to close it when you have finished!

For more information on sudo, see the sudo page on the Ubuntu community wiki.

Common commands

Basic terminal commands are outlined below (square brackets indicate substitutions):

Command What it does? Syntax
ls Lists files in a directory; lists files in the current directory if none is specified ls [directory]
cd Changes to another directory cd [directory]
cp Copies a file (or files) to a directory or to overwrite another file cp [file(s)] [directory]
mv Moves or renames a file mv [filename] [newfilename]
man Get help about a command man [command]
cat Joins (concatenates) two or more files cat [file1] [file2] ... > [output file]
less View the contents of a text file less [file]
editor Edit a text file editor [file]