1

I'm new to linux.

How can I show a list of all processes that says about each process if it's running or suspended? I've tried

ps -ef|grep myusername

but it doesn't say if the processes are running or not. also tried

ps ux

same thing, it doesn't say if the processes are running or not.

I'm looking for something like this list: I get this list when I move a process to background, I don't know how to see it otherwise...

adiro
  • 370
  • 1
  • 3
  • 17

4 Answers4

1

You can use "ps" to list processes, This (ps aux) will list all the processes. Given an example output of it below.

ps aux | more

USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND 

root         1  0.0  0.1 189160  9376 ?        Ss   15:51   0:04 /usr/lib/systemd/systemd --switched-root --system --deserialize 20

root         2  0.0  0.0      0     0 ?        S    15:51   0:00 [kthreadd]
root         3  0.0  0.0      0     0 ?        S    15:51   0:00 [ksoftirqd/0]
root         5  0.0  0.0      0     0 ?        S<   15:51   0:00 [kworker/0:0H]
root         7  0.0  0.0      0     0 ?        S    15:51   0:06 [rcu_sched]
root         8  0.0  0.0      0     0 ?        S    15:51   0:00 [rcu_bh]
root         9  0.0  0.0      0     0 ?        S    15:51   0:04 [rcuos/0]

By checking the STAT of the process ( UNDER "STAT" ) you can identify the process states, Below are some possible states codes.

  • R running or runnable (on run queue)
  • D uninterruptible sleep (usually IO)
  • S interruptible sleep (waiting for an event to complete)
  • Z defunct/zombie, terminated but not reaped by its parent
  • T stopped, either by a job control signal or because it is being traced

You can type "man ps" to get more info.

Nix Nikhil
  • 36
  • 4
0

You can use htop to see the list of processes and there is a column for process state

What does a C process status mean in htop?

http://www.howtogeek.com/howto/ubuntu/using-htop-to-monitor-system-processes-on-linux/

Community
  • 1
  • 1
Randolf
  • 125
  • 1
  • 9
0

ps -p PID -o comm=

Enter the code above where PID is PID of the process.

Sanchay
  • 1,053
  • 1
  • 16
  • 33
0

Following command will be more helpful to you.

Use the command : sudo lsof -i -n -P

This command lists the Application Name, PID, User, IP version, Device ID and the Node with Port Name. It shows both TCP and UDP.

Variations :

To format it in a nice, readable way; use :

sudo lsof -i -n -P | more

To view view only TCP connections :

sudo lsof -i -n -P | grep TCP | more

To view view only UDP connections :

sudo lsof -i -n -P | grep UDP | more
Radadiya Nikunj
  • 988
  • 11
  • 10