Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I am a student running an experiment remotely on a linux machine. In the event of a problem I need to check what commands I may have sent to the computer (may be weeks in the past) which coincided with the time of the problem.
As well as a record of the commands I sent I also need to record the exact date/time each command was sent and the user that sent the command.
Does any one know of a good way of setting up such a monitoring system?
You can control the behaviour of command history by means of some environment variables. For example HISTTIMEFORMAT - if set and not null determine the format of timestamp associated to an entry in the history (this is what you are looking for) HISTFILE - is the name of the file in which command history is saved ($HOME/.bash_history by default) HISTSIZE - is the max number of entries to store in the history, and so on...
Since you are looking for recording over a long period you may consider to backup the history file on a regular basis. Anyway it is a common practice to empty the history file every time you log out from a remote machine (for security reasons). In this case you may consider to automatically backup the history file every time you logout (e.g. append the current content of .bash_history to a file).
Edit: you can find all information related to history by issuing "info history".
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.