2

Does anyone know how to use procps-3.2.8 in listing all the running processes of ubuntu/linux? And how to kill them using procps-3.2.8?

please provide the step-by-step procedure and provide useful links about procps.

Mantosh Kumar
  • 5,659
  • 3
  • 24
  • 48
Hammad Ali Khan
  • 138
  • 1
  • 11
  • Dear Mantosh,you have do this by a single command to display all the processes, but i wanted to display all running processes through a c-language code. Is it possible through c language code? if it is possible please provide me the code. @mantosh – Hammad Ali Khan Apr 13 '14 at 12:51

1 Answers1

1

procps is the package which contains the many command line utility provided. You can find the complete information about each utility option under the procpcs from the below location:

On the homepage we can get the following information about procps:

procps is the package that has a bunch of small useful utilities that give information about processes using the /proc filesystem. The package includes the programs ps, top, vmstat, w, kill, free, slabtop, and skill.*

http://www.linuxfromscratch.org/lfs/view/7.2/chapter06/procps.html

http://procps.sourceforge.net/

How to use procps-3.2.8 in listing all the running processes?

ps is the part of procps package and there are numerous ways to list the all running process(For detailed information do man ps).

mantosh@mantosh4u:~/practice$ ps -V
procps version 3.2.8
mantosh@mantosh4u:~/practice$ ps -AF
UID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD
root         1     0  0  6143  2544   3 14:38 ?        00:00:00 /sbin/init
root         2     0  0     0     0   1 14:38 ?        00:00:00 [kthreadd]
.............................................................................
root      3320     2  0     0     0   0 15:13 ?        00:00:00 [kworker/u:2]
root      3334     2  0     0     0   1 15:18 ?        00:00:00 [kworker/1:0]

How to kill them using procps-3.2.8?

pkill is part of procps package which contains numerous command line option to kill a process. For detailed information man pkill on your terminal.

mantosh@mantosh4u:~/practice$ pkill -V
pkill (procps version 3.2.8)
mantosh@mantosh4u:~/practice$ pkill -f gedit

In the above example, the gedit was the process name which has been killed.

Mantosh Kumar
  • 5,659
  • 3
  • 24
  • 48
  • How would I call this from C++? The CLI is fine but I'm trying to learn a little about the kernel and C++ and I just can't see how these things are linked. – AFP_555 Nov 18 '20 at 22:06