Summary

The command line is the key to Linux. Even if you prefer GUI tools to text-mode tools, understanding text-mode commands is necessary to fully manage Linux. This task begins with the shell, which accepts commands you type and displays the results of those commands. In addition, shells support linking programs together via pipes and redirecting programs’ input and output. These features enable you to perform complex tasks using simple tools by having each program perform its own small part of the task. This technique is frequently used with Linux text filters, which manipulate text files in various ways—sorting text by fields, merging multiple files, and so on.

FAQ

What features Linux shells offer to speed up command entry?

The command history often enables you to retrieve an earlier command that’s similar or identical to the one you want to enter. Tab completion reduces typing effort by letting the shell finish long command names or filenames. Command-line editing lets you edit a retrieved command or change a typo before committing the command.

What is the purpose of the man command?

The man command displays the manual page for the keyword (command, filename, system call, or other feature) that you type. This documentation provides succinct summary information that’s useful as a reference to learn about exact command options or features.

What is the purpose of environment variables?

Environment variables store small pieces of data—program options, information about the computer, and so on. This information can be read by programs and used to modify program behavior in a way that’s appropriate for the current environment.

What is the difference between standard output and standard error?

Standard output carries normal program output, whereas standard error carries high-priority output, such as error messages. The two can be redirected independently of one another.

What is the purpose of pipes?

Pipes tie programs together by feeding the standard output from the first program into the second program’s standard input. They can be used to link together a series of simple programs to perform more complex tasks than any one of the programs could manage.

What is the structure of regular expressions?

Regular expressions are strings that describe other strings. They can contain normal alphanumeric characters, which match the exact same characters, as well as several special symbols and symbol sets that match multiple different characters. The combination is a powerful pattern-matching tool used by many Linux programs.