Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of Bash Command History in linux

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you the history of Bash commands in linux example analysis, I believe that most people do not know much about it, so share this article for your reference, I hope you will learn a lot after reading this article, let's go to understand it!

Command history

Bash has the function of automatically recording the history of commands, and commands executed by users will be automatically recorded in a hidden file such as. Bash_history in their home directory when logging out. There are many ways to view the history of these commands, including by opening the file directly, flipping the history up or down through the up and down keys of the keyboard, and viewing the history through the history command, all of which have record numbers. The amount of information that can be recorded in the command history is determined by the HISTSIZE variable. CentOS 6.3 defines HISTSIZE=1000 by default through the / etc/profile file, that is, it can record up to 1000 commands that have been used recently. When the 1001 command is executed, the * command will be overwritten. Executing the history-c command can clear all history records.

Those who record the history of the command can not only view the history, but also directly call the history to execute the command again when needed:

1)。 The arrow keys flip through the history command, find the appropriate command and then enter directly to execute it.

2)。 Enter! string invokes command history (string is the keyword). For example,! vim will call * * commands that begin with vim. Or through! n to accurately locate the history, for example! 242 will directly call the command history of the 242 record and execution.

3)。 Open the search function through the Ctrl+r shortcut key, and then enter the keyword to search for relevant commands in the command history, and enter to complete the operation. If no suitable command is found, press ESC to exit the search.

The above is all the content of the article "sample Analysis of the History of Bash commands in linux". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report