Before the introduction of the graphical user interface, UNIX and then Linux provided only a textual command-line interface. Today, a textual interface is available when you log in from a terminal, a terminal emulator, or a textual virtual console, or when you use ssh or telnet to log in on a system.

Advantages of Textual Interface

Although the concept might seem antiquated, the textual interface has a place in modern computing. In some cases an administrator might use a command-line tool either because a graphical equivalent does not exist or because the graphical tool is not as powerful or flexible as the textual one.

For example, chmod is more powerful and flexible than its GUI counterpart. Frequently, on a server system, a graphical interface might not even be installed. The first reason for
this omission is that a GUI consumes a lot of system resources; on a server, those resources are better dedicated to the main task of the server. Additionally, security considerations mandate that a server system run as few tasks as possible because each additional task can make the system more vulnerable to attack.

You can also write scripts using the textual interface. Using scripts, you can easily reproduce tasks on multiple systems, enabling you to scale the tasks to larger environments. When you are the administrator of only a single system, using a GUI is often the easiest way to configure the system.

When you act as administrator for many systems, all of which need the same configuration installed or updated, a script can make the task go more quickly. Writing a script using command-line tools is frequently easy, whereas the same task can be difficult to impossible using graphical tools.

Correcting Mistakes

You can correct typographical and other errors you might make while you are logged in on a textual display. Because the shell and most other utilities do not interpret the command line or other text you enter until you press RETURN, you can readily correct a typing mistake before you press RETURN.

You can correct such mistakes in several ways:

  • Erase one character at a time
  • Back up a word at a time
  • Back up to the beginning of the line in one step

The default erase key is BACKSPACE. If this key does not work, try pressing DEL or CONTROL-H. 

You can delete a word you entered by pressing CONTROL-W. A word is any sequence of characters that does not contain a SPACE or TAB.

You can delete the line you are entering by pressing the line kill key. When you press this key, the cursor moves to the left, erasing characters as it goes, back to the beginning of the line. The default line kill key is CONTROL-U. If this key does not work, try CONTROL-X.

Root Privileges

UNIX and Linux systems have always had a privileged user named root. When you are working as the root user, you have extraordinary system-wide powers. A user working with root privileges is sometimes referred to as Superuser or administrator. When working with root privileges, you can read from or write to almost any file on the system, execute programs that ordinary users cannot, and more.

With a conventional setup, you can gain root privileges in one of two ways. First, you can log in as the user named root; when you do so you are working with root privileges until you log out. Alternatively, while you are working as yourself, you can use the su (substitute user) utility to execute a single command with root privileges or to gain root privileges temporarily so you can execute several commands.

Logging in as root and running su to gain root privileges require you to enter the root password. The following example shows how to use su to execute a single command:

$ ls -l /lost+found
ls: cannot open directory /lost+found: Permission denied
$ su -c 'ls -l /lost+found'
Password: Enter the root password
total 0
$

The first command shows that a user who is not working with root privileges is not permitted to list the files in the /lost+found directory. The second command uses su with the –c (command) option to execute the same command with root privileges. Single quotation marks enclose the command to ensure the shell interprets the command properly. When the command finishes executing, the user no longer has root privileges.