amazon media file explorer download upload index folder image licenses menu widget Play Pause profile-settings more dots-two-horizontal dots-two-vertical more-vertical pending google-plus hangouts facebook instagram whatsapp spotify telegram twitter vine renren rss youtube twitch vimeo flickr dribble behance deviantart 500px steam github soundcloud skype reddit linkedin lastfm delicious stackoverflow pinterest xing flattr foursquare yelp World

Dealing With Misbehaving Processes in Ubuntu

If you are used to the Windows system, you would have likely come across a misbehaving application, which can most likely be killed using the Task Manager.

This is similar in GNU/Linux, the only difference is that you have to do it over the terminal, so, how do we deal with misbehaving processes on our GNU/Linux server?

If a process refuses to close normally or misbehaving, you may need to kill the process using the kill or killall commands. To get started with this, you first need to figure out the PID of the process, PID is a number assigned to a given process on your system, while humans can easily reference a process by name (e.g bash), the system knows processes by their ID, so, each program you open is given a different PID.

Go ahead and type the ps command in your console:


I'll assume the PID 321 is behaving, so, to kill it, I'll execute:

sudo kill 321

Bam! The process should most likely end now, so, you could check the logs for more information as to why it was misbehaving in the first place, and restart.

The way the kill command works is telling the process to cleanly terminate, if successful the process will free its memory and gracefully shuts down. Gracefully shut down means the process is given time to save its progress (the current works its doing), and the release resources (free its memory), in a simple sentence, it is not forced to stop.

If for some reason you aren't able to close a process, then you would have to force stop it, this is considered an extreme last resort and should be used with caution.

To force stop a process, you will send signal 9 to the process, this will force-closed the process without giving it any time to save its progress or react at all.

Note: By Default, the kill command sends signal 15, you can learn more about the GNU/Linux signal by consulting the man page: man 7 signal

So, to force-close PID 321, I'll use:

sudo kill -9 321

This will immediately kill the process without gracefulness, if for some weird reason, the process still manages to stay running, then try to reboot the server.

What if you want to kill a process by name?

Fortunately, you can! By using the killall command, you can kill any process by name, but note that it kills any process it finds with the name you've given as an option.

For example, let's say I want to kill all nano editor:

sudo killall nano

You can also send signal 9 to force stop the process as well:

sudo killall -9 nano

Related Post(s)

  • How To Access Windows 10 Drive/Folder in VirtualBox

    To access Windows drive or folder in your Guest OS, you first of all, install VirtualBox guest utilities: sudo apt-get install virtualbox-guest-utils You then Add a shared folder by going into: Setti

  • Send Mail with Attachment Using Mutt in GNU/Linux

    Mutt is a powerful text-based mail client for Unix/Linux operating systems. It features color support, message threading, MIME support...

  • Using Pageant To Automatically Authenticate SSH key in Putty

    I can't count how many times I have typed my ssh key passphrase whenever my ssh connection times out, it is so annoying and repetitive. Well, thanks to the putty pageant, you can do that seamlessly.

  • Installing WP-CLI In a GNU/Linux Server

    WP-CLI is a command-line interface for WordPress. It can also be used with ClassicPress, as they are no differences in their usage, maybe just minimal if you are updating or downloading new ClassicPr

  • How To Send Mail To Multiple Addresses Using (mailx)

    In this guide, you'll learn a couple of ways you can send mail to multiple addresses using mailx. mailx is a utility program for sending and receiving mail. I assume you already have mailx command, i

  • Mounting and Unmounting Cloud Storage With (Rclone) in GNU/Linux

    Ever wondered if you could mount your preferred cloud storage as a virtual drive on your system? Thanks to Rclone, you can mount and access different kinds of cloud storage from a file manager, I'll