linux小练习1

1linux小练习1

 

1   [[email protected] ~]#date '+%F %H:%M:%S'
     2019-04-16 12:16:54

[[email protected] ~]#date  '+%Y-%m-%d %H:%M:%S'

2019-04-16 12:20:15   

[[email protected] ~]#date '+%F %X'  %T是系统时间时分秒 %X 是硬件时间的时分秒
2019-04-16 09:49:20 PM

2   [[email protected] ~]#date -d '-2 day' +%a
     Sun  或
     [[email protected] ~]#date -d '-2 day' +%A
     Sunday

3
[[email protected] ~]#date -s '2019-08-07 06:05:10' > /dev/null && date "+%Y-%m-%d %H:%M:%S"
2019-08-07 06:05:10


date -s '2019-08-07 06:05:10' 

[[email protected] ~]#date -s '2019-08-07 06:05:10'&& date '+%Y-%m-%d %H:%M:%S'
Wed Aug  7 06:05:10 CST 2019
2019-08-07 06:05:10

[[email protected] ~]#date +%s

1555444675
[[email protected] ~]#date [email protected] '+%Y-%m-%d %H:%M:%S'
2019-04-17 03:57:55
 


linux小练习1

 

1[[email protected] ~]#nano /etc/issue

\n
\t
\l

CentOS release 6.9 (Final)

Kernel \r on an \m

 

\l 是代表终端号

\n 是代表当前用户名

\d 是代表时间
[email protected] ~]#shutdown -h 18:30 'system will be halt,please ready'

Broadcast message from [email protected]
    (/dev/pts/1) at 16:04 

shutdown -c  取消关机