Home > OS >  Linux system to join the IP address of the IP address of the print history same, how to deal with?
Linux system to join the IP address of the IP address of the print history same, how to deal with?

Time:01-17

Insert the IP address through https://blog.csdn.net/u013430110/article/details/112554474 the way to the history command print format, found that the IP address of the print is the same, by to different network remote connection system, but the history printed results of IP address all the current network IP address , what method can be [IP address], like [datetime], written to ~/. Bash_history file???

About the IP address format in the configuration file is/etc/profile configuration content:
 
# Improve the history content format
USER_IP=` -u who am i. 2 & gt;/dev/null | awk '{print $NF}' | sed -e 's/[()]//g' `
If [" $USER_IP "=" "]. Then
USER_IP=` hostname `
Fi
Export HISTTIMEFORMAT="% F % T ${USER_IP}"


Can be seen from the screenshot below, including the date of the % F % T time, save in the form of a timestamp in ~/. Bash_history historical records in the file, but not the IP address, so I would like to how to make the IP address and save to this file, so that history can print different network to connect to the system in the execution of orders:
  • Related