Basic Commands

It is impossible to know how many commands the average shell citizen uses, but if we had to guess, we would place it at about 25:

• cat Prints the contents of a file

• cd Changes directories

• chmod Changes file access permissions

• du Prints disk usage

• emacs Text editor

• find Finds files by searching

• grep Searches for a string in input

• less Filter for paging through output

• ln Creates links between files

• locate Finds files from an index

• ls Lists files in the current directory

• make Compiles and installs programs

• man The manual page reader

• mkdir Makes directories

• ps Lists processes

• rm Deletes files and directories

• ssh Connects to other machines

• tail Prints the last lines of a file

• top Prints resource usage

• which Prints the location of a command

• xargs Executes commands from its input

Of course, many other commands are available to you that get used fairly oftendiff, nmap, ping, su, uptime, who, and so onbut if you are able to understand the 25 listed here, you will have sufficient skill to concoct your own command combinations.

Note that we say understand the commandsnot know all their possible parameters and usages. This is because several of the commands, though commonly used, are used only in any complex manner by people with specific needs. gcc and make are good examples of this: Unless you plan to become a programmer, you need not worry about these beyond just typing make and make install now and then. If you want to learn more about these two, see Chapter 30, "C/C++ Programming Tools for Ubuntu."

Similarly, both Emacs and Vim are text editors that have a text-based interface all of their own, and SSH has already been covered in detail in Chapter 19, "Remote Access with SSH and Telnet".

What remains is 20 commands, each of which has many parameters to customize what it actually does. Again, we can eliminate much of this because many of the parameters are esoteric and rarely used, and, the few times in your Linux life that you need them, you can just read the manual page!

We will be going over these commands one by one, explaining the most common ways to use them. There is one exception to this: The xargs command requires you to understand how to join commands together.

Most of these commands have been touched on elsewhere in the book, primarily in the "Using the Shell" section of Chapter 5, "First Steps with Ubuntu." The goal of that section was to give you "the least you need to know" to get by, whereas in this chapter each command is treated individually with an aim to giving you the confidence needed to be able to mix them together to create your own commands.

Was this article helpful?

0 0

Post a comment