Handy Linux command

“REISUB” (The Safe Reboot)

If your entire computer is frozen and the kills above don’t help, Linux users often use the REISUB sequence to reboot safely without corrupting the hard drive. You hold Alt + SysRq and slowly type:

R (unRaw keyboard)
E (tErminate processes)
I (kIll processes)
S (Sync data to disk)
U (Unmount disks)
B (reBoot)

Memory  Tool
sudo apt install htop

Hard Disk Tool:
sudo apt install baobab

MQTT SERVER:

sudo systemctl stop mosquitto
sudo rm /var/lib/mosquitto/mosquitto.db
sudo systemctl start mosquitto
systemctl status mosquitto //IS it running
tail -f /path/to/logfile // Outputs the last 10 lines of a file and actively monitors it for new entries.

PID

PS AUX //Show all process

KILL
Kill PID number
killall python3
killall chrome

Gemini –yolo //accepts all edits without prompting

Networking:
ss -tulpn // Shows all listening ports and the processes attached to them.

🛠️ The “Oops” Savers
history | grep <keyword>: Searches your terminal history for that complex, 50-character command you typed three days ago but forgot to save.

sudo !!: If you type a command and get a “Permission denied” error, running this will instantly rerun your last command with sudo appended to the front.

 

————————–
Python CACHE DELETE:
# Deletes all __pycache__ directories
find . -type d -name “__pycache__” -exec rm -rf {} +

# Deletes any stray compiled Python files (especially helpful for older Python versions)
find . -type f -name “*.py[co]” -delete

# pip cahse purge
pip cache purge