External commands are independent of the shell. Like other programs, the shell executes external programs by looking them up in the executable search path. The PATH environment variable contains a colon-separated list of directories to search for programs.
Even a vanilla Ubuntu installation comes supplied with hundreds of external commands. Many of them are terminal-based and represent cornerstone commands that let you manage the filesystem, monitor the system, develop software, improve your productivity, manipulate data, install/remove software, and much more.
Of course, you can run GUI apps from the shell. In many cases, GUI apps are merely a frontend to a command-line interface. To start some GUI apps, the name might not be immediately obvious. For example, to start the program shown as Terminal in the Dash, you need to type gnome-terminal in the shell.
There’s way too many external commands to cover here. We’ll cover the most useful in a later article in this series.
A man page (short for manual page) is a form of software documentation. External commands usually have a man page. They provide a description about the software together with available options. Here’s an extract from the manual page for whereis.
$ man whereis
There are other help-related tools such as
whatis which provides a brief description of an external command. If you try
whatis with a shell builtin you’ll get the response “nothing appropriate”; whatis is only helpful for external commands.
Redirect error and output messages to /dev/null
When we run a command from the shell error and output messages will appear in the terminal. While they can be very useful in diagnosing any problems, you may wish to suppress them.
>/dev/null redirects the command standard output to the null device, which is a special device which discards the information written to it.
$ command >/dev/null 2>&1
For example, we can start Rhythmbox from the terminal and suppress its error and output messages with the command:
$ rhythmbox >/dev/null 2>&1
We can place Rhythmbox in the background to allow us to continue using the shell by appending the & character to the above command.
$ rhythmbox >/dev/null 2>&1 &
Pages in this article:
Page 1 – Types of Commands
Page 2 – Shell Builtins
Page 3 – Aliases
Page 4 – External Commands
Page 5 – Navigate the shell efficiently
Page 6 – Appendix – Explanation of Shell Builtins
All articles in this series:
|Linux For Starters: Your Guide to Linux|
|Part 1||What is Linux? Why use Linux? What do I need?|
|Part 2||Choose a Linux distribution meeting your specific needs and requirements.|
|Part 3||Make a bootable Ubuntu USB stick in Windows.|
|Part 4||We show you how to install Ubuntu 21.04 on your hard disk.|
|Part 5||Things to do after installing Ubuntu.|
|Part 6||Navigating your way around the Desktop.|
|Part 7||Updating the system, install new software.|
|Part 8||Open source replacements for proprietary Windows desktop software.|
|Part 9||Get started with the power and flexibility of the terminal.|
|Part 10||We cover the basics of files and permissions.|
|Part 11||Getting help from your system.|
|Part 12||Learn all about the file system.|
|Part 13||Manipulating files from the shell.|
|Part 14||Maintain your system with these simple tips.|
|Part 15||Managing users on your system.|
|Part 16||Explore different desktops to GNOME 3.|
|Part 17||Gaming on Linux.|
|Part 18||Protect your privacy with this guide.|
|Part 19||Access the Windows desktop from Linux using a remote desktop client.|
|Part 20||Set up a virtual machine running Ubuntu as the host and openSUSE as the guest.|
|Part 21||Wine lets you run Windows programs on Linux without emulation.|