Skip to content

Instantly share code, notes, and snippets.

@afro-coder
Last active March 15, 2022 18:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save afro-coder/cbe0db55d69ddf59d16f075acb3e6216 to your computer and use it in GitHub Desktop.
Save afro-coder/cbe0db55d69ddf59d16f075acb3e6216 to your computer and use it in GitHub Desktop.
Daily Linux trouble shooting commands

Get a list of running processes

ps aux

Filter through the processes replace "<keyword>"

ps aux| grep <keyword>

Search for 2 or more processes

ps aux| egrep '<keyword1>|<keyword2>|<keyword3>'

Show running processes using top

top -c

Or use htop

To check if a port is occupied, and by which process

lsof -i :80
or
ss -patun| grep -w 80

Read about SAR for understanding cpu avg over time etc. Install atop to monitor historic events

To check disk usage Overall disk usage

df -Th

Top 10 files

du -ach --max-depth=1 / | sort -rh | head -n10

Change password

passwd username

Reset MySQL root password https://linuxize.com/post/how-to-reset-a-mysql-root-password/

Reboot a server

reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment