Arch Linux: A Beginner's Command-Line Cheat Sheet
Arch Linux offers unparalleled control but can feel daunting for newcomers. This cheat sheet provides essential commands to confidently manage your system.
- System Information & Updates
These commands provide vital system details and keep your system secure:
-
System Information:
-
uname -a
: Displays kernel version, architecture, and more. Example:Linux hostname 6.10.9-arch1-2 #1 SMP PREEMPT_DYNAMIC ... x86_64 GNU/Linux
-
lscpu
: Detailed CPU information (cores, architecture, model, speed). -
free -h
: Human-readable memory usage (RAM, swap).
-
-
System Update:
-
sudo pacman -Syu
: Synchronizes package databases and upgrades all packages.
-
-
Power Management:
-
sudo poweroff
: Shuts down the system. -
sudo reboot
: Reboots the system. -
logout
: Logs out of the current user session.
-
- File Management
Essential commands for navigating, creating, and manipulating files and directories:
-
Navigation:
-
cd /path/to/directory
: Changes the current directory. -
cd ~
: Returns to the home directory. -
ls
: Lists files and directories. -
ls -l
: Lists files with details (permissions, size, modification time). -
ls -a
: Shows hidden files.
-
-
File Manipulation:
-
touch filename.txt
: Creates an empty file. -
mkdir new_folder
: Creates a new directory. -
mv oldname.txt newname.txt
: Renames a file. -
mv file.txt /path/to/destination/
: Moves a file. -
cp file.txt /path/to/destination/
: Copies a file. -
cp -r folder /path/to/destination/
: Recursively copies a directory. -
rm filename.txt
: Deletes a file. -
rm -r foldername
: Recursively deletes a directory (use with caution!).
-
-
File Viewing:
-
cat file.txt
: Displays file contents. -
less file.txt
: Displays large files page by page (quit with 'q'). -
head file.txt
: Displays the first 10 lines of a file. -
tail file.txt
: Displays the last 10 lines of a file.
-
- User Management
Commands for adding, managing, and switching users:
-
sudo useradd -m username
: Adds a new user with a home directory. -
sudo passwd username
: Sets a password for a user. -
sudo userdel username
: Deletes a user account. -
su - username
: Switches to another user's account. -
who
: Lists currently logged-in users.
- Software Installation & Management
Using Pacman and AUR helpers:
-
Pacman:
-
sudo pacman -S packagename
: Installs a package. -
sudo pacman -R packagename
: Removes a package. -
sudo pacman -Ss keyword
: Searches for packages. -
pacman -Q
: Lists installed packages. -
pacman -Qi packagename
: Shows package information.
-
-
AUR Helper (yay):
-
yay -S packagename
: Installs a package from the AUR. -
yay -Syu
: Updates all packages (official repos and AUR).
-
- Networking
Essential commands for managing network connections:
-
ip addr
: Shows network interface information. -
ping -c 4 google.com
: Tests internet connectivity. -
nmcli dev wifi connect "SSID" password "your_password"
: Connects to a Wi-Fi network. -
netstat -tuln
: Shows active network connections. -
ip route
: Displays routing table.
- Disk Management
Commands for checking disk usage, partitioning, and managing storage:
-
df -h
: Shows disk space usage. -
du -sh /path/to/directory
: Shows disk usage of a directory. -
sudo mount /dev/sdX1 /mnt
: Mounts a partition. -
sudo umount /mnt
: Unmounts a partition. -
lsblk
: Lists block devices. -
sudo fdisk /dev/sdX
: Partitions a disk. -
sudo mkfs.ext4 /dev/sdX1
: Formats a partition with ext4. -
sudo smartctl -a /dev/sdX
: Checks disk health. -
sudo dd if=/dev/zero of=/swapfile bs=1M count=1024; sudo chmod 600 /swapfile; sudo mkswap /swapfile; sudo swapon /swapfile
: Creates a swap file. -
sudo swapoff /swapfile; sudo rm /swapfile
: Removes a swap file.
- Process Management
Commands for viewing and controlling running processes:
-
ps aux
: Shows running processes. -
top
: Displays real-time process information. -
htop
: Interactive process viewer (install withsudo pacman -S htop
). -
kill PID
: Stops a process. -
kill -9 PID
: Forcefully stops a process. -
pgrep processname
: Finds the PID of a process. -
nice -n 10 command
: Runs a command with adjusted priority. -
sudo renice -n 10 -p PID
: Changes the priority of a running process.
- Permissions & Ownership
Commands for managing file permissions and ownership:
-
chmod 644 filename
: Sets file permissions (numeric mode). -
chmod u x filename
: Adds execute permission for the owner (symbolic mode). -
sudo chown username:groupname filename
: Changes file ownership. -
sudo chown -R username:groupname directory
: Recursively changes ownership of a directory. -
sudo chgrp groupname filename
: Changes file group ownership.
- System Logs & Monitoring
Commands for viewing system logs:
-
journalctl
: Views system logs. -
journalctl -u servicename
: Views logs for a specific service. -
journalctl --since "YYYY-MM-DD"
: Views logs since a specific date.
- Troubleshooting
Commands for resolving common issues:
-
systemctl rescue
: Enters rescue mode. -
sudo pacman -Sc
: Cleans the package cache. -
sudo pacman -S packagename
: Reinstalls a package. -
sudo fsck /dev/sdX
: Checks and repairs a filesystem. -
sudo pacman -Syyu
: Fixes package dependencies. -
sudo pacman -S $(pacman -Qdtq)
: Reinstalls orphaned dependencies.
- Advanced Tips
-
Aliases: Create shortcuts for commands in your
.bashrc
file (e.g.,alias ll='ls -la'
). -
Backup/Restore (tar):
tar -cvzf backup.tar.gz /path/to/directory
(backup),tar -xvzf backup.tar.gz
(restore). -
Man Pages: Use
man commandname
to get detailed help for any command.
This cheat sheet provides a foundation for navigating Arch Linux. Remember to consult the Arch Wiki for more comprehensive information.
The above is the detailed content of Arch Linux Cheat Sheet: Essential Commands for Beginners. For more information, please follow other related articles on the PHP Chinese website!

A GUI for Effortless Flatpak Management: Introducing Warehouse Managing a growing collection of Flatpak applications can be cumbersome using only the command line. Enter Warehouse, a user-friendly graphical interface designed to streamline Flatpak a

This article provides a comprehensive guide to identifying and resolving hard drive bottlenecks in Linux systems. Experienced server administrators will find this particularly useful. Slow disk operations can severely impact application performance,

Efficient QR code generation tool under Linux system In today's digital world, QR codes have become a way to quickly and conveniently share information, simplifying data access from URLs, texts, contacts, Wi-Fi credentials, and even payment information. Linux users can use a variety of tools to create QR codes efficiently. Let's take a look at some popular QR code generators that can be used directly on Linux systems. QRencode QRencode is a lightweight command line tool for generating QR codes on Linux. It is well-received for its simplicity and efficiency and is popular with Linux users who prefer direct methods. Using QRencode, you can use the URL,

Elementary OS 8 Circe: A Smooth and Stylish Linux Experience Elementary OS, a Ubuntu-based Linux distribution, has evolved from a simple theme pack into a fully-fledged, independent operating system. Known for its user-friendly interface, elegant de

Mastering Linux is crucial for any machine learning (ML) engineer. Its command-line interface offers unparalleled flexibility and control, streamlining workflows and boosting productivity. This article outlines essential Linux commands, explained fo

Arch Linux: A Beginner's Command-Line Cheat Sheet Arch Linux offers unparalleled control but can feel daunting for newcomers. This cheat sheet provides essential commands to confidently manage your system. System Information & Updates These com

This guide provides a comprehensive walkthrough of installing and using the Scikit-learn machine learning library on Linux systems. Scikit-learn (sklearn) is a powerful, open-source Python library offering a wide array of tools for various machine l

This guide explains how to leverage Docker for accessing Kali Linux tools, a safer and more efficient alternative to outdated methods like Katoolin. Katoolin is no longer actively maintained and may cause compatibility problems on modern systems. Do


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

SublimeText3 Linux new version
SublimeText3 Linux latest version

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Dreamweaver Mac version
Visual web development tools
