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鈥檚 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)