1.date
显示日期
> appledeMacBook-Air:~ apple$ date
> 2018年 8月 7日 星期二 18时44分15秒 CST
> appledeMacBook-Air:~ apple$
2.who
& whoami
检查所有用户 & 自己 账户信息
appledeMacBook-Air:~ apple$ who
apple console Aug 6 19:20
apple ttys000 Aug 7 18:41
appledeMacBook-Air:~ apple$ whoami
apple
appledeMacBook-Air:~ apple$
3.last
& last apple(username)
检查所有用户 & 自己 登陆信息
appledeMacBook-Air:~ apple$ last
apple ttys000 Tue Aug 7 18:50 still logged in
apple ttys000 Tue Aug 7 18:41 - 18:50 (00:08)
apple ttys000 Tue Aug 7 18:30 - 18:41 (00:11)
apple ttys000 Mon Aug 6 19:21 - 19:33 (00:11)
apple ttys000 Mon Aug 6 19:20 - 19:21 (00:01)
apple console Mon Aug 6 19:20 still logged in
reboot ~ Mon Aug 6 19:19
shutdown ~ Mon Aug 6 19:19
appledeMacBook-Air:~ apple$ last apple
apple ttys000 Tue Aug 7 18:50 still logged in
apple ttys000 Tue Aug 7 18:41 - 18:50 (00:08)
apple ttys000 Tue Aug 7 18:30 - 18:41 (00:11)
apple ttys000 Mon Aug 6 19:21 - 19:33 (00:11)
apple ttys000 Mon Aug 6 19:20 - 19:21 (00:01)
4.su
& sudo
登陆超级用户 & 以超级用户身份执行操作(不登陆)
appledeMacBook-Air:~ apple$ sudo
usage: sudo -h | -K | -k | -L | -V
usage: sudo -v [-AknS] [-g groupname|#gid] [-p prompt] [-u user name|#uid]
usage: sudo -l[l] [-AknS] [-g groupname|#gid] [-p prompt] [-U user name] [-u
user name|#uid] [-g groupname|#gid] [command]
usage: sudo [-AbEHknPS] [-C fd] [-g groupname|#gid] [-p prompt] [-u user
name|#uid] [-g groupname|#gid] [VAR=value] [-i|-s] [<command>]
usage: sudo -e [-AknS] [-C fd] [-g groupname|#gid] [-p prompt] [-u user
name|#uid] file ...
4.less
显示文件 & open
打开文件 & cat
输出文件
5.文本输入时
control H
删除字符
control W
删除单词
control U/X
删除本行
6.输出源源不断滚出时
control Q
暂停
control S
继续
7.control D
结束终端工作
appledeMacBook-Air:~ apple$ logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
[进程已完成]
8.set -o ignoreeof
禁用control D 结束终端工作
appledeMacBook-Air:~ apple$ set -o ignoreeof
appledeMacBook-Air:~ apple$ Use "logout" to leave the shell.
appledeMacBook-Air:~ apple$
8.set +o ignoreeof
开启control D 结束终端工作
appledeMacBook-Air:~ apple$ set +o ignoreeof
appledeMacBook-Air:~ apple$ logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
[进程已完成]
9.set -o
开启关闭情况
appledeMacBook-Air:~ apple$ set -o
allexport off
braceexpand on
emacs on
errexit off
errtrace off
functrace off
hashall on
histexpand on
history on
ignoreeof off
10.重要键盘信号一览表
11.stty(set terminal) -a
显示所有的设置
appledeMacBook-Air:~ apple$ stty -a
speed 9600 baud; 24 rows; 80 columns;
lflags: icanon isig iexten echo echoe -echok echoke -echonl echoctl
-echoprt -altwerase -noflsh -tostop -flusho pendin -nokerninfo
-extproc
iflags: -istrip icrnl -inlcr -igncr ixon -ixoff ixany imaxbel iutf8
-ignbrk brkint -inpck -ignpar -parmrk
oflags: opost onlcr -oxtabs -onocr -onlret
cflags: cread cs8 -parenb -parodd hupcl -clocal -cstopb -crtscts -dsrflow
-dtrflow -mdmbuf
cchars: discard = ^O; dsusp = ^Y; eof = ^D; eol = <undef>;
eol2 = <undef>; erase = ^?; intr = ^C; kill = ^U; lnext = ^V;
min = 1; quit = ^\; reprint = ^R; start = ^Q; status = ^T;
stop = ^S; susp = ^Z; time = 0; werase = ^W;
appledeMacBook-Air:~ apple$
12.up
查看上个命令 & down
查看下个命令
13.control M
回车符 & control J
新行符
14.echo $TERM
显示终端类型
appledeMacBook-Air:~ apple$ echo $TERM
xterm-256color
appledeMacBook-Air:~ apple$