LinuxShort

From MediaWiki

Revision as of 22:10, 24 September 2009 by Ana (Talk | contribs)
Jump to: navigation, search

Usefull short commands

  • kill a process tree

When some script is started from a command line in a for-loop and a process tree is made, one should find the parent process and its PID and then simply kill it:

   $ pstree username -p 
   sshd(19953)---bash(19954)---bash(22238)---idl(22323)-+-{idl}(22326)
                                                              |-{idl}(22327)
                                                              |-{idl}(22328)
                                                              `-{idl}(22329) 
   sshd(20096)---bash(20097)
   sshd(20762)---bash(20763)
   sshd(21087)---bash(21088)-+-grep(21309)
                             `-top(21308)
   sshd(21736)---bash(21737)
   sshd(21780)---bash(21781)---pstree(22331)

Or if this tree is to long, one should grep the program (here:idl) with: $ pstree usrname -p | grep idl

   $ kill 19953  
   $ pstree username -p  
   sshd(20096)---bash(20097)
   sshd(20762)---bash(20763)
   sshd(21087)---bash(21088)-+-grep(21309)
                             `-top(21308)
   sshd(21736)---bash(21737)
   sshd(21780)---bash(21781)---pstree(22332)
Personal tools