In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you how to hide bash history commands in Linux, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
Some methods of sorting out are for your reference only:
Exit normally-history records are written normally
Running on the kill- server-the kill bash process ID will no longer record the history. I checked to see if I needed to add the-9 parameter, but no, I just needed a basic kill command to kill the process and prevent it from writing to the file.
Kill-client runs-kill ssh process ID, even if the-9 parameter is added, there will still be a history.
Set + o history- does not write any current sessions to the log. You can run at any time during the session and hide all commands.
Set-o history- restarts logging, but records set commands, so some significant changes occur.
Unset HISTFILE-clears the variable that records the location of the history file so that nothing is stored
History-c-completely erase history. The effect of this command is very obvious because all the historical commands are gone.
Export HISTIGNORE= "ls*:cat*"-this command does not record the colon delimited command in quotation marks. This command can use shell mode, which is somewhat similar to regular, but not the same
Export HISTFILESIZE=10- sets the number of history to 10. If you have completed the operation you want to hide, but want to keep other commands, recalculate, set the number of records to less than the total and continue to execute. In this way, all previous commands will be invisible and look suspicious, but because there is still something in the history, people may not notice it.
Editing the.bash_history file- if you edit this file during a session, the edits will appear before the session commands, so you can actually add some commands to history that you haven't actually run, so it's a good idea.
Using multiple sessions- bash history is written only when a session is terminated. Then we can use two sessions, the first session termination will be written to the history, and then the contents of the second session will not be written to the history until the first session terminates.
Putting a space before a command (a space before the command)-depending on the configuration, add a space before the command and it will not be recorded. This feature is useless if you've already entered commands you don't want to record, but it's good to use this if you want several irrelevant commands to look like one. Please test it before using it, because the situation will vary depending on the distribution and user configuration.
History-r-this command rereads the history file and resets the history to the state you logged in. This command seems to be very useful, especially if you can edit the history file, add the command, and then turn off shell. This will write your modified history without leaving any trace.
The above commands, as if "set + o history" is the best and most general method, because it hides all commands in the current session, but retains the previous commands.
However, depending on the scenario, other commands are also very effective.
Be sure to test it yourself before you use these commands. When you are logged into a system and realize that you need to hide certain commands, don't panic. History will only write at the end of the session, so as long as the session is not over, you can stop and think about how to hide the commands.
The above is all the contents of this article entitled "how to hide bash History 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.