Code Scrappers


Process - Unix Commands


ps

~ It shows the process status.

  saarthak@DESKTOP-N01EJET:~$ ps
  PID TTY          TIME CMD
    4 tty1     00:00:00 bash
   17 tty1     00:00:00 ps
          



ps -f

~ Full listing showing PPID of each process.

  saarthak@DESKTOP-N01EJET:~$ ps -f
  UID        PID  PPID  C STIME TTY          TIME CMD
  saarthak     4     3  0 19:23 tty1     00:00:00 -bash
  saarthak    19     4  0 19:39 tty1     00:00:00 ps -f

          



ps -e

~ It shows all process including user and system process.

  saarthak@DESKTOP-N01EJET:~$ ps -e
  PID TTY          TIME CMD
    1 ?        00:00:00 init
    3 tty1     00:00:00 init
    4 tty1     00:00:00 bash
    20 tty1     00:00:00 ps
            



ps -a

~ Process of all users excluding system process.

  saarthak@DESKTOP-N01EJET:~$ ps -a
  PID TTY          TIME CMD
    4 tty1     00:00:00 bash
   21 tty1     00:00:00 ps
            



ps -l

~ Long listing showing memory related information.

  saarthak@DESKTOP-N01EJET:~$ ps -l
  F S   UID   PID  PPID  C PRI  NI ADDR SZ WCHAN  TTY          TIME CMD
  0 S  1000     4     3  0  80   0 -  4229 -      tty1     00:00:00 bash
  0 R  1000    22     4  0  80   0 -  4271 -      tty1     00:00:00 ps
            



ps -t

~ It shows processes running on terminal.

  saarthak@DESKTOP-N01EJET:~$ ps -t
  PID TTY      STAT   TIME COMMAND
    3 tty1     Ss     0:00 /init ro
    4 tty1     S      0:00 -bash
   23 tty1     R      0:00 ps -t
            



kill

~ To stop a particular process use kill along with its PID. You can also use multiple PID's with a single kill command

  saarthak@DESKTOP-N01EJET:~$ kill 17

  saarthak@DESKTOP-N01EJET:~$ kill 17 123 147