Learning About Your System

Since knowledge is power, it is logical to want to know more about your system—or at least to know what tools are available at a given point in time.

If there are issues of software compatibility, it may be helpful to know the exact kernel build that you are running on.

To view information about the machine and operating system:

1.
At the command prompt, type uname -a.

2.
Press Enter.

The computer will respond with text along these lines:

								Linux linuxbear 2.2.5-15 #1 Mon Apr 19 23:00:46 EDT 1999 i686 unknown
							

The response to the uname -a command provides the following information:

Linux:Name of the operating system (-s)

linuxbear:Host name (-n)

2.2.5-15 #1:Release number of the kernel (-r)

Mon Apr 19 23:00:46 EDT 1999:Build information about the kernel (-v)

i686:Machine (-m)

unknown:Processor (-p)

Tip

You can issue the uname command with a specific flag, as indicated in the list above, rather than returning all the information with -a.


Determining free disk space

In Linux, the file system is an artificial construct made up of an overall tree structure beginning with the root directory (represented by /). The location of a directory on this artificial tree does not imply that the directory is physically on a particular hard drive.

A file system that is mounted is in use in the system. The directory that represents the nexus between a mounted file system and the overall tree structure is called a mount point.

You can see which file systems are mounted, how much space they have, and their mount points with the df command.

To determine free disk space:

1.
At the command prompt, type df.

2.
Press Enter.

You will see a response along the lines of the following code, displaying each mounted file system, its used and available space, and its mount point. You can use the df command to find out where file systems are mounted and how much space they have available. (See Table 11.1 below).

Determining Free Disk Space    
Filesystem1k-blocksUsedAvailableUse%Mounted on
/dev/hda22208347118233891185356%/
/dev/hdc5560545560540100%/mnt

Figure 11.1. You can use the du command to list disk usage in the current directory.


To determine disk use in a directory:

1.
At the command prompt, type du.

2.
Press Enter.

Information will be displayed about disk use in the current directory and subdirectories, in kilobytes (Figure 11.1).

Tip

If you name a path with the du command, for example,

								du /home/hdavis/linuxvqs
							

the disk use in that directory and its subdirectories will be displayed.


Tip

You can pipe the output of du to more, by typing du | more, to make the output readable if it fills multiple screens.


Determining the file type

In Windows, you can usually make a guess about the type of a file from its extension. In Linux, files are often not named with an extension, and you have no way of knowing the file type based on the file name.

To find out the file type:

1.
At the command prompt, type file followed by the path and name of the file. For example, type

									file /home/hdavis/wpdocs/testwp
								

2.
Press Enter.

The system will respond with a message about the file, like this:

									/home/hdavis/wpdocs/testwp: WordPerfect document
								

Tip

The file command will not provide helpful results for all files. This command first checks the file for the kind of data it contains. It next reads a file correspondence table from the so-called magic file (this is usually /etc/magic if you want to examine it). For example, a WordPerfect file is recognized because the WordPerfect installation program added information to the magic file.


Figure 11.2. The finger command will tell you who is logged on.


Determining the system users

To find out who is logged onto your system and all kinds of other information about these users, you can use the finger command.

To find out who is logged in:

1.
At the command prompt, type finger.

2.
Press Enter.

A list of users who are logged on and their home directories will be displayed (Figure 11.2).

Tip

Fingering a particular user, for example, by entering finger hdavis, will produce some additional information about that user, including the user's shell, elapsed time since logon, and idle time since logon.


Tip

Needing to know who you are may seem unlikely if you already know yourself—or more the subject for an existential French movie than an issue in Linux system administration. But if you're logged onto your system with multiple identifications and haven't customized your prompt to display IDs, things can get confusing. In that case, the whoami command will tell you the user ID you have used to log on.


..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset