2011년 1월 24일 월요일

유용한 리눅스 명령어...(업데이트중..)

* sticky bit
   Sticky” means that even if multiple users have write permission on a directory, 
     only the  owner of a file can delete the file within a sticky directory.
 
* list up partitions

   $ cat /proc/partitions  

* partition editor
   $ gparted

* mpeg4 --> mp3 conversion


   $ ffmpeg -i <mpeg4 file> -b 192k <mp3-filename.mp3>

* NFS Client version & Stat

   [rsyoung@ui01 ]$ /usr/sbin/nfsstat
    Client rpc stats:
    calls      retrans    authrefrsh
    25530      0          0


    Client nfs v3:
    null         getattr      setattr      lookup       access       readlink
    0            0% 6864     26% 25        0% 832       3% 2054      8% 1         0%
    read         write        create       mkdir        symlink      mknod
    15272    59% 43        0% 9         0% 0         0% 0         0% 0         0%
    remove       rmdir        rename       link         readdir      readdirplus
    12        0% 0         0% 1         0% 4         0% 2         0% 105       0%
    fsstat       fsinfo       pathconf     commit
    278       1% 26        0% 0         0% 0         0%



* Remote NFS version check

   [rsyoung@ui01 CDF]$ /usr/sbin/rpcinfo -u 192.168.123.251 nfs
   program 100003 version 2 ready and waiting
   program 100003 version 3 ready and waiting
   [rsyoung@ui01 CDF]$ whereis nfs


* Filesystem Block Size

   [root@wn1038 ~]# dumpe2fs /dev/sda2 | grep "Block size"
    dumpe2fs 1.39 (29-May-2006)
    Block size:               4096
   [root@wn1038 ~]#


* condor queue에 있는 모든 job을 강제로 종료하기

   $ condor_q | while read f; do g=`echo $f | 
                awk 'print $1}'`; condor_rm -forcex $g;done



* worker node retrieving using "seq"

   # for sv in $(seq -f wn10%02g.rsyoung.org 10 15) \
      $(seq -f wn20%02g.rsyoung.org 01 12) ; \  
      do echo "[ $sv ]";   ssh $sv 'df -h /tmp' ; done



* onevm list에 나오는 uniq한 사용자 축출 

   $ onevm list | grep -e '[:space:]*[:digit:]'
           awk -F " " '{print $2}' | sort | uniq | wc -l
 

* History Command

   $ Ctrl+R for searching
   $ !4         <-- 4번째 명령실행



* Ubuntu Firewall Enable/ Disable

   $ sudo ufw <enable | disable>
      : ufw = uncomplicated firewall 


* Ubuntu에서 nologin Account 생성하기


    $ sudo useradd -s /usr/sbin/nologin <account_name>


* 큰파일 여러조각으로 만들고 복원하기

    $ split --bytes = 1m /path/to/large/file      
                         /path/to/output/file/prefix
    $ cat prefix* > xyz


* ip 주소만 축출하기

 ifconfig  | grep 'inet addr:' | grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'


* 특정시간이 이전에 수정된 파일 찾아 지우기

  find . -ctime +0 -exec rm -f {} \;


* 특정 파일보다 이후에 생성된 파일 찾기

  touch -t 201103010000 <filename>
  find . -type f -newer ../20110301 -exec ls -l {} \;
   
   - 찾은 후 파일크기 총합 구하기
     cat files.txt | awk -F " " '{sum += $5} END {print sum}' 


* ip 주소 삭제하기

   ip address del 192.168.0.100 dev eth0




* pdf 파일 잘라내기



  pdftk A=one.pdf B=two.pdf cat A1-7 B1-5 A8 output combined.pdf


* modprobe blacklist



vim /etc/modprobe.d/blacklist.conf

댓글 없음:

댓글 쓰기