Centos基础命令-时间-日历-计算器

显示日期

代码语言:javascript
复制
[root@canxun~]# data
Mon Mar 15 18:08:42 CST 2021

上面显示的是 星期一 三月十五号 18:08分 42秒 在2021年的CST时区 还可以自定义输出

代码语言:javascript
复制
[root@canxun~]# data +%Y/%M/%D
2021/03/15
[root@canxun~]# data +%H:%M
18:23

显示日期

代码语言:javascript
复制
[root@canxun~]# cal
输出的本月日历

也可以显示整年
[root@canxun~]# cal 2021
输出的本年日历

基本上cal命令语法为
[root@canxun~]# cal [month] [year]

如果想知道20年3月份日历
[root@canxun~]# cal 3 2020

计算器

代码语言:javascript
复制
[root@canxun~]# bc
bc1.06.95

Copyr ight 1991-1994, 1997,1998,2000, 2004,2006 Free Software Foundat ion ,Inc.
This is f ree software with ABSOLUTELY NO WARRANTY For details type warranty.
_ 这里光标会提示让你输入
输入数字+运算符号即可
如 + - * / ^ % 加 减 乘 除 指数 余数

10/100 (这个应该是0.1啊)
0
quit (离开计算器 或者 Ctrl+c)

因为bc默认输出整数 所以要执行 scale=number命令
[root@canxun~]# bc
bc1.06.95
Copyr ight 1991-1994, 1997 ,1998, 2000, 2004,2006 Free Software Foundat ion ,Inc. This is f ree software with ABSOLUTELY NO WARRANTY For details type warranty.
scale=3 (就是这里)
1/3
.333