Tips tagged ps


29

Tip #183   Always running

This checks if a daemon is running, if not it starts the daemon. Great for daemons that need to always be running. Can be used with cron

ps -C someprogram || { someprogram & }

// sil at infiltrated dot net Read more »
  • TAGS:
  • ps

24

Tip #22   Grepping for processes

Grepping for a process will return the grep command, this can be avoided by adding '| grep -v grep' to a command or easier in some cases altering the regular expression by adding brackets around a character.

Read more »

6

Tip #822   Hierarchic list of processes

You probably use the ps command a lot, but sometimes there is too much info, and somewhat disordered. It can be easily ordered with the forest option, as the following example shows: Read more »
  • TAGS:
  • ps

3

Tip #528   Top ten running processes

Display the top ten running processes - sorted by memory usage

ps aux | sort -nk +4 | tail

ps returns all running processes which are then sorted by the 4th field in numerical order and the top 10 are sent to STDOUT. Read more »

1

Tip #262   Kill matching processes without unnecessary greps and extra sh p

ps -eo pid,args | awk '/sleep/ && !/awk/{ system("kill -9 "$1)}' Read more »