linux查看历史命令的方法有:
[root@node1 ~]# history 1 2019-12-09 10:58:12 root whoami 2 2019-12-09 10:58:35 root uname -a 3 2019-12-09 10:58:48 root cat /proc/version 4 2019-12-09 10:59:04 root cat /etc/redhat-release 5 2019-12-09 10:59:13 root cat /etc/issue 6 2019-12-09 10:59:38 root pwd .......... 430 2021-04-24 21:39:57 root ls -l /etc/profile.d 431 2021-04-24 21:45:11 root cat ~/.bash_profile 432 2021-04-24 21:48:17 root cat .bashrc 433 2021-04-24 21:51:47 root printenv BASH_ENV 434 2021-05-07 16:52:59 root history
3.Ctrl+ p与 Ctrl +n与上\下方向键的作用一样
4.使用Ctrl+ r搜索历史命令:输入一个或多个字符,系统会找到最近一个包含该字符的命令;找到想要的命令后,可以按回车执行这条命令,还可以按上下键查找该命令前后的命令;按左右键移动光标并修改这条命令。建议使用该快捷键搜索时,一般输入特殊的字符进行查找。
[root@node1 ~]# history 1 2019-12-09 10:58:12 root whoami 2 2019-12-09 10:58:35 root uname -a 3 2019-12-09 10:58:48 root cat /proc/version 4 2019-12-09 10:59:04 root cat /etc/redhat-release 5 2019-12-09 10:59:13 root cat /etc/issue 6 2019-12-09 10:59:38 root pwd ........... 430 2021-04-24 21:39:57 root ls -l /etc/profile.d 431 2021-04-24 21:45:11 root cat ~/.bash_profile 432 2021-04-24 21:48:17 root cat .bashrc 433 2021-04-24 21:51:47 root 434 2021-05-07 16:52:59 root history (reverse-i-search)`cat': cat .bashrc
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/205357.html原文链接:https://javaforall.net
