In addition to Weibo, there is also WeChat
Please pay attention

WeChat public account
Shulou
2025-11-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how to view history commands in linux. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
The linux View History command can use the history command, which lists all commands that have been typed. All commands typed by the user are recorded in a file, which is saved in the home directory of the currently logged-in user.
This article operating environment: centos 7 system, thinkpad T480 computer.
In the Linux environment, you can view recently typed commands by pressing the arrow keys up and down. But this method can only be viewed one by one, in fact, the system provides a way to view all the historical commands.
Enter the following command in the terminal to view all commands:
[root@template ~] # history 1 ifconfig 2 vim / etc/ssh/sshd_config 3 / etc/init.d/sshd restart 4 vim / boot/grub/grub.conf 5 vim / etc/selinux/config 6 vim / etc/sysconfig/network-scripts/ifcfg-eth0 7 rm-rf / etc/udev/rules.d/70-persistent-net.rules 8 useradd vsroot 9 echo-e'vsroot\ tALL= (ALL)\ tNOPASSWD: ALL' > > / etc/sudoers 10 yum clean all 11 rm-rf / var/log/yum.log 12 rm-rf / var/lib/yum/* 13 rm-rf / root/install.log 14 rm-rf / root/install.log.syslog 15 rm-rf / var/log/anaconda.*
The history command lists all commands that have been typed, and commands typed by the user are recorded in a file that is saved in the home directory of the currently logged-in user.
The file name is: .bash_history, which is a hidden file.
Cleanup of historical operation commands:
If you do something bad on the server, you can clear it with the "history-c" command, so that others cannot view the historical operation commands when they log in to the terminal.
However, this command does not clear the records saved in the file, so you need to manually delete the records in the .bash _ profile file.
This is the end of this article on "how to View linux History Command". I hope the above content can be helpful to you, so that you can learn more knowledge. if you think the article is good, please share it out for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope





About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.