history是fc -l的别名,展示一下
1 $ history # Same as fc –l
1 ls
2 vi file1\
3 df
4 ps –eaf
5 history
6 more /etc/passwd
7 cd
8 echo $USER
9 set
10 history
2 $ history –n # 无行号
ls
vi file1
df
ps –eaf
history
more /etc/passwd
cd
echo $USER
set
history
history –n
3 $ history 8 # 列出第8个记录开始的历史记录
8 echo $USER
9 set
10 history
11 history –n
12 history 8
4 $ history –3 # 列出倒数前三个
10 history
11 history –n
12 history 8
13 history –3
5 $ history –1 –5 # 列出最后5个,最后第一个先列出,
13 history –3
12 history 8
11 history –n
10 history
9 set
6 $ history –5 –1 # 列出最后5个,先列最后第5个,最后列出最后第1个
10 history
11 history -n
12 history 8
13 history -3
14 history –1 –5
7 $ history
78 date
79 ls
80 who
81 echo hi
82 history
8 $ history ls echo # 展示最近一个ls到最近echo的命令
79 ls
80 who
81 echo hi
9 $ history –r ls echo #展示最近一个ls到最近echo的命令,命令倒置
81 echo hi
80 who
79 ls
10 $ r date # 执行最后一次date命令
date
Thu Jan 5 14:54:11 BEIST 2006
|
|
|