Wednesday, June 16th, 2010 at
A lot of people are probably not aware of the command
script. Script is a quick and easy way to record everything you do in a terminal session. I use script to record sessions of me fixing a server, or troubleshooting Linux issues, and save it for future needs, or to pass on to others as training material. Here is what the Linux man page says:
Script makes a typescript of everything printed on your terminal. It is useful for students who need a hardcopy record of an interactive session as proof of an assignment, as the typescript file can be printed out later with lpr(1).
Using script to record your terminal session
It’s really quite simple to record your bash session. All you need to do is type
script -a filename to start recording your session:
laptop:~ foogazi# script -a session1_jun162010
Script started, output file is session1_jun162010
Now that the recording has started, everything you type, as well as everything that returns as output, will be saved into the filename you chose to output to.
Popularity: 16% [?]
Wednesday, June 25th, 2008 at
If you want to delete your bash history, there are a few options you have. First you must understand that the history of your bash session is stored into RAM and then written to ~/.bash_history when you log out of the bash session. So even if you delete the ~/.bash_history file, your current bash session will still be written to history once you log out.
Delete bash history
To delete the bash history for your current session as well as old sessions, you should do two things:
Delete the .bash_history file:
# rm -rf ~/.bash_history
Clear the current history stored in RAM:
# history -c
Stop writing to .bash_history for good
If you don’t want to log any history for good, you can do one of two things; turn it off for all users, or turn off logging history for a single user.
Turn off bash history for all users:
Append “unset HISTFILE” to /etc/profile:
# echo "unset HISTFILE" >> /etc/profile
Turn off bash history for a specific user:
Append “unset HISTFILE” to /home/USER/.bash_profile:
# echo "unset HISTFILE" >> /home/USER/.bash_profile
That’s it! Now you have successfully deleted the bash history and stopped logging to bash history.
Popularity: 34% [?]