sudo du -h --max-depth=1 -a
sudo du -h --max-depth=1 -a | sort -rh | head -n 10
sudo du -sh * | sort -rh ## faster (no hidden files)
sudo du -sh * | sort -rh | head -n 10
sudo find /var/lib/docker/containers/ -type f -name "*.log" -exec du -h {} + | sort -hr | head -n 10
# delete all log files of docker containers
sudo find /var/lib/docker/containers/ -type f -name "*.log" -exec truncate -s 0 {} \;
sudo du -sh /var/lib/docker/containers/* | sort -rh | head -n 10
sudo du -sh /var/lib/docker/overlay2/* | sort -rh | head -n 10
sudo du -sh /var/lib/docker/volumes/* | sort -rh | head -n 10
tar -czvf archive.tar.gz /path/to/directory
tar -xvzf archive.tar.gz -C /path/to/extract
zip -r archive.zip /path/to/directory
unzip archive.zip -d /path/to/extract
nohup command > output.log &
nohup python3 script.py > python_output.log &
nohup node app.js > node_output.log &
nohup java -jar app.jar > java_output.log &
nohup ./script.sh > shell_output.log &
alias k='kubectl'
alias kgp='kubectl get pods'
alias kgs='kubectl get svc'
alias kgn='kubectl get nodes'
## CUSTOM
# kubernetes shotcuts alisases
alias k='kubectl'
alias kgp='kubectl get pods'
alias tf="terraform"
alias m="minikube"
export KUBE_EDITOR="nano"
alias argoui='kubectl port-forward svc/argocd-server -n argocd 8080:443'
alias kubeui="kubectl proxy"
alias kubedash="kubectl port-forward -n kube-system service/my-headlamp 8080:80"
export PAGER=cat
# export KUBECONFIG=~/minikube-ai/config
eval $(minikube -p ai docker-env)
kubectl get nodes -o custom-columns=NAME:.metadata.name,CPU_ALLOC:.status.allocatable.cpu,MEM_ALLOC:.status.allocatable.memory,MAX_PODS:.status.allocatable.pods
sudo lsof -i :8000
ps -ef | grep nginx/dashboard
ss -tulnp
netstat -tulnp
netstat -tulnp | grep 8000
pgrep <service_name>
ps aux | grep 200ok.py
find /var/www -type d -name "static"
grep "example" *.txt
grep "example" file1.txt file2.txt file3.txt file4.txt file5.txt file6.txt file7.txt file8.txt file9.txt file10.txt
findstr "example" *.txt
grep "^https://arctic\.admin\.in" repos.txt
git commit --allow-empty -m "trigger CICD pipeline"
git pull --rebase origin main && git push origin main
git diff
pm2 status # Check the status of all processes
pm2 save # Save the current process list
pm2 resurrect # Restore previously saved processes
pm2 startup # Set up startup script
pm2 show app-name # Show details of a specific process
crontab -e
@reboot pm2 start /var/www/html/app.js
pm2 resurrect
pm2 status
# Extract the query line by line and save to file
grep sql query-2024-01-31-19.log | jq -r '.sql' >> sql.log
# Remove duplicate lines in the file
sort sql.log | uniq -c | sort -nr
apt list --installed | grep php # Check packages installed
sudo cp uat.sh /usr/local/bin/uat # Create a command shortcut
sudo tail -f /var/log/apache2/error.log # Tail log file
journalctl -u apache2.service | tail -n 20 # Journalctl for Apache2
dig google.com
nslookup google.com
systemctl list-units
systemctl list-units --all
systemctl list-unit-files
journalctl
journalctl -b # Boot
journalctl -k # Kernel messages
journalctl -k -b # Current boot
journalctl -u nginx.service # Logs of specific service
journalctl -u nginx -f # Logs of specific service with follow
journalctl -u nginx.service --since "2023-10-01" --until "2023-10-02" # Logs of specific service in date range
journalctl -b -u nginx.service # Boot logs of specific service
systemctl list-dependencies nginx.service
systemctl list-dependencies --all nginx.service
sudo systemctl daemon-reload