Skip to content

Instantly share code, notes, and snippets.

@unitycoder
Last active September 7, 2026 12:25
Show Gist options
  • Select an option

  • Save unitycoder/83b41d8be44d9a7f54bed2d43885ef59 to your computer and use it in GitHub Desktop.

Select an option

Save unitycoder/83b41d8be44d9a7f54bed2d43885ef59 to your computer and use it in GitHub Desktop.
Linux Shell Cheat Sheet
// LINUX CHEAT SHEET
// firewall, allow port
sudo ufw allow 5001/udp
sudo ufw allow 5001/tcp
// download whole folder recursively:
wget -r --no-parent target[.com/dir
uninstall java:
sudo yum remove java-1.8.0-openjdk-devel
sudo yum remove java-1.8.0-openjdk
check your installed version for java:
rpm -qa | grep java
rpm -qa | grep jdk
unzip zip:
unzip filename.zip
whats my ip
curl ifconfig.me
ctrl-r
ffmpeg
hit ctrl-r more times to go further back
// view disk usage in human readable format
df -h
// view biggest folders
du -a /home | sort -n -r | head -n 5
// make script executable from anywhere
// check your path variable
echo $PATH
// then copy your script to some of those folders, easy one is to create bin directory under home: /home/username/bin
// kill process by name
killall -9 firefox
// get current working directory
pwd
// ssh with port parameter
ssh -p 22 username@127.0.0.1
// view last failed logins (centos)
cat /var/log/secure | grep 'sshd.*Invalid'
// run script at boot
nano /etc/rc.local
// add your script there
// what is using port #
sudo netstat -plnt
// check if specific program is running
ps -A | grep python
// stop program *get PID with ps command
kill 12345
// it still stuck
kill -9 12345
// kill process by name
pkill firefox
// apache server
apachectl start
apachectl restart
apachectl stop
// change root password
// login as root
passwd
// enter new password
// centos 7 check network
sudo systemctl status network.service
sudo systemctl status network
// find file
find / -name "*filename*"
// move folder and all files to another folder
// mv doesnt help, because it doesnt move .files
// first copy recursive
cp -r myfolder/* destinationfolder
// then remove old folder
rm -rf myfolder/
// get linux version, distro distribution
cat /etc/*-release
// stop stuck screen
screen -S ##### -X Quit
// check who uses port 5000
sudo ss -lupn | grep :5000
-bash: ls: command not found
your path is broken, fix it at /etc/profile.d
for example you added new file there that overwrites path
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment