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.

https://trisquel.info/files/ittcl1.png

  • 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:

Revisions

01/13/2011 - 07:18
AndrewT
07/30/2012 - 09:10
vod
12/25/2012 - 22:09
andrew
08/13/2013 - 18:20
lloydsmart
12/29/2013 - 19:29
Ehrenamtlich
01/11/2014 - 21:12
lembas
09/04/2014 - 02:38
muhammed
06/16/2016 - 14:30
anonymous
07/19/2016 - 20:33
Telstar
03/05/2018 - 01:02
s1lv3r
10/07/2018 - 15:51
albert_tremblay
09/16/2022 - 21:37
Hein
08/08/2024 - 07:21
knife