레이블이 linux인 게시물을 표시합니다. 모든 게시물 표시
레이블이 linux인 게시물을 표시합니다. 모든 게시물 표시

2020. 10. 10.

Find and kill zombie process

 ## In linux, 


## find zombie process , grep Z or 'defunc'

host:~$ ps   aux  | grep Z

host:~$ ps aux  | grep defunc

   option:  a  : all with tty, include other users

                 u : display user-oriented format

                  x : processes without controlling ttys


## parent process must be killed  to kill  zombie prcess, find parent , using 'pstree'

host:~$ pstree -paul    
   options :  

                   -p : show pids

                   -a : show ommand line arguments

                   -u : show uid transitions

                   -l : don't truncate long lines



2019. 9. 19.

find by size

find by size

find ./ -type file -size +500M 

option: 
b - 512 block
c - byte
w - two bytes words
k - kilo
M - mega
G - giga

# find and display size. human readable

find ./ -type file -size +500M -exec ls -lh {} \;


September 19, 2019 at 02:22PM

2018. 11. 27.

batch replace string in files by command line

batch replace string in files by command line
sed -i — ‘s/want_str/rep_str/g’ file_patterns

ex) -i — ‘s/abc/123/g’ *.txt




November 27, 2018 at 01:06PM

2018. 10. 31.

Passing all arguments to other functions

Passing all arguments to other functions

using $@

ex)  run.sh
    # instead  
   oher_command $1 $2 ...
    # with
    other_command $@ 

!! That’s all.


October 31, 2018 at 12:30PM

2018. 6. 17.

grep keyword recursively


grep -R —include’{file patterns}’ {keyword}

## example 


grep -R --include '*.xml' server  # find server in xml files. 

Finding older files than specif times

# created time is more than 24hour
    find . -mtime +1    

#find files and delete 

  find  . -mtime +1 -exec rm  {} \; 

2015. 3. 7.

Change vi color scheme

It is based on http://kb.mediatemple.net/questions/1565/Enabling+vi+syntax+colors#gs

1) open .vimrc    at home directory
2) Add below codes.
      syntax on
      colorscheme desert
3) Save it.
4) open code file by vi.

** color scheme list
    default, desert, elflord...

Enjoy it.


2013. 6. 14.

Kill specified process list

kill `ps aux | grep keyword| grep -v grep | awk '{print $2}'`

# check keyword and kill processes by pid from awk