Linux command cheat-sheet
pwd
ls
ls -l
ls -la
ls -lh
cd folder
cd ..
cd ~
tree
touch file.txt
mkdir folder
mkdir -p a/b/c
cp file backup
cp -r folder backup
mv old new
rm file
rm -r folder
rm -rf folder
rmdir folder
cat file.txt
less file.txt
more file.txt
head file.txt head -n 20 file.txt
tail file.txt tail -n 20 file.txt tail -f logfile.log
nl file.txt
find . -name "*.txt"
find . -type f
grep word file.txt grep -i word file.txt grep -r word folder
locate firefox which firefox whereis firefox
chmod +x script.sh chmod 755 file chmod 644 file
chown user file chown user:group file
755 = Owner full, others read+execute 644 = Owner write, others read 777 = Everyone everything 600 = Private file
ps ps aux
top htop
kill PID kill -9 PID pkill firefox pgrep firefox
uname -a hostname uptime whoami id
free -h df -h du -sh folder lsblk lscpu neofetch
ping google.com ip a ip r curl https://example.com wget URL traceroute google.com ss -tulpn
tar -cvf archive.tar folder tar -xvf archive.tar tar -czvf archive.tar.gz folder tar -xzvf archive.tar.gz zip file.zip folder unzip file.zip
sudo pacman -Syu # Update everything sudo pacman -S package sudo pacman -R package sudo pacman -Rns package pacman -Ss firefox pacman -Qs firefox pacman -Si firefox pacman -Qi firefox pacman -Q pacman -Qe pacman -Qdt sudo pacman -Sc sudo pacman -Scc
yay -S package yay -R package yay -Ss package yay -Syu
systemctl status service sudo systemctl start service sudo systemctl stop service sudo systemctl restart service sudo systemctl enable service sudo systemctl disable service # Example sudo systemctl restart NetworkManager
journalctl journalctl -xe journalctl -u service journalctl -f
lsblk blkid mount umount /dev/sdb1 df -h
who w users sudo useradd bob sudo passwd bob sudo userdel bob
ssh user@host scp file user@host:/folder ssh-keygen ssh-copy-id user@host
kquitapp6 plasmashell plasmashell & # or plasmashell --replace &
lspci lsusb inxi -F sensors xrandr
git clone URL git status git add . git commit -m "message" git push git pull
sudo command command & # run in background # Stop current process: Ctrl+C # Suspend process: Ctrl+Z clear Ctrl+L
-a All -A Almost all -l Long listing -h Human readable -r Recursive / reverse -R Recursive -i Interactive -f Force -v Verbose -q Quiet -s Search / summarize -u Update -y Refresh databases -x Extract -c Create -z Gzip -n Number / no config -e Enable -d Delete / dependencies -p Parents --help Show help --version Show version