How To Check Status Of Active Processes Using PS Command In Linux/Unix?

How To Check Status Of Active Processes Using PS Command In Linux/Unix?

   

This post was last updated on August 1st, 2020 at 12:07 pm

In a Unix-like operating system, a process is a program in execution. Linux or Unix is a multitasking operating system that means more than one program can be running at the same time. Whenever a command is issued a new process starts. Kernel identifies a process with a unique id called process id or PID. The processes communicate with each other and with the kernel to carry out a task.

In Linux/Unix ps command is used to display a snapshot of the current processes. Ahead in this article, we will discuss the ps command and its usages in Linux/Unix.

The ps command

The ps command is used to display information about a selection of active processes. It stands for process status. The information displayed using the ps command is a little bit different from that displayed using top command.

Syntax of ps command is given below –

ps [options]

A list of options is given in manual page of ps command you can see it by running –

man ps

List all processes for the current shell

If you run ps command without any options then it will display the list of all processes in the current shell.

ps

Where,

PID – Process ID

TTY -This is the terminal type that the user logged into

TIME -Total accumulated CPU utilization time

CMD – Name of the command which launches this process

Print the list of all the active processes in a system

If you are using a distribution of Linux then use the following command to display the list of active processes in a system –

ps -A | less

or

ps -e | less

In FreeBSD run the following command –

ps au

or

ps aux

Display a process by the process id or PID

You can display the process by using PID, Use the command as given below –

ps -fp PID

For example –

ps -fp 1

Display the threads of a process

To print all the threads of a process, use the following command in the terminal –

ps -fL -C chrome

The given command will print the threads or subprocesses of chrome.

View all the process owned by the parent process

You can use the parent process id or ppid to display the sub-processes of a process by using –

ps --ppid 1

This will display the processes owned by the parent process with ppid 1.

To know more about ps command and its usage see its manual page by executing –

man ps

Conclusion

If you want a repetitive update on the selection and displayed information then use top command instead of using ps. If you want to say something on this topic then write to us in the comments below.

Previous Cant access System32
Next [ubuntu] Ubuntu 20.04 No Display on 2nd monitor after 1st reboot

About author

You might also like

Linux Topics 0 Comments

How To Install a Package From .tar.gz Or .tar.bz2 File In Linux?

This post was last updated on August 1st, 2020 at 02:17 pmA file archiver is used to hold multiple files into a single archive file. And a file compression utility

Linux Topics 0 Comments

How to Configure vncserver in Fedora Linux

This post was last updated on November 6th, 2016 at 12:32 amVnc server and vnc viewer is used to Remote Access in most of the Linux machines like Fedora, RHEL,

Linux Topics 0 Comments

How to Print files in Linux Using Command Line

Printing a file is one of the basic functionalities provide by the linux operating system, rather than just printing a file its provides us with a variety of options like

0 Comments

No Comments Yet!

You can be first to comment this post!

Leave a Reply