Solved Linux History: Not clearing between -
-
@EddieJennings said in Linux History: Not clearing between -:
https://eshlox.net/2017/08/01/bash-increase-command-history-size
You'll be decreasing the size instead
I don't know that the size is so much of an issue as the inability of deleting it. Having 200 lines is fine -
-
So - this is my confusion now:
root@TuDallasNC:~# echo "$HISTFILE" /root/.bash_history root@TuDallasNC:~# sudo vi /root/bash_history ~ ~ ~ ~
The listed history file is - well - blank. But obviously - it isn't as it's now 202 lines (default seems to be set to 1000)
Incidently - when I do execute the
history -c
it clears - but when i re-connect it is still there. -
@gjacobse wouldn't the . be part of the filename though? So it would be "sudo vi /root/.bash_history"
-
@jmoore said in Linux History: Not clearing between -:
@gjacobse wouldn't the . be part of the filename though? So it would be "sudo vi /root/.bash_history"
Quite true indeed - so I missed i there,.. but didn't here:
190 sudo nano ~/.bash.history
-
This has been helpful - I've managed to edit the file, and after making a backup, and editing it down to clear out the garbage.
-
You also could've run
history -d linenumber
to have removed things that were incorrect or frivolous. -
@gjacobse said in Linux History: Not clearing between -:
History is a great tool to have - But it has gotten a bit long on the Ubuntu system I have running.
A bit long would be like.... 100,000 lines?
-
@gjacobse said in Linux History: Not clearing between -:
This has been helpful - I've managed to edit the file, and after making a backup, and editing it down to clear out the garbage.
It's a history, clearing stuff out doesn't really make sense.
-
@DustinB3403 said in Linux History: Not clearing between -:
You also could've run
history -d linenumber
to have removed things that were incorrect or frivolous.Done that also - didn't do anymore than
history -c
did. -
@scottalanmiller said in Linux History: Not clearing between -:
@gjacobse said in Linux History: Not clearing between -:
This has been helpful - I've managed to edit the file, and after making a backup, and editing it down to clear out the garbage.
It's a history, clearing stuff out doesn't really make sense.
It does if he wants to document a process to getting something to work and only having valid commands visible.
If he had a typo or whatever else, leaving that in the history could cause issues later.
-
@scottalanmiller said in Linux History: Not clearing between -:
@gjacobse said in Linux History: Not clearing between -:
This has been helpful - I've managed to edit the file, and after making a backup, and editing it down to clear out the garbage.
It's a history, clearing stuff out doesn't really make sense.
And could possibly be seen as malicious intent.
-
@DustinB3403 said in Linux History: Not clearing between -:
@scottalanmiller said in Linux History: Not clearing between -:
@gjacobse said in Linux History: Not clearing between -:
This has been helpful - I've managed to edit the file, and after making a backup, and editing it down to clear out the garbage.
It's a history, clearing stuff out doesn't really make sense.
It does if he wants to document a process to getting something to work and only having valid commands visible.
If he had a typo or whatever else, leaving that in the history could cause issues later.
Still doesnt make sense, because if you know which line is incorrect, just dont copy that line. You still have to know which line is incorrect to delete
-
@DustinB3403 said in Linux History: Not clearing between -:
It does if he wants to document a process to getting something to work and only having valid commands visible.
History isn't documentation once it is edited.
-
@scottalanmiller said in Linux History: Not clearing between -:
@DustinB3403 said in Linux History: Not clearing between -:
It does if he wants to document a process to getting something to work and only having valid commands visible.
History isn't documentation
I fixed it for you
-
Also, what if an incorrect command screws something up? Then you lose your ability to check history for troubleshooting. You should never be deleting any history.
-
@IRJ said in Linux History: Not clearing between -:
Also, what if an incorrect command screws something up? Then you lose your ability to check history for troubleshooting. You should never be deleting any history.
I use zsh with autocomplete so I rely on history pretty heavily