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.

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 ae Editor

The ae editor is a simple text editor that you can think of as the Linux equivalent of the Microsoft Windows Notepad accessory. To start ae, simply type ae at the shell prompt; or, if you want to edit a particular file, type ae 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# ae mydata

Figure 4-7 shows ae’s standard display. At the top of the display is a status line, which shows the name of the file being edited and the current size of the file. If the file has been modified, the status line includes the word Modified. The top half of the display lists 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. For example, ^X denotes a Ctrl+X. To save the current file, you type a Ctrl+X followed by a Ctrl+S. 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. Table 4-8 summarizes ae’s most useful commands

The ae editor

Figure 4-7. The ae editor

Table 4-8. Summary of ae Commands

Command

Description

Ctrl+X I

Read a file into the editor.

Ctrl+X Ctrl+S

Write the current file.

Ctrl+X Ctrl+C

Save current file and exit.

Ctrl+Q

Quit without saving current file.

Ctrl+L

Redraw the screen.

Get Learning Debian GNU/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.