Server Administration & Management

How to kill Multiple Processes In Linux

There are many cases where you want to kill multiple processes that match a certain pattern in their command line strings. For example, suppose you want to kill all processes that are running commands with keyword “javaxyz” in their arguments.

# ps aux | grep javaxyz

Here is a single command that will kill all processes at once that are matched with grep.

# kill -9 `ps aux | grep javaxyz | grep -v grep | awk ‘{print $2}’`

The command line inside a pair of backtick characters (i.e., ps aux …. ‘{print $2}’) will print out a list of process IDs that are matched with grep. The result is then used by the outer command kill. The “grep -v grep” is to exclude a self match (i.e., grep command itself) from a list of matched processes.

One caveat with this command is that when you are running it in a shell script, make sure to use bash, not sh.

If you are running the following script with sh: you will get “kill: Illegal number:” error. The command line inside a pair of backticks is returning a multi-line response, and it appears that sh is not able to handle it. But bash can. So the following script should be okay.

kill -9 `ps aux | grep javaxyz | grep -v grep | awk ‘{print $2}’`

May 30, 2014 Posted by | Security, Tips & Tricks, Unix/Linux | , , , | Leave a comment

Commands Line Shortcuts

Here are following some tips to speed up our work.

# cmd1 ; cmd2

The above command will run cmd1 and then excute cmd2

# cmd1 && cmd2

This will execute cmd2, if cmd1 is successful.

# cmd1 || cmd2

The above sequence will run cmd2 if cmd1 is not successful.

May 20, 2014 Posted by | Tips & Tricks, Unix/Linux | , | Leave a comment

How to disable WhatsApp Blue Ticks for Read Messages

Recently, WhatsApp quietly introduced a new feature that lets users know that their messages have been read, with the double grey ticks appearing in front of the messages turning blue and now, just as quietly, the mobile messaging service is letting users of its Android app disable the feature with the rollout of WhatsApp version 2.11.444. This version is available for users on WhatsApp’s website for now, and will eventually be rolled out to all users.

Here’s how you can disable the blue coloured read receipts’ with the message timestamp on WhatsApp’s Android app:-

1. Make sure that your smartphone is running on Android 2.1 or a newer version.

2. Go to settings menu and enable ‘Download from Unknown Sources‘ in the Security tab

3. Go to the WhatsApp website and download the APK (application) file available under http://www.whatsapp.com/android/

4. Once the APK file is downloaded to your device, tap the ‘Install‘ option.

5. Now that WhatsApp has been updated, select Settings –> Account –> Privacy.

6. Under the Privacy tab, uncheck the Read Receipts option.


This feature however doesn’t apply to group messages and will let other participants know when you’ve read a message. Also, once you disable this feature, you won’t be able to view blue double-check marks when you send a message as well. 

The feature that enabled the users to see when their messages were read didn’t go down too well with the users and with this update, WhatsApp seems to be taking steps to please users who were not happy with the new feature.

May 10, 2014 Posted by | Security, Tips & Tricks | , , | Leave a comment