1.which
哪里的程序会执行
appledeMacBook-Air:~ apple$ which date
/bin/date
appledeMacBook-Air:~ apple$ which date less vi emacs
/bin/date
/usr/bin/less
/usr/bin/vi
/usr/bin/emacs
appledeMacBook-Air:~ apple$
2.type
which的备用指令
appledeMacBook-Air:bin apple$ type date
date is /bin/date
appledeMacBook-Air:bin apple$ type date less vi emacs
date is /bin/date
less is /usr/bin/less
vi is /usr/bin/vi
emacs is /usr/bin/emacs
appledeMacBook-Air:bin apple$
3.date -u
格林尼治标准时间
appledeMacBook-Air:bin apple$ date
2018年 8月 8日 星期三 19时13分55秒 CST
appledeMacBook-Air:bin apple$ date -u
2018年 8月 8日 星期三 11时14分16秒 UTC
appledeMacBook-Air:bin apple$
4.cal
日历
cal [-j][month][year]: 第几天选项、月份选项、年份选项
appledeMacBook-Air:bin apple$ cal
八月 2018
日 一 二 三 四 五 六
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
appledeMacBook-Air:bin apple$
5.查看系统信息
uptime : 开机时间
hostname : 计算机名称
uname : 操作系统名称
uname -a : 操作系统详细信息
appledeMacBook-Air:bin apple$ uptime
19:24 up 2 days, 5 mins, 2 users, load averages: 1.01 1.11 1.11
appledeMacBook-Air:bin apple$ hostname
appledeMacBook-Air.local
appledeMacBook-Air:bin apple$ uname
Darwin
appledeMacBook-Air:bin apple$ uname -a
Darwin appledeMacBook-Air.local 15.6.0 Darwin Kernel Version 15.6.0: Tue Jan 9 20:12:05 PST 2018; root:xnu-3248.73.5~1/RELEASE_X86_64 x86_64
appledeMacBook-Air:bin apple$
6.查看用户信息
whoami : 用户名称
quota : 可以使用的内存空间
users : 所有用户标识
who : 所有用户详细信息
w : 所有用户在做什么
appledeMacBook-Air:bin apple$ whoami
apple
appledeMacBook-Air:bin apple$ quota
Disk quotas for user apple (uid 501): none
appledeMacBook-Air:bin apple$ users
apple
appledeMacBook-Air:bin apple$ who
apple console Aug 6 19:20
apple ttys000 Aug 8 19:07
appledeMacBook-Air:bin apple$ w
19:29 up 2 days, 9 mins, 2 users, load averages: 1.45 1.36 1.22
USER TTY FROM LOGIN@ IDLE WHAT
apple console - 一19 2days -
apple s000 - 19:07 - w
appledeMacBook-Air:bin apple$
7.leave
设置闹钟
appledeMacBook-Air:~ apple$ leave
When do you have to leave? 112
Alarm set for 2018年 8月 9日 星期四 01时12分00秒 CST. (pid 1473)
appledeMacBook-Air:~ apple$ leave +20
Alarm set for 2018年 8月 8日 星期三 20时01分24秒 CST. (pid 1475)
appledeMacBook-Air:~ apple$
8.bc -l
启用科学计算器
appledeMacBook-Air:~ apple$ bc -l
bc 1.06
Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
12 + 24
36
10 + 10;12+12
20
24
2^3
8
sqrt(16)
4.00000000000000000000
设置小数位
sqrt(16)
4.00000000000000000000
scale
20
scale=3
3/2
1.500
使用变量
x=10
x
10
x+12
22
设置进制
obase
10
ibase
10
obase=2;ibase=16
AB
10101011