Let the linux history command display the command execution time, on which machine the command is executed, linuxhistory
1. Add the following parts at the end of/etc/profile:
USER_IP = 'Who-u am I 2>/dev/null | awk '{print $ NF}' | sed-e's/[()] // g'' export HISTTIMEFORMAT = "[% F % T] ['whoam'] [$ {USER_IP}]"
2. source/etc/profile
3. Whatever command you want to execute,
4. execute history to check the effect: 311 [14:39:20] [root] [192.168.80.1] history 312 [14:39:43] [root] [192.168.80.1] df-h 313 [14:39:45] [root] [192.168.80.1] df-g 314 [14:39:47] [root] [192.168.80.1] history 315 [14:40:01] [root] [192.168.80.1] ifconfig 316 [14:44:53] [root] [192.168.80.1] init 6 317 [] 14:46:56] [root] [192.168.80.1] sdfsdfsd 318 [14:46:58] [root] [192.168.80.1] ls 319 [14:47:02] [root] [192.168.80.1] hostory 320 [14:47:04] [root] [192.168.80.1] history 321 [14:48:35] [root] [192.168.80.1] cat/etc/profile 322 [14:54:32] [root] [192.168.80.1] history
Note: The effects of history can be viewed only after the commands 1 and 2 are executed. If you want to view the history of a month ago, and haven't executed 1 and 2 at that time, you can't see the desired effect.