目录
command >> file 将输出以追加的方式重定向到file
command > file 将输出重定向到file (覆盖)
Shell日期
获取当前日期时间
[root@master shelldemo]# date
格式化当前日期时间
[root@master shelldemo]# date -d today +"%Y-%m-%d %H:%M:%S"
加减日期时间
显示年月日时间
[root@master shelldemo]# date +%Y年%m月%d日%H:%M:%S
显示明天的日期时间
[root@master shelldemo]# date +%Y年%m月%d日%H:%M:%S --date="+1 day"
显示昨天的日期时间
[root@master shelldemo]# date +%Y年%m月%d日%H:%M:%S --date="-1 day"
显示上一个月日期时间
[root@master shelldemo]# date +%Y年%m月%d日%H:%M:%S --date="-1 month"
显示下一个月日期时间
[root@master shelldemo]# date +%Y年%m月%d日%H:%M:%S --date="+1 month"