Tool or Utility to log commands history

ikoula

Member
Registered
Joined
Jun 10, 2016
Messages
17
Points
3
Hello, i never need to record commands history but if i was meant to do so i think i will not search for an application. I would just export the user commands history to a text file. To be more handy i would create a script in a cron or a windows task.
 

VirtuBox

Well-known member
Registered
Joined
May 3, 2016
Messages
1,622
Points
83
Hi Guys,

which tool you guys use to create a log the commands history in date format so others know what commands have been used
No need to use a tool, you just have to create a folder .history in your home directory and to add the following line in the file .profile (also in your home directory).
Bash:
PROMPT_COMMAND='echo "$(date "+%Y-%m-%d.%H:%M:%S") $(pwd) $(history 1)" >> ~/.history/bash-$(date "+%y-%m").log'
Next time you will login on the server, command history will be saved in .bash_history folder
 
Last edited:

Sponsors

Tag Cloud

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top