Useful Linux Programs

This section presents several programs you may find helpful in working with your Linux system. You’ll learn several commands that report system status and you’ll learn how to use pico, a simple text editor.

Table 4-6. Floppy Drive Designators

Designation

Meaning

/dev/fd0

3.5-inch diskette in a: (1.44 MB)

/dev/fd0d360

5.25-inch diskette in a: (360 kB)

/dev/fd0D720

3.5-inch diskette in a: (720 kB)

/dev/fd0h1200

5.25-inch diskette in a: (1.2 MB)

/dev/fd0H1440

3.5-inch diskette in a: (1.44 MB)

/dev/fd0H2880

3.5-inch diskette in a: (2.88 MB)

/dev/fd1

3.5-inch diskette in b: (1.44 MB)

/dev/fd1d360

5.25-inch diskette in b: (360 kB)

/dev/fd1D720

3.5-inch diskette in b: (720 kB)

/dev/fd1h1200

5.25-inch diskette in b: (1.2 MB)

/dev/fd1H1440

3.5-inch diskette in b: (1.44 MB)

/dev/fd1H2880

3.5-inch diskette in b: (2.88 MB)

Viewing System Information

Linux provides a number of commands that report system status. The most commonly used commands are shown in Table 4.7. These commands can help you troubleshoot system problems and identify resource bottlenecks. Although each command can be used without options or arguments, each supports options and arguments that let you customize operation and output; consult the appropriate manual page for details.

Table 4-7. Useful System Commands

Command

Function

df

Shows the amount of free disk space (in 1K blocks) on each mounted filesystem.

du

Shows the amount of disk space (in 1K blocks) used by the working directory and its subdirectories.

free

Shows memory usage statistics, including total free memory, memory used, physical memory, swap memory, shared memory, and buffers used by the kernel.

ps

Shows the active processes (instances of running programs) associated with this login session. Use the -a option to list all processes.

top

Shows a continually updated display of active processes, and the resources they are using. Type the q key to exit.

uptime

Shows the current time, the amount of time logged in, the number of users logged in, and system load averages.

users

Shows each login session.

w

Shows a summary of system usage, currently logged-in users, and active processes.

who

Shows the names of users currently logged in, the terminal each is using, the time each has been logged in, and the name of the host from which each logged in (if any).

Using the pico Editor

The pico editor is a simple text editor that you can think of as the Linux equivalent of the Microsoft Windows Notepad accessory. To start pico, simply type pico at the shell prompt; or, if you want to edit a particular file, type pico followed by the name of the file (or the file’s path, if the file is not in the working directory). For example, to edit the file mydata, type:

[root@desktop /root]# pico mydata

Tip

If pico fails to start, you probably did not install the pine package, which contains it. You can install that package by following the instructions given in Appendix C.

Figure 4.7 shows pico’s standard display. At the top of the display is a status line, which shows the version of the program and the name of the file being edited (or “New Buffer,” if the file is new). If the file has been modified, the upper right corner of the display contains the word Modified. The bottom two lines of the display list the available editing commands. Most of the commands require you to type a control character, so that commands can be distinguished from characters you want to add to the buffer. Typing an ordinary character inserts it at the current cursor position. You can use the cursor keys to move around the display; you can use the delete or backspace key to erase unwanted characters. Some commands use the third line from the bottom to report status and obtain additional input.

The pico editor

Figure 4-7. The pico editor

Table 4.8 summarizes pico’s commands. Notice that the command Ctrl-G accesses pico’s help system. You can access several of the commands by using function keys; for example, pressing F1 has the same result as typing Ctrl-G.

Table 4-8. Summary of pico Commands

Command

Description

Ctrl-^

Mark the cursor position as beginning of selected text.

Ctrl-A

Move to the beginning of the current line.

Ctrl-B

Move backward one character.

Ctrl-C (F11)

Report the current cursor position.

Ctrl-D

Delete the character at the cursor position.

Ctrl-E

Move to the end of the current line.

Ctrl-F

Move forward one character.

Ctrl-G (F1)

Display help.

Ctrl-I

Insert a tab at the current cursor position.

Ctrl-J (F4)

Format the current paragraph.

Ctrl-K (F9)

Cut selected text.

Ctrl-L

Refresh the display.

Ctrl-N

Move to the next line.

Ctrl-O (F3)

Save the current buffer to a file.

Ctrl-P

Move to the previous line.

Ctrl-R (F5)

Insert an external file at the current cursor position.

Ctrl-T (F12)

Invoke the spelling checker.

Ctrl-U (F10)

Paste text at the current cursor position.

Ctrl-V (F8)

Move forward one page of text.

Ctrl-W (F6)

Search for text, neglecting case.

Ctrl-X (F2)

Exit pico, saving the edit buffer.

Ctrl-Y (F7)

Move backward one page of text.

Get Learning Red Hat Linux 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.