the list (158 kilobytes in this example). Directories such as the current directory (
.
) and the parent
directory (
..
) -- the directory above the current directory -- are noted as directories by the letter
d
at the beginning of each entry (each directory begins with a d, and each file begins with a
-
).
The file and directory names are shown in column 7. In this example, a dot (
.
) represents
/home/chris
and two dots (
..
) represents
/home
-- the parent directory of /chris. Most of
the files in this example are dot (
.
) files that are used to store GUI properties (
.kde
directory)
or shell properties (
.bash
files). The only non-dot file in this list is the one named
letter
.
Column 3 shows the directory or file owner. The
/home
directory is owned by root, and every-
thing else is owned by the user chris, who belongs to the sales group (groups are listed in
column 4).
In addition to the
d
or
-
, column 1 on each line contains the permissions set for that file or direc-
tory. (Permissions and configuring shell property files are described later in this chapter.) Other
information in the listing includes the number of links to the item (column 2), the size of each file
in bytes (column 5), and the date and time each file was most recently modified (column 6).
The number of characters shown for a directory (4096 bytes in these examples) reflects
the size of the file containing information about the directory. While this number can
grow to more than 4096 bytes for a directory that contains a lot of files, this number doesn't reflect
the size of files contained in that directory.
The format of the time and date column can vary. Instead of displaying May 12, the dis-
play can be 2008-05-12 depending upon the distribution.
Checking System Activity
In addition to being a multiuser operating system, Linux is a multitasking system. Multitasking
means that many programs can be running at the same time. An instance of a running program is
referred to as a process. Linux provides tools for listing running processes, monitoring system usage,
and stopping (or killing) processes when necessary.
The most common utility for checking running processes is the
ps
command. Use it to see which
programs are running, the resources they are using, and who is running them. Here's an example of
the
ps
command:
$ ps au
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 2146 0.0 0.8 1908 1100 ttyp0 S 14:50 0:00 login --jake
jake 2147 0.0 0.7 1836 1020 ttyp0 S 14:50 0:00 -bash
jake 2310 0.0 0.7 2592 912 ttyp0 R 18:22 0:00 ps au
In this example, the
-a
option asks to show processes of all users who are associated with your
current terminal, and the
-u
option asks that usernames be shown, as well as other information
such as the time the process started and memory and CPU usage. The concept of a terminal comes
from the old days, when people worked exclusively from character terminals, so a terminal typi-
NOTE
NOTE
NOTE
NOTE
43
Running Commands from the Shell
2