commands
# find
find /data -size +1G -size -2G
# directory disk usage
du -sh /data
# list the sizes of all files int /data
du -h /data --max-depth=1
# list top 10 directories
du -h --max-depth=1 /data | sort -rh | head -n 10
# change directory permissions
chmod -R 777 /data
# change owner
chown -R dev:dev /data
# port usage
netstat -anp | grep 80
system
# time
date -R
# runtime
uptime -p
# CPU
lscpu
# version
lsb_release -a
cat /etc/redhat-release
cat /proc/version
uname -a
scheduled tasks
# list
crontab -l
# edit
crontab -e
user
who
# online
users
# create
useradd dev
# change password
passwd dev
# change sudoers
vi /etc/sudoers
dev ALL=(ALL)ALL
firewall
# state
firewall-cmd --state
# port list
firewall-cmd --list-all
# open port
firewall-cmd --zone=public --add-port=10080/tcp --permanent
# open ports
firewall-cmd --zone=public --add-port=10080-10180/tcp --permanent
# remove port
firewall-cmd --zone=public --remove-port=10080/tcp --permanent
# load config
firewall-cmd --reload
log
# system
cat /var/log/message
# start
dmesg | grep -Ei 'error|Fail'
# fail
grep -Ei 'error|Fail' /var/log/messages
history
# history
history
# clean
history -c
shudown/reboot
# shutdown now
shutdown -h now
# shutdown 10 minutes
shutdown -h 10
# reboot
reboot
compress/decompress
# compress dist to dist.tar.gz(exclude directory attachment)
tar -zcvf dist.tar.gz --exclude=dist/attachment dist
# decompress
tar -zxvf data.tar.gz
# encrypt compress
tar -zcvf - dist | openssl enc -aes-256-cbc -md sha512 -pbkdf2 -iter 1000000 -salt -k password -out dist.tar.gz
# encrypt decompress
openssl enc -aes-256-cbc -md sha512 -pbkdf2 -iter 1000000 -d -k password -salt -in dist.tar.gz | tar xzvf -
# compress all jar
tar -zcvf 2022-07-11.tar.gz ./**/*.jar
# view
tar -tvf 2022-07-11.tar.gz