How to del?
How to delete logs & history of bash? |
|
Step 1 to learn how to do things on linux:
Learn how to google. http://askubuntu.com/questions/191999/ho...completely
Bash stores commands in memory so you can adjust how it writes to the history file depending on how you like. It could be after each command or upon exit which is the default.
It is stored into ~/.bash_history so you just need to remove that file. But by default it will create a new one and dump that session into it. If you want it to be stuck and not write anything to that file or keep any history you can try to create the file and set special flags on it which makes it immune to any changes, even by root. PHP Code I hope I've helped. (Feb 24, 2017 08:51 PM)SuckySucky Wrote: Bash stores commands in memory so you can adjust how it writes to the history file depending on how you like. It could be after each command or upon exit which is the default.Helped clear but its still there if a forensics test is run. Btw did not perm keep it clear. https://cdn.pbrd.co/images/Crz51mrDm.png
Feb 24, 2017 09:01 PM
(This post was last modified: Feb 24, 2017 09:04 PM by SuckySucky.)
(Feb 24, 2017 08:58 PM)Techmech Wrote: Helped clear but its still there if a forensics test is run. Run a few test commands; Then close Bash and open it up again.. Then run this command: PHP Code And see if it is empty or not. I kinda think that what "history" shows you is the history that is in memory but not what has been actually written. I also just mentioned a very dirty way to disable it as there are better ways most likely. You can permanently disable it this way: PHP Code
Feb 24, 2017 10:06 PM
(This post was last modified: Feb 24, 2017 10:11 PM by SuckySucky.)
(Feb 24, 2017 09:47 PM)captainspalding Wrote: "One annoying side-effect is that the history entries has a copy in the memory and it will flush back to the file when you log out." Not if you disable the history all together as I mentioned at the bottom of my post. That way there is no history to be found at all as you've told bash to disable it. ![]() And example of what happens if you run rm ~/.bash_history && set +o history && history -c (Feb 24, 2017 10:06 PM)SuckySucky Wrote: Not if you disable the history all together as I mentioned at the bottom of my post. That way there is no history to be found at all as you've told bash to disable it.You can disable it completely, but you're probably going to want to see the previously run command etc. for a short period of time. I run a cron job to delete my bash history, but I back it up to my server with tar and rsync.
XMPP: pm me
Mar 4, 2017 01:48 PM
(This post was last modified: Mar 4, 2017 01:49 PM by Jаson.)
unset HISTFILE when you login, and it won't be saved
or history -c to delete what you've previously typed or nano ~/.bash_history and CTRL-K every line ![]() |
|
|
| Possibly Related Threads... | |||
| Thread / Author | Replies | Views | Last Post |
| by Tex.Apr 21, 2016 02:25 PM | 3 | 95 |
Apr 21, 2016 02:25 PM Last Post: FreakyFreak |
| by raxeJul 20, 2012 05:31 AM | 2 | 79 |
Jul 20, 2012 05:31 AM Last Post: raxe |
| by Anonymous.7654Jul 23, 2011 11:57 AM | 5 | 346 |
Jul 23, 2011 11:57 AM Last Post: Amzo |