3

Using the Shell

IN THIS CHAPTER

Accessing the shell

Using command history and completion

Assigning aliases

Gaining super user access

Writing simple shell scripts

The use of a shell command interpreter (usually just called a shell) dates back to the early days of the first UNIX systems. Besides its obvious use of running commands, shells have many built-in features such as environment variables, aliases, and a variety of functions for programming.

Although the shell used most often with Linux systems is called the Bourne Again Shell (bash), other shells are available as well (such as sh, csh, ksh, and tcsh). In many cases, these shells, such as sh, are really symbolic links to other shell programs, such as bash. On Ubuntu Linux, sh is a symbolic link to /bin/dash. The sh shell is important as it is called in most shell scripts as the shell to run scripts. For interactive usage, bash forms the default shell.

This chapter offers information that will help you use Linux shells, in general, and the bash shell, in particular.

Terminal Windows and Shell Access

The most common way to access a shell from a Linux graphical interface is using a Terminal window. From a graphical interface, you can often access virtual terminals to get to a shell. With no graphical interface, with a text-based login you are typically dropped directly to a shell after login.

Using Terminal Windows

To open a Terminal window from Unity (the default Ubuntu desktop), select the Dashboard icon, and then begin ...

Get Ubuntu Linux Toolbox: 1000+ Commands for Power Users, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.