马哥Linux培训课后作业(1)

2017-11-09|Categories: Magedu-training|

Table of Contents

Q1

  • 显示当前时间,格式:2016-06-18 10:20:30
  • 显示前天是星期几
  • 设置当前日期为2019-08-07 06:05:10

A1

date +"%F %T"
date -d '2 days ago' +%A
date 080706052019.10



Q2

  • 在本机字符终端登录时,除显示原有信息外,再显示当前登录终端号,主机名和当前时间

A2

vim /etc/issue

\S
Kernel \r on an \m
# add below lines
# for beauty, include blank lines

Current TTY is: \l
Current hostname is: \n
Current time is: \t



Q3

  • 今天20:50自动关机,并提示用户

A3

shutdown -P 20:50 "This server will be shut down at 20:50."



Leave A Comment