List and kill processes in Linux

Similarly to Windows there is way to list and kill stacked processes in Linux. You can use several applications as ps, top or ntop. 

In order to kill processes first you have to list started processes by using ps aux command as I did. Output is omitted.

user@ubuntu:~$ ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.3 0.2 33756 4216 ? Ss 10:10 0:02 /sbin/init
root 2 0.0 0.0 0 0 ? S 10:10 0:00 [kthreadd]
root 3 0.0 0.0 0 0 ? S 10:10 0:00 [ksoftirqd/0]
root 4 0.0 0.0 0 0 ? S 10:10 0:00 [kworker/0:0]
root 5 0.0 0.0 0 0 ? S< 10:10 0:00 [kworker/0:0H]
root 7 0.1 0.0 0 0 ? S 10:10 0:00 [rcu_sched]
root 8 0.0 0.0 0 0 ? S 10:10 0:00 [rcu_bh]
root 9 0.0 0.0 0 0 ? S 10:10 0:00 [rcuos/0]
root 10 0.0 0.0 0 0 ? S 10:10 0:00 [rcuob/0]
root 11 0.0 0.0 0 0 ? S 10:10 0:00 [migration/0]
root 12 0.0 0.0 0 0 ? S 10:10 0:00 [watchdog/0]
root 13 0.0 0.0 0 0 ? S< 10:10 0:00 [khelper]
root 14 0.0 0.0 0 0 ? S 10:10 0:00 [kdevtmpfs]
root 15 0.0 0.0 0 0 ? S< 10:10 0:00 [netns]
root 16 0.0 0.0 0 0 ? S< 10:10 0:00 [perf]
root 17 0.0 0.0 0 0 ? S 10:10 0:00 [khungtaskd]
root 18 0.0 0.0 0 0 ? S< 10:10 0:00 [writeback]
root 19 0.0 0.0 0 0 ? SN 10:10 0:00 [ksmd]

Also you can use top command. Just type top and you will receive output with live processes(Slide 1).

List and kill processes in Linux

Slide 1.

Now, you can kill processes on several ways. I`ll show you two. First you can use PID (process ID) to kill process.

user@ubuntu:~$kill 2577

 

ID 2577 was Firefox started on my laptop. Second way is to kill application, or you can say all instances of single application. Type following syntax.

user@ubuntu:~$killall firefox

With this you have just killed all Firefox instances.

I hope that this tutorial was informative to you and thank you for visiting this website.

 

 

Dejan Dzodan

Dejan Dzodan

IT professional for more then 15 years, mostly in financial institutions but with experience in ISP and retail. Proven in networking and overall infrastructure projects. Cisco instructor.

Leave a Reply

Your email address will not be published. Required fields are marked *


7 + 2 =