We have more than one admin, and sometimes need to know from which pts the command was issued.
Now the history looks like:
998 2016-08-25 10:16:41 ls /usr/local/apache/htdocs/
Is there any way to add the pts number to each line so then the user can be checked via last
?
Current bashrc (in part related to history)
# append to the history file, don't overwrite it
shopt -s histappend
# Don't save trivial one and two character commands on the history list
export HISTIGNORE="?:??:exit"
export HISTTIMEFORMAT="%h %d %T "
export HISTCONTROL="ignoredups"
export HISTFILESIZE=20000
export HISTSIZE=20000
PROMPT_COMMAND='history -a'
Best Answer
You can modify the
export HISTTIMEFORMAT="%h %d %T "
and add the information of the filename of the terminal through thetty
command, like