date 명령어에서의 형식 옵션 사용

2010.09.14 20:37

조인상 조회 수:22723

원문 : http://www.ischo.net -- 조인상 // 시스템 엔지니어

Writer : http://www.ischo.net -- ischo // System Engineer in Replubic Of Korea

+++++++++++++++++++++++++++++++++++++++++++++++++++++++

 

원문 : http://www.ischo.net -- 조인상 //시스템 엔지니어

+++++++++++++++++++++++++++++++++++++++++++++++++++++++

# date --help

Usage: date [OPTION]... [+FORMAT]
  or:  date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]

 

Display the current time in the given FORMAT, or set the system date.

  -d, --date=STRING         display time described by STRING, not `now'
  -f, --file=DATEFILE       like --date once for each line of DATEFILE
  -r, --reference=FILE      display the last modification time of FILE
  -R, --rfc-2822            output date and time in RFC 2822 format
      --rfc-3339=TIMESPEC   output date and time in RFC 3339 format.
                            TIMESPEC=`date', `seconds', or `ns' for
                            date and time to the indicated precision.
  -s, --set=STRING          set time described by STRING
  -u, --utc, --universal    print or set Coordinated Universal Time
      --help     이 도움말을 표시하고 끝냅니다
      --version  버전 정보를 출력하고 끝냅니다

FORMAT controls the output.  The only valid option for the second form
specifies Coordinated Universal Time.  Interpreted sequences are:

  %%   a literal %
  %a   locale's abbreviated weekday name (e.g., Sun)
  %A   locale's full weekday name (e.g., Sunday)
  %b   locale's abbreviated month name (e.g., Jan)
  %B   locale's full month name (e.g., January)
  %c   locale's date and time (e.g., Thu Mar  3 23:05:25 2005)
  %C   century; like %Y, except omit last two digits (e.g., 21)
  %d   day of month (e.g, 01)
  %D   date; same as %m/%d/%y
  %e   day of month, space padded; same as %_d
  %F   full date; same as %Y-%m-%d
  %g   last two digits of year of ISO week number (see %G)
  %G   year of ISO week number (see %V); normally useful only with %V
  %h   same as %b
  %H   hour (00..23)
  %I   hour (01..12)
  %j   day of year (001..366)
  %k   hour ( 0..23)
  %l   hour ( 1..12)
  %m   month (01..12)
  %M   minute (00..59)
  %n   a newline
  %N   nanoseconds (000000000..999999999)
  %p   locale's equivalent of either AM or PM; blank if not known
  %P   like %p, but lower case
  %r   locale's 12-hour clock time (e.g., 11:11:04 PM)
  %R   24-hour hour and minute; same as %H:%M
  %s   seconds since 1970-01-01 00:00:00 UTC
  %S   second (00..60)
  %t   a tab
  %T   time; same as %H:%M:%S
  %u   day of week (1..7); 1 is Monday
  %U   week number of year, with Sunday as first day of week (00..53)
  %V   ISO week number, with Monday as first day of week (01..53)
  %w   day of week (0..6); 0 is Sunday
  %W   week number of year, with Monday as first day of week (00..53)
  %x   locale's date representation (e.g., 12/31/99)
  %X   locale's time representation (e.g., 23:13:48)
  %y   last two digits of year (00..99)
  %Y   year
  %z   +hhmm numeric timezone (e.g., -0400)
  %:z  +hh:mm numeric timezone (e.g., -04:00)
  %::z  +hh:mm:ss numeric time zone (e.g., -04:00:00)
  %:::z  numeric time zone with : to necessary precision (e.g., -04, +05:30)
  %Z   alphabetic time zone abbreviation (e.g., EDT)

 

 

위의 옵션과 같이 FORMAT 형식을 우리가 자주쓰는  연연연연.월월.일일 과 같은 형식으로 사용할 수 있다.

 

 

오라클 exp 파일에 응용할 경우~~

 

BDATE=`date +%Y%m%d`

exp user/pass file=exp$BDATE.dmp log=exp$BDATE.log full=y

등과 같이 파일명에 날짜를 지정할 수 있다.

번호 제목 글쓴이 날짜 조회 수
공지 [공지] 게시자료 열람자유. 불펌금지입니다. 조인상 2010.12.07 108564
151 AIX 6 VM관련 OS parameter secret 조인상 2010.08.26 1
150 AIX 6.1 aio 설정법 조인상 2010.07.06 24149
149 IBM x시리즈 드라이버 업데이트 팩 file 조인상 2010.07.01 15711
148 IBM p시리즈 ASM/시리얼접속방법 조인상 2010.07.01 30794
147 IBM xSeries 펌웨어 업데이트를 위한 BoMC(Bootable Media Center) 사용법 file 조인상 2010.06.29 31418
146 Optimizing AIX 5L performance - AIX 5L시리즈 메모리 튜닝 조인상 2010.06.22 29273
145 ODM에 남아있는 Default Gateway 정보 삭제하기 조인상 2010.06.21 21107
144 Command is Respawning Too Rapidly. 3A30359F 조인상 2010.06.17 18522
143 pSeriese 온도 확인 방법 조인상 2010.06.17 20897
142 LPAR의 Memory Overhead (Hypervisor Memory) 사용량에 대하여 secret 조인상 2010.06.11 0
141 32KB 이상 파일 복사시 out of memory 에러 발생에 대한 복구(indirect segment 문제) 조인상 2010.06.10 19508
140 AIX에서 dump 강제로 받는 방법 file 조인상 2010.06.09 19295
139 AIX 환경에서 NFS port번호 range 지정방법 조인상 2010.06.04 37784
138 IBM 문서용 폰트 file 조인상 2010.06.04 16691
137 000-104 information secret 조인상 2010.06.02 1
136 신규시험 정보 Test 000-104: AIX 6.1 Administration 조인상 2010.06.02 24272
135 서버측HMC port ip확인하기 [3] 조인상 2010.05.14 27617
134 [매뉴얼] IBM p시리즈 머신에 레드햇리눅스 설치하기 file 조인상 2010.05.12 18234
133 BC & x시리즈 전력량 계산기 file 조인상 2010.05.11 17835
132 c 컴파일러 설치하기 조인상 2010.05.11 23195
서버에 요청 중입니다. 잠시만 기다려 주십시오...