Essential commands for installation, package management, system administration, and troubleshooting Assumes pacman as primary package manager. All commands require sudo unless run as root.
1. Installation (Live USB/ISO)
Task Command Update keyring (critical first step) pacman -Sy archlinux-keyring --noconfirmSync mirrors (fastest) reflector --latest 10 --sort rate --save /etc/pacman.d/mirrorlistList disks lsblk -f or fdisk -lPartition disk (example: UEFI + root) cfdisk /dev/sdXFormat partitions mkfs.fat -F32 /dev/sdX1 (EFI)mkfs.ext4 /dev/sdX2 (root)Mount partitions mount /dev/sdX2 /mntmkdir -p /mnt/boot && mount /dev/sdX1 /mnt/bootInstall base system pacstrap /mnt base linux linux-firmwareGenerate fstab genfstab -U /mnt >> /mnt/etc/fstabChroot into system arch-chroot /mntSet timezone ln -sf /usr/share/zoneinfo/Region/City /etc/localtimehwclock --systohcSet locale Edit /etc/locale.gen → uncomment en_US.UTF-8 UTF-8locale-genecho "LANG=en_US.UTF-8" > /etc/locale.conf Set hostname echo "myhostname" > /etc/hostnameAdd to /etc/hosts 127.0.0.1 localhost::1 localhost127.0.1.1 myhostname.localdomain myhostnameSet root password passwdInstall bootloader (GRUB UEFI) pacman -S grub efibootmgrgrub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUBgrub-mkconfig -o /boot/grub/grub.cfgEnable network (systemd) pacman -S networkmanagersystemctl enable NetworkManagerExit & reboot exitumount -R /mntreboot
2. Pacman (Package Management)
Action Command Update system pacman -SyuInstall package pacman -S packageRemove package (with deps) pacman -Rns packageSearch package pacman -Ss keywordList installed packages pacman -QList explicitly installed pacman -QeClean cache (keep last 3 versions) paccache -rk 3Remove untracked packages pacman -Rns $(pacman -Qdtq)View package info pacman -Qi packageList files in package pacman -Ql packageWhich package owns file pacman -Qo /path/to/fileSync database pacman -SyyForce refresh pacman -Syyu
AUR Helper (yay/paru) Install: pacman -S --needed git base-develgit clone https://aur.archlinux.org/yay.git && cd yay && makepkg -si Use: yay -S package (replaces pacman for AUR)
3. System Administration
Task Command List services systemctl list-unit-files --type=serviceEnable service systemctl enable serviceStart service systemctl start serviceCheck status systemctl status serviceView logs journalctl -u serviceReboot rebootShutdown poweroffView kernel messages dmesg | lessCheck disk usage df -hCheck memory free -hList processes htop or topKill process kill PID or pkill nameEdit config (nano/vim) nano /path/to/fileBackup pacman database cp -r /var/lib/pacman /backup/
4. Users & Permissions
Action Command Add user useradd -m -G wheel usernameSet user password passwd usernameEnable sudo for wheel EDITOR=nano visudo → uncomment %wheel ALL=(ALL) ALLChange file owner chown user:group fileChange permissions chmod 755 file
5. Networking
Task Command Check IP ip aTest connection ping archlinux.orgWi-Fi (iwctl) iwctl → station wlan0 scan → connect SSIDEnable Wi-Fi systemctl enable --now iwdCheck DNS cat /etc/resolv.confRestart NetworkManager systemctl restart NetworkManager
6. Filesystem & Storage
Task Command Mount USB mount /dev/sdb1 /mnt/usbUnmount umount /mnt/usbFormat ext4 mkfs.ext4 /dev/sdX1Check filesystem fsck /dev/sdX1Find large files du -ah / | sort -rh | head -n 20Search files find / -name "filename"
7. Troubleshooting
Issue Command Boot into recovery Hold Shift at boot → GRUB → e → add systemd.unit=rescue.target Fix broken packages pacman -Dk (check deps)pacman -Syu --overwrite '*'Reinstall all packages pacman -Qnq | pacman -S -Clear journal logs journalctl --vacuum-time=2weeksCheck boot errors journalctl -b -p errRegenerate initramfs mkinitcpio -PUpdate GRUB grub-mkconfig -o /boot/grub/grub.cfg
8. Useful Tools to Install
pacman -S vim htop git curl wget unzip tree reflector rsync
9. One-Liners
# Full system update + clean
pacman -Syu && paccache -ruk0 && pacman -Rns $(pacman -Qdtq)
# Mirrorlist (fastest 10 servers)
reflector --latest 10 --sort rate --save /etc/pacman.d/mirrorlist && pacman -Syy
# Show orphan packages
pacman -Qdt
# Rebuild AUR packages after upgrade
yay -Syu --rebuildall
10. Arch Wiki Shortcut
Always check: https://wiki.archlinux.org
# Search wiki offline (install arch-wiki-docs)
pacman -S arch-wiki-docs
wiki-search "query"
Pro Tip : Keep archinstall script for automated installs:
pacman -S archinstall
archinstall