ps 에는 정말 옵션이 많습니다.

보통 
ps -ef 
ps aux 
명령을 사용하는 것 외에는 옵션을 사용하지 않는 경우가 대부분인 듯 한데요.

ps -ef | grep 프로세스명 

위와 같이 grep 을 사용하지 않고 
ps 명령에 옵션을 주어 사용할 수가 있습니다.

ps -C  프로세스명  -o pid  --no-heading

-C 프로세스명 을 사용하면 됩니다.
-o pid  --no-heading 는 화면 출력을 조절하는 옵션입니다.


ps 옵션
********* simple selection *********
-A all processes                    
-N negate selection                 
-a all w/ tty except session leaders
-d all except session leaders       
-e all processes                    
T  all processes on this terminal   
a  all w/ tty, including other users
g  OBSOLETE -- DO NOT USE           
r  only running processes           
x  processes w/o controlling ttys   

********* selection by list *********
-C by command name
-G by real group ID (supports names)
-U by real user ID (supports names)
-g by session OR by effective group name
-p by process ID
-s processes in the sessions given
-t by tty
-u by effective user ID (supports names)
U  processes for specified users
t  by tty

*********** output format **********
-o,o user-defined  -f full          
-j,j job control   s  signal        
-O,O preloaded -o  v  virtual memory
-l,l long          u  user-oriented 
-F   extra full    X  registers
 
*********** long options ***********
--Group --User --pid --cols --ppid
--group --user --sid --rows --info
--cumulative --format --deselect
--sort --tty --forest --version
--heading --no-heading --context


ps -ef 옵션 의미
  • -e all processes 
    -f full-format listing

ps 는 standard syntax 와 BSD syntax 가 있습니다.

- standard syntax
ps -e
ps -ef
ps -eF
ps -ely

- BSD syntax
ps ax
ps axu

혼용할 수는 없습니다.


기타 옵션
********* misc options *********
-V,V  show version    
-m,m,-L,-T,H  threads 
-M,Z  security data   
-w,w  wide output     
L  list format codes
S  children in sum  
c  true command name
n  numeric WCHAN,UID
f  ASCII art forest
-y change -l format
-c scheduling class
-H process hierarchy

아래 예는 process tree 를 보여줍니다.
ps -ejH
ps axjf

'OS > linux / unix' 카테고리의 다른 글

df 용량이 실제하고 안 맞을 때  (1) 2010.05.25
create dummy file using dd  (0) 2010.05.21
ip  (0) 2010.05.19
less 를 tail 처럼  (0) 2010.05.08
ubuntu - multi boot 멀티 부팅  (0) 2010.05.05
Latest update: 2010. 5. 21. 15:06