cat /etc/profile
mkdir -p /var/log/user-records
TIMESTAMP=$(date +%Y%m%d-%H:%M:%S)
script -t -f -q 2>/var/log/user-records/${USER}-${UID}-${TIMESTAMP}.time -a /var/log/user-records/${USER}-${UID}-${TIMESTAMP}.history
if [ "$SHLVL" = 1 ]; then
exit
fi
linux操作自动记录脚本
![](https://img-home.csdnimg.cn/images/20240711042549.png)