DEV Community

Cover image for πŸš€ Arch Linux Cheat Sheet: Essential Commands for new Users
Eshan Roy (eshanized)
Eshan Roy (eshanized)

Posted on

πŸš€ Arch Linux Cheat Sheet: Essential Commands for new Users

Whether you're a seasoned Arch user or a beginner, this cheat sheet has got your back. Let’s dive in! πŸ§™β€β™‚οΈβš‘

πŸ› οΈ System Management

πŸ”„ Update the system

sudo pacman -Syu
Enter fullscreen mode Exit fullscreen mode

πŸ“₯ Install a package

sudo pacman -S <package_name>
Enter fullscreen mode Exit fullscreen mode

πŸ—‘οΈ Remove a package

sudo pacman -R <package_name>
Enter fullscreen mode Exit fullscreen mode

🧹 Clean up unused dependencies

sudo pacman -Rns <package_name>
Enter fullscreen mode Exit fullscreen mode

πŸ” Search for a package in the repo

pacman -Ss <package_name>
Enter fullscreen mode Exit fullscreen mode

πŸ“ƒ List installed packages

pacman -Q
Enter fullscreen mode Exit fullscreen mode

πŸ“¦ AUR (Arch User Repository) Management

🌟 Install yay (popular AUR helper)

git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si
Enter fullscreen mode Exit fullscreen mode

πŸ“₯ Install a package from AUR

yay -S <package_name>
Enter fullscreen mode Exit fullscreen mode

πŸ”„ Update all packages (including AUR)

yay -Syu
Enter fullscreen mode Exit fullscreen mode

πŸ—‘οΈ Remove a package (AUR or repo)

yay -R <package_name>
Enter fullscreen mode Exit fullscreen mode

πŸ’Ύ File System and Disk Management

πŸ“Š Check disk space usage

df -h
Enter fullscreen mode Exit fullscreen mode

πŸ—‚οΈ Check directory size

du -sh <directory_name>
Enter fullscreen mode Exit fullscreen mode

πŸ“‚ Mount a disk

sudo mount /dev/<device_name> /mnt
Enter fullscreen mode Exit fullscreen mode

πŸšͺ Unmount a disk

sudo umount /mnt
Enter fullscreen mode Exit fullscreen mode

πŸ› οΈ List all drives and partitions

lsblk
Enter fullscreen mode Exit fullscreen mode

✏️ Format a drive to ext4

sudo mkfs.ext4 /dev/<device_name>
Enter fullscreen mode Exit fullscreen mode

πŸ‘₯ User Management

βž• Add a new user

sudo useradd -m -G wheel -s /bin/bash <username>
Enter fullscreen mode Exit fullscreen mode

πŸ”‘ Set a password for a user

sudo passwd <username>
Enter fullscreen mode Exit fullscreen mode

πŸ”„ Switch to another user

su - <username>
Enter fullscreen mode Exit fullscreen mode

❌ Delete a user

sudo userdel -r <username>
Enter fullscreen mode Exit fullscreen mode

🌐 Networking

πŸ“‘ Display active connections

ip a
Enter fullscreen mode Exit fullscreen mode

πŸ”§ Enable/disable a network interface

sudo ip link set <interface> up
sudo ip link set <interface> down
Enter fullscreen mode Exit fullscreen mode

πŸ›œ Test network connectivity

ping <hostname_or_IP>
Enter fullscreen mode Exit fullscreen mode

♻️ Restart NetworkManager

sudo systemctl restart NetworkManager
Enter fullscreen mode Exit fullscreen mode

βš™οΈ System Services

πŸ“‹ Check the status of a service

systemctl status <service_name>
Enter fullscreen mode Exit fullscreen mode

▢️ Start/⏹️ Stop/πŸ”„ Restart a service

sudo systemctl start <service_name>
sudo systemctl stop <service_name>
sudo systemctl restart <service_name>
Enter fullscreen mode Exit fullscreen mode

πŸš€ Enable a service at startup

sudo systemctl enable <service_name>
Enter fullscreen mode Exit fullscreen mode

β›” Disable a service at startup

sudo systemctl disable <service_name>
Enter fullscreen mode Exit fullscreen mode

🐧 Kernel and Boot Management

πŸ“œ List installed kernels

ls /boot/vmlinuz*
Enter fullscreen mode Exit fullscreen mode

πŸ”„ Update GRUB configuration

sudo grub-mkconfig -o /boot/grub/grub.cfg
Enter fullscreen mode Exit fullscreen mode

πŸ“₯ Install a new kernel

sudo pacman -S linux-lts
Enter fullscreen mode Exit fullscreen mode

πŸ—‘οΈ Remove an old kernel

sudo pacman -R linux-<version>
Enter fullscreen mode Exit fullscreen mode

πŸš‘ Troubleshooting

πŸͺ΅ View system logs

journalctl -xe
Enter fullscreen mode Exit fullscreen mode

πŸš€ View boot logs

dmesg | less
Enter fullscreen mode Exit fullscreen mode

❌ Check failed systemd units

systemctl --failed
Enter fullscreen mode Exit fullscreen mode

✨ Other Handy Commands

🧹 Clean the package cache

sudo pacman -Sc
Enter fullscreen mode Exit fullscreen mode

🐧 Show Arch Linux system info

neofetch
Enter fullscreen mode Exit fullscreen mode

🌎 Generate a mirrorlist

sudo reflector --latest 20 --sort rate --save /etc/pacman.d/mirrorlist
Enter fullscreen mode Exit fullscreen mode

✏️ Edit pacman configuration

sudo nano /etc/pacman.conf
Enter fullscreen mode Exit fullscreen mode

πŸ’Ύ Save this cheat sheet, and take your Arch Linux journey to the next level! πŸŽ‰

Have suggestions? Drop them in the comments below! πŸ‘‡

Top comments (0)