System Commands

 < Day Day Up > 

There are a number of very useful shell commands that will give you a wealth of information about your system. These commands are useful for either a system administrator monitoring a system or any Linux user wanting to examine what is happening on his machine. The more commonly used system commands are shown in Table 18.2 and will be explained in this chapter. Many if not most of these commands have no Windows equivalent because Windows is meant to be run from the graphical interface, and not all functionality is supported from the command line. In Windows there is no real separation between the operating system and the graphical interface. This is different from Linux, where the graphical interface is completely separate from the operating system, and the operating system can be run without the graphical interface.

Table 18.2: System Commands



Windows Equivalent


This command will list all currently running processes. Any program or daemon is a process.

No Windows equivalent.


This command lists all currently running processes, whether the user started them or not. It also lists more detail on the processes.

No Windows equivalent.


This will list information about network card.your

The Windows equivalent is ipconfig.


This command is used to see if you can reach a specific IP address.

The same command works in Windows.


This command will trace the route to a specific IP address.

The Windows equivalent is tracert.


This command is used to get information about a user.

The same command works in Windows.


This command will tell you all the users currently logged in system. This is useful if your Linux to your machine is being used as a server for an office.

There is no Windows equivalent.


This command will display the current date and time.

The same command works in Windows.


This command displays the name of the current system.

There is no Windows equivalent.


This command is similar to finger and gives information about a targeted user.

There is no Windows equivalent.


This command will list all environmental variables.

There is no Windows equivalent.


This command is used to stop a currently running process.

There is no Windows equivalent.

ps, top, kill, and env

Three of these commands, ps, top, and env, are all related to each other in that they provide valuable information about how your system is currently functioning. The fourth command, kill, is used to stop running processes. The commands ps and top both show the processes that are currently running. Every program, utility, or daemon on your PC is a process. The ps command, shown in Figure 18.8, shows only those processes that you, the current user, initiated.

click to expand
Figure 18.8: The ps command.

The top command shows all the processes, even those you did not initiate. Your system starts a number of processes for you. The top command also tells you what user started a process, what the process ID is, how much CPU time the process is using, how much memory it is using, and more. The top command is shown in Figure 18.9.

click to expand
Figure 18.9: The top command.


The PID is a unique identifier for each running process. It stands for Process Identifier. In Windows, every running process is assigned a Windows handle. The Windows handle and the PID are essentially the same things.

The top command provides a lot of information—perhaps too much. It certainly fills up the screen quickly. This is one instance where the redirect command would be very useful. You can dump the output of the top command to a text file and read it at your leisure. Recall that you do this by typing in:

top > somefile.txt

Then you can open that file in any text editor and read it, search it, or do whatever you want with it. The top command is often used by system administrators either to identify processes that are consuming too much system resources or to search for telltale signs of hackers or viruses.

The env command provides you with all the current environmental variables. Environmental variables will be specific to a given user. This means that if you run the env command while a different user is logged in, you may get different results. Environmental variables cover many aspects of the user’s environment. The home directory, current user, and current history size are all environmental variables.

The path statement is also a very important environmental variable. The path statement lists all the paths in which the operating system will look for a command when you type it in the shell. All the commands we study are actually programs somewhere on your machine. The path statement tells the shell where to look for commands you enter. This is important because there are some software packages you may install, particularly programming tools such as Java, that ask you to add one of their directories to the path. The env command’s display is shown in Figure 18.10.

click to expand
Figure 18.10: The env command.

The kill command is perhaps the simplest command of all. You enter the word kill followed by the process ID (PID). An example is kill 1045. Be very careful with this command. If you kill a process the system requires, you could cause the system to function improperly or even crash. This is one reason why you don’t want people to log in as root. Only root can kill a system process. If a user is logged in under a user account, he cannot kill a system process.

 < Day Day Up > 

Moving From Windows to Linux
Moving From Windows To Linux (Charles River Media Networking/Security)
ISBN: 1584502800
EAN: 2147483647
Year: 2004
Pages: 247
Authors: Chuck Easttom © 2008-2017.
If you may any questions please contact us: