Find the files that is older than 30 days:
find . -atime +30 -exec stat -c “%n %y” {} \;
Delete the files that is older than 30 days:
find . -atime +30 -print0 | xargs -0 -r rm
Reference: https://stackoverflow.com/a/21451441/126639
Find the files that is older than 30 days:
find . -atime +30 -exec stat -c “%n %y” {} \;
Delete the files that is older than 30 days:
find . -atime +30 -print0 | xargs -0 -r rm
Reference: https://stackoverflow.com/a/21451441/126639
crontab -e
Add the below line to the top.
MAILTO=””
chage -M number-of-days username
wget -t 1 –timeout=900 xxxxx
Reference:
https://stackoverflow.com/questions/2291524/does-wget-timeout
:set encoding=utf-8
Show user list
cat /etc/passwd
Show user’s group
id USER_NAME
Add user
adduser USER_NAME
Add group
groupadd GROUP_NAME
Assign user to a primary group (Require re-login to apply the new group)
usermod -g GROUP_NAME USER_NAME
Assign user to a secondary group
usermod -a -G GROUP_NAME USER_NAME
Turn on setgid bit (all new files and subdirectories created within the current directory inherit the group ID of the directory, rather than the primary group ID of the user who created the file)
chmod g+s .
Turn off setgid bit
chmod g-s .
Check if setgid is on
ls .
(If it is on, the group permission will become rws instead of rwx)
Lock an account
usermod –lock –expiredate 1970-01-02 username
Check lock status
sudo passwd -S username
Problem:
imuxsock begins to drop messages from pid due to rate-limiting
Solution:
vim /etc/rsyslog.conf
$SystemLogRateLimitInterval 60
$SystemLogRateLimitBurst 3000
/etc/init.d/rsyslog restart
Reference:
http://navyaijm.blog.51cto.com/4647068/1212042
http://www.rsyslog.com/tag/rate-limiting/
echo ‘export HISTTIMEFORMAT=”%d/%m/%y %T “‘ >> ~/.bashrc
source ~/.bashrc
Problem:
perl: warning: Setting locale failed.
Solution:
export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_TYPE=en_US.UTF-8