B / Y / U / S
HOME À¥ È£½ºÆà µµ¸ÞÀÎ ¸Å´º¾ó °í°´Áö¿ø ¼³Á¤Á¤º¸ °èÁ¤½Åû 2024-12-28 Saturday 
À¥ È£½ºÆÃ
# °øÁö »çÇ×
# ÀÚÁÖ ¹¯´Â Áú¹®
# Áú¹®°ú ´äº¯
# °¡ÀÔ ¹®ÀÇ
Ä¿¹Â´ÏƼ
# ÀÚÀ¯°Ô½ÃÆÇ
# ¸®´ª½ºÆÁ
# ¾ÆÀÌÅ¥ Å×½ºÆ®
# ³»È¨ ¼Ò°³
# °Ö·¯¸®
# ÀÚ·á½Ç

  ¸®´ª½ºÆÁ  Go Unix Power Tools Online Book Go Bash Guide
Read No. 201 article 2015-02-14 20:14:47
NickName   Ç®ºñ´©
Subject   date ÀÇ ´Ù¾çÇÑ Ç¥Çöµé
date "+%Y-%m-%d" 
2006-01-05

date "+%Y%m%d" 
$(date "+%Y%m%d")
20060105

date "+%Y-%m-%d %H:%M"
2006-01-05 16:01

date "+%H%M%S"
$(date "+%H%M%S")
154007

date "+%Y%m%d%H%M%S"
$(date "+%Y%m%d%H%M%S")
20061125114327

date "+%Y%m%d.%H%M%S"
$(date "+%Y%m%d.%H%M%S")
20061125.114327

date "+%Y.%m.%d.%H.%M.%S"
$(date "+%Y.%m.%d.%H.%M.%S")
2006.11.25.11.43.36

date "+%Y-%m-%d_%H.%M.%S"
$(date "+%Y-%m-%d_%H.%M.%S")
2015-02-14_20.13.27

date "+%w"
4            -> ¸ñ¿äÀÏ

date -R --date "1 days ago"
Wed,  4 Jan 2006 16:07:31 +0900

date -R
Thu,  5 Jan 2006 16:07:40 +0900

date
2006. 01. 05. (¸ñ) 16:07:47 KST

date -R "+%d/%b/%Y"
05/Jan/2006 access_log ÀÇ ³¯Â¥Çü½Ä

date -R "+%d/%b/%Y" --date "1 days ago"
04/Jan/2006 access_log ÀÇ ³¯Â¥Çü½Ä(ÇÏ·çÀü)

date -R "+%a %b %e" | awk '{printf("%s %s %2d\n", $1,$2,$3)}'
Thu Jan  5 xferlog ÀÇ ³¯Â¥Çü½Ä

date -R "+%a %b %e" --date="1 days ago"| awk '{printf("%s %s %2d\n", 
$1,$2,$3)}'
# Thu Jan  4 xferlog ÀÇ ³¯Â¥Çü½Ä(ÇÏ·çÀü)

date "+%a %b %d %H:%M:%S %Y"
ls --full-time ³¯Â¥Çü½Ä # Wed Jan 28 18:37:32 2009

export LC_TIME="en_UR.enUS"; date "+%b %e %H:%M:%S" ; export 
LC_TIME="ko_KR.eucKR"
/var/log/message ³¯Â¥Çü½Ä # Jan 28 18:37:59


ÀÀ¿ë)

access_log ¿¡¼­ ¿À´ÃÂ¥ ·Î±×¸¸ ÃßÃâ
cat /var/log/httpd/access_log | grep $(date -R "+%d/%b/%Y") |less

xferlog ¿¡¼­ ¿À´ÃÂ¥ ·Î±×¸¸ ÃßÃâ
tac /var/log/xferlog|grep "$(date -R "+%a %b %e" | awk '{printf("%s %s 
%2d\n", 
$1,$2,$3)}')"|less

access_log ¿¡¼­ ÃÖ±Ù 24½Ã°£ ·Î±×¸¸ ÃßÃâ½Ã egrep ¼Ò½º 
egrep "$(for i in $( seq 0 24 ) ; do date -R "+%d/%b/%Y:%H" --date "$i hours 
ago" 
| awk '{printf("%s|", $1)}' ; done |sed -e 's/\(.*\)|$/\1/g')"

xferlog ¿¡¼­ ÃÖ±Ù 24½Ã°£ ·Î±×¸¸ ÃßÃâ½Ã egrep ¼Ò½º
egrep "$(for i in $( seq 0 24 ) ; do date -R "+%a %b %e %H" --date "$i hours 
ago" 
| awk '{printf("%s %s %2d %s|", $1,$2,$3,$4)}' ; done |sed -e 's/\
(.*\)|$/\1/g')"

messages ¿¡¼­ ÃÖ±Ù 10ºÐ°£ ·Î±×¸¸ ÃßÃâ½Ã 
tac /var/log/messages |awk '$2 ~ /'"$(date "+%d"|sed -e 's/^0//g')"'/ && $3 
~ 
/'"^$(date "+%H:%M" --date="0 mins ago")|^$(date "+%H:%M" --date="1 mins 
ago")|^$(date 
"+%H:%M" --date="2 mins ago")|^$(date "+%H:%M" --date="3 mins ago")|^$(date 
"+%H:%M" -
-date="4 mins ago")|^$(date "+%H:%M" --date="5 mins ago")|^$(date "+%H:%M" -
-date="6 
mins ago")|^$(date "+%H:%M" --date="7 mins ago")|^$(date "+%H:%M" --date="8 
mins 
ago")|^$(date "+%H:%M" --date="9 mins ago")|^$(date "+%H:%M" --date="10 mins 
ago")"'/ 
{print $0}'
Regist Addr [ 220.120.82.225 ] ¸ñ·Ïº¸±â À­±Û ¾Æ·§±Û
Á¤±ÔÇ¥Çö½Ä [ »ó¼¼ °Ë»ö ]
Page Loading [ 0.03 Sec ] SQL Time [ 0 Sec ]

Copyleft 1999-2024 by JSBoard Open Project
Theme Designed by IDOO And follow GPL2

°³ÀÎÁ¤º¸ Ãë±Þ¹æħ ÀÌ¿ë ¾à°ü »çÀÌÆ® ¸Ê ¾îµå¹Î °ü¸®