Revision of Introduction to the Command Line from Tue, 12/25/2012 - 22:09
The revisions let you track differences between multiple versions of a post.
This manual covers the basics of using the command line.
Why use the command line
- There are programs that have no GUI (Graphical User Interface).
- It can be faster and more efficient than using a GUI for some tasks.
Finding a terminal
GNOME (default Trisquel):
- Applications menu -> Accessories -> Terminal
- Keyboard Shortcut: Ctrl + Alt + T
LXDE (Trisquel Mini):
- Menu -> Accessories -> LXTerminal
Xfce:
- Applications menu -> System -> Terminal
KDE:
- KMenu -> System -> Terminal Program (Konsole)
Using the prompt
Regardless of what desktop environment you use, you should see a window similar to the one below.
- trisquel: This is the username.
- laptop: This is the name of the computer.
- ':' : Everything after this colon is going to deal with where the current location is.
- '~' (Tilde): This represents the home directory (all of your personal user files are kept here).
- '$' : The prompt ends in this character. If you are a super user, the prompt will start with '#'.
Using the command line
- Type in a command and hit enter.
- Some commands are interactive, meaning that the program will ask for extra input.
- You can read "man pages" (manuals) by typing in "man ''[command]''". For example, the command "man apt-get" will return information on how to manage your packages (programs) via the command prompt.
- Press 'q' to exit the man page.
- Do not blindly enter commands without knowing what they do. Even small commands can do damage to a system.
How to become a super user
A super user is a user that can administrate system-wide settings on the computer. For example, installing software is system-wide and will affect all users, and hence requires super user privileges.
In Trisquel, the default user is given sudo
privileges, which means that user has to re-enter their own password to become a super user. An example is provided below:
sudo apt-get install apache2
The above command, when typed in Terminal, will use the apt-get program to install the "apache2" package. To run a program as a super user, simply run sudo [program] [parameters]
.
New users created in Trisquel won't have sudo privileges by default. To give a new user sudo privileges, do the following:
- Type
sudo adduser [newuser]
, substituting [newuser] with the name of your new user. - Use the default user to run
sudo visudo
. - Use the down key on your keyboard to scroll to the bottom.
- Type the following text at the end of the file:
- [newuser] ALL=(ALL) ALL
- Press CTRL+X to exit, and hit Y to save. Backspace the ".tmp" part of the filename, so it is /etc/sudoers
- Hit Y to override the file
When you login to your new user account, it will have sudo privileges.
Su
The su
command is a way of becoming a super user using the root password instead of your own. To use it, enter su
in Terminal and enter the root password. A # symbol should appear, meaning all commands from here will be run as a super user.
To exit su, type exit
. You will see the $ symbol, meaning that you are now a normal user again.
Additional resources
This manual is only an introduction to the command line. If you are interested in learning more, consult the documentation below: