命令别名与历史命令

20.11.16

命令别名配置

alias lm='ls -al | more':配置命令别名

alias:显示所有的别名

unalias lm:删除lm 别名


历史命令

history [n]
history [-c]
history [-raw] histfiles

选项与参数:
n :数字,意思是『要列出最近的 n 笔命令行表』的意思!
-c :将目前的 shell 中的所有 history 内容全部消除
-a :将目前新增的 history 命令新增入 histfiles 中,若没有加 histfiles ,
则默认写入 ~/.bash_history
-r :将 histfiles 的内容读到目前这个 shell 的 history 记忆中;
-w :将目前的 history 记忆内容写入 histfiles 中!

!number
!command
!!

选项与参数:
number :运行第几笔命令的意思;
command :由最近的命令向前搜寻『命令串开头为 command』的那个命令,并运行;
!! :就是运行上一个命令(相当于按↑按键后,按 Enter)

posted @ 2020-11-26 19:36  榕霖  阅读(130)  评论(0编辑  收藏  举报