2016년 10월 7일 금요일

Linux Command 리눅스 명령어

* find

   find /www/ -name 'test*' -print

   find /www/ -user nobody -group root -exec ls -l {} \;


* grep
   grep -nr 'test' *


* crontab

   - to View
      # crontab -l
 
   - to add and modify
      # crontab -e
 
   - cation! : one command by a line

   - Definition of fields
      ------    ----------   ---------------------------------------------------
      Field       Definition      Value Range
      ------    ----------   ---------------------------------------------------
      First        Minute        0-59
      Second   Hour           0-23
      Third       Day             0-31
      Fourth    Month          1-12
      Fifth       Week           0-7 (0or7=Sun, 1=Mon, 2=Tue,...)
      Sixth      Command    a command line to execute
      ------   ----------   ---------------------------------------------------

   - Examples

      . every 2 minute
         0-59/2 * * * * /usr/bin/php /abc/aaa.php
 
      . every 15 minute
         0,15,30,45 * * * * command
 
      . execute at 03:10
         10 3 * * * command
 
      . every month & First day & 00:10
         10 * 1 * * command
 
      . every monday & 14:10
         10 14 * * 1 command
 
      . everyday & 03:00 & backup
         0 3 * * * /home/ora10g_data/backup/daily_exp.sh
 
      . every sunday & 03:00 & full backup
         crontab -e 0 3 * * 0 /home/ora10g_data/backup/weekly_exp.sh

   - to allow other users except root
      . add USER ID in /etc/cron.allow

   - to deny other users
      . add USER ID in /etc/cron.deny


* Package  Linux

   - Add/Remove Software, Package Manager and Pirut
   # /usr/bin/pirut &

===

리눅스 명령어

* find

   find /www/ -name 'test*' -print

   find /www/ -user nobody -group root -exec ls -l {} \;


* grep
   grep -nr 'test' *


* crontab

   - crontab에 등록된 작업 보기
      # crontab -l
 
   - crontab에 작업 등록 & 수정
      # crontab -e
 
   - 주의! : 한 줄당 하나의 명령어를 등록

   - 필드 정의
      -------   ----------   ---------------------------------------------------
      필드      정의         값 범위
      -------   ----------   ---------------------------------------------------
      첫번째    분           0-59
      두번째    시           0-23
      세번째    일           0-31
      네번째    월           1-12
      다섯번째  요일         0-7 (0또는7=일요일, 1=월, 2=화,...)
      여섯번째  명령어       a command line to execute
      -------   ----------   ---------------------------------------------------

   - 예제

      . 2분마다
         0-59/2 * * * * /usr/bin/php /abc/aaa.php
 
      . 15분마다
         0,15,30,45 * * * * command
 
      . 03시 10분에 실행
         10 3 * * * command
 
      . 매월 1일 0시 10분에 실행
         10 * 1 * * command
 
      . 매주 월요일 14시 10분에 실행
         10 14 * * 1 command
 
      . 매일 03시에 backup 받기
         0 3 * * * /home/ora10g_data/backup/daily_exp.sh
 
      . 매주 일요일 03시에 full backup 받기
         crontab -e 0 3 * * 0 /home/ora10g_data/backup/weekly_exp.sh

   - root 이외의 사용자에게 crontab 명령어를 이용할 수 있게 하기
      . /etc/cron.allow 파일에 사용자의 id를 등록

   - 일반사용자의 crontab 명령어 사용을 못하게 하기
      . /etc/cron.deny 파일에 사용자의 id 를 등록


* Package  Linux

   - Add/Remove Software, Package Manager and Pirut
   # /usr/bin/pirut &

댓글 없음:

댓글 쓰기