User Tools

Site Tools


unix_commands:ps

The ps command in Linux and Unix-like systems is used to display information about the currently running processes. It is used to display information about the currently running processes. It provides information such as the process ID (PID), the terminal associated with the process, the status of the process, and the command used to start the process.

Please note that the options for ps command may vary depending on the version of Linux or Unix-like systems you are using. In this article we will go over both Linux and FreeBSD variants of the ps command. For more information always refer to man ps.

Here are a few examples of how the ps command can be used:

  1. Display information about all processes running on the system:
    ps -ef
  2. Display information about processes running for a specific user:
    ps -u username
  3. Display information about processes running for the current terminal:
    ps -t tty
  4. Display information about a specific process:
    ps -p PID
  5. Display a process tree:
    ps -efH

The ps command with option -ef will show all the process running on the system, including system process and user's processes, it will show the process ID, terminal, status, and command used to start the process.

The -u option can be used to display the processes of a specific user, and the -t option can be used to display the processes running on a specific terminal. The -p option can be used to display information about a specific process. The -H option can be used to display the process hierarchy (process tree)

It's also possible to use ps command with grep to filter the output, for example:

ps -ef | grep "http"

This command will show all the process running httpd (http server) and its child processes.

It's also possible to use ps command with awk to format the output and extract specific information from the output, for example:

ps -ef | awk '{print $2}'

This command will show all the process ID of the running process.


The ps command in FreeBSD is similar to the ps command in Linux.

Here are a few examples of how the ps command can be used in FreeBSD:

  1. Display information about all processes running on the system:
    ps aux
  2. Display information about processes running for a specific user:
    ps -U username
  3. Display information about a specific process:
    ps -p PID
  4. Display a process tree:
    ps -axj

The ps aux command will show all the process running on the system, including system process and user's processes, it will show the process ID, terminal, status, and command used to start the process.

The -U option can be used to display the processes of a specific user, and the -p option can be used to display information about a specific process. The -axj option can be used to display the process hierarchy (process tree)

It's also possible to use ps command with grep to filter the output, for example:

ps aux | grep "httpd"

This command will show all the process running httpd (http server) and its child processes.

It's also possible to use ps command with awk to format the output and extract specific information from the output, for example:

ps aux | awk '{print $2}'

This command will show all the process ID of the running process.

Here is another example of the ps command with awk to list specific information about the processes running by a particular user, user1:

ps -U user1 | awk '{print $1}
unix_commands/ps.txt ยท Last modified: 2023/01/17 11:18 by admin

CIFNet is a leading hosting solution provider, offering a wide range of services including IP bandwidth, co-location, VMware and KVM hosting.
Host Your Site with CIFNet!