1. Home
  2. Computing & Technology
  3. Focus on Linux

From Authors, for About.com

    information.


  • killall
  •    

    Kill a process by it's name, uses names instead of process id's (pid's). Use -v to have killall report whether the kill was successful or not and -i for interactive mode (will prompt you before attempting to kill).


           pkill - a little like a killall with regular expressions
            

    pkill is another command that allows processes to be killed but does so using regular expressions. See below for more information.

    For example:


       

    killall -iv mozilla

    Would kill anything named "mozilla" and prompt you before each kill and report whether the kill was successful or not. Unfortunately you need to get the name exactly right for killall to work, you would need to use "mozilla-bin" to kill the mozilla browser. If you want something where you don't need to know the exact name try pkill (below).


  • pkill
  •    

    pkill is used to kill processes according to an extended regular expression. Use the -u option to kill using a user name(s) and process name (for example to only kill a process of a certain user). pkill can also send specific signals to processes.

    For normal usage simply type:


       

    pkill process_name

    Note that the "process_name" doesn't have to be an exact match...

    Or to kill the "process_name" of only the users "fred" and "anon" type:


       

    pkill -u fred anon process_name


  • skill
  •    

    skill is used to send a command/username/tty a particular signal.

    skill has a number of options available to ensure correct interpretation (otherwise it just guesses what it is), simply type skill -option(s)

    • -L --- list the various signals that can be sent

    • -u --- specify a username; this is obviously followed by the user name or a space-seperated list of usernames.

    • -p --- process id (followed by the process id)

    • -c --- command name (this is the same as killall )

    • -t --- (tty number)

    • -v --- verbose mode

    • -i --- interactive mode.

    skill can be used to stop, continue, or kill processes using the username, command name or process id (or send them any variety of signals you like).

    Useful example:


       

    skill -STOP abusive_user_name

    The above command will stop all of that users processes, this will cause his screen to freeze until you type:


       

    skill -CONT abusive_user_name

    This would tell that all processes may continue as before. Note that this would only work if you are root. Also note you can list more than one user name with the command so it will apply to multiple users.


  • CTRL -C
  •    

    The break key, will kill (break, stop) something that's running on your terminal.


  • jobs
  •    

    Prints currently running jobs, as in processes you have executed within the shell.


  • bg
  •    

    Backgrounds a process. To start a program in the background (so it doesn't take over the terminal) use an "&" (ampersand) sign at the end of the command. You usually use CTRL -Z to suspend something you are currently using. You can simply use bg to resume in the background the last job suspended...

    Command syntax:


       

    bg job_number

    or


       

    bg job_name


  • fg
  •    

    Bring a process to the foreground, so you can interact with it. The process will use your current terminal. Note simply use fg to foreground the last job number

Explore Focus on Linux

More from About.com

  1. Home
  2. Computing & Technology
  3. Focus on Linux

©2008 About.com, a part of The New York Times Company.

All rights reserved.