Tool or Utility to log commands history

Joined
Jun 10, 2016
Messages
17
Best answers
0
Ratings
2
Points
3
#2
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

Global Mod
Staff Member
Joined
May 3, 2016
Messages
1,605
Best answers
4
Ratings
448 13
Points
83
#3
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:
Latest Threads
Replies
0
Views
15
Replies
1
Views
28
Replies
4
Views
76
Recommended Threads
Replies
5
Views
6,998
Replies
0
Views
1,278
Replies
3
Views
722

Latest Hosting OffersNew Reviews

Sponsors

Latest Blog ArticlesMost Viewed Threads

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