In Linux, the IP logon record and Operation record are Python code www.2cto. comPS1 & quot; 'whoam' @ 'hostname': & quot; & amp; #39; [$ PWD] & amp; #39; historyUSER_IP 'who-uami2 & gt; /dev/null | awk & amp; #39; {print $ NF} & amp
IP address logon records and Operation records in Linux: Python code www.2cto.com PS1 = "'whoam' @ 'hostname ': "'[$ PWD] 'History USER_IP = 'who-u am I 2>/dev/null | awk' {print $ NF}' | sed-e's /[( )] // g'' if ["$ USER_IP" = ""] then USER_IP = 'hostname' fi if [! -D/tmp/history] then mkdir/tmp/history chmod 777/tmp/history fi if [! -D/tmp/history/$ {LOGNAME}] then mkdir/tmp/history/$ {LOGNAME} chmod 300/tmp/history/$ {LOGNAME} fi export HISTSIZE = 4096 DT = 'date + "% Y % m % d _ % H % M % S" 'export HISTFILE = "/tmp/history/$ {LOGNAME}/$ {USER_IP} history. $ DT "chmod 600/tmp/history/$ {LOGNAME}/* history * 2>/dev/null
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service