bash history log
Topic: bash history log
started by: Big_Pc_Man
Posted by Big_Pc_Man on Sep. 02 2008,16:37DSL 4.4.4 version. Is there a way to get bash to record command history in the .bash_history log for the root user? Maybe I'm just looking in the wrong place for the history log?
Posted by ^thehatsrule^ on Sep. 02 2008,17:12Did you check in /root ?
Posted by Big_Pc_Man on Sep. 02 2008,17:17yes. The history file contains only the text "exit".
Posted by ^thehatsrule^ on Sep. 02 2008,17:31Yea, you'd get that if you, for example, opened a terminal and just send "exit"
Posted by Big_Pc_Man on Sep. 02 2008,23:43OK, you did such a great job on the emelfm question maybe you can help explain how to get the bash history file to work.
Actually what I am trying to do is simply print the terminal screen to a file such that all commands and responses for an active session are captured in a file. There's probably a simple way to do this, I just don't know how.
Posted by ^thehatsrule^ on Sep. 03 2008,01:18Afaik the history buffer in bash is only appended to that "global" history file after the session is done.
There may be a config option somewhere to write at every command, or you could use another shell that does that by default (like busybox's ash iirc), but that won't really help you if you need to record the output as well. There may be some logging options available though.
Posted by mikshaw on Sep. 03 2008,02:40the 'script' application is made specifically to record everything that shows up on your screen.
script myscript.txt (Warning: Don't use the command "cat myscript.txt" after starting the script )
On a very old machine you will likely see a performance hit, mainly I think because it creates a subshell that is constantly recording everything happening in the original shell. Ctrl+D stops the recording and closes the subshell.
Posted by ^thehatsrule^ on Sep. 03 2008,02:47ah, that application slipped my mind. So yea, script should do what you want.