Create sudo user with bash and homedir: useradd -m -d /home/testuser/ -s /bin/bash -G sudo testuser ######################################################### FILES Truncate file truncate -s 0 /var/log/syslog Find folders and set access for them: sudo find . -type d -exec chmod 755 {} + Get/Delete files by mask: Check: find . -name "*.bak" -type f Delete: find . -name "*.bak" -type f -delete Remove *.gz files older than 1 day find ./path_to_find -name "*.gz" -type f -mtime +1 -exec rm {} \; Remove files by mask find ./path_to_find -name "*.spec.ts" -type f -delete ######################################################## DISK Disk Info: sudo aprted -l sudo df -h sudo df -h --output=source,fstype,size,used,avail,pcent,target -x tmpfs -x devtmpfs Show largest directorries in current path: sudo du --max-depth=1 2> /dev/null | sort -n -r | head -n20 SSH keys ssh-keygen -t rsa ~/.ssh/authorized_keys ######################################################## NETWORK Show LISTEN ports netstat -ntlp | grep LISTEN #Show ports2 sudo iptables -t nat -L -n ######################################################## DOCKER #Show all docker containers internal IP #For common docker docker inspect -f '{{.Name}} - {{.NetworkSettings.IPAddress }}' $(docker ps -aq) #For docker-compose usage docker inspect -f '{{.Name}} - {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $(docker ps -aq) ######################################################## DATABASE DB. Import big file by console psql --host=127.0.0.1 --port=5432 --dbname=mycity --username=mycity --password -f /path_dump/dump.sql