Operations 13 min read

Master Essential Linux Commands: A Quick Reference Guide

This article provides a concise, English‑language reference of essential Linux command‑line tools—including file navigation, viewing, system information, package management, network configuration, and service control—complete with example syntax and brief explanations for each command.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Master Essential Linux Commands: A Quick Reference Guide

Common Linux Commands

tree -L 1 /

– display a one‑level directory tree of the root. ls -l / – list files and directories with detailed information. ls -d / – show the directory entry for the root. ls -d /* – list all top‑level directories and files. cd - – return to the previous working directory. cd . – stay in the current directory. cd .. – move to the parent directory. cd ~ – change to the current user's home directory. pwd – print the absolute path of the current working directory. cp – copy files or directories (e.g., cp source dest). alias – define or display command aliases (e.g., alias ll='ls -l --color=auto'). unalias – remove a previously defined alias (e.g., unalias mv). cat -n /root/.bashrc – display file contents with line numbers. find / -type f -name "useradd" – search for regular files named useradd under the root directory. head /etc/services – show the first ten lines of a file. tail /etc/passwd – show the last ten lines of a file. tail -f /var/log/messages – continuously monitor a file for new content. rpm -ivh /mnt/Packages/elinks.el6_3.x86_64.rpm – install an RPM package. rpm -qa | grep mysql – list installed RPM packages containing "mysql". yum -y install ftp – install the FTP client using yum. yum grouplist – list available and installed package groups. yum -y groupinstall "PostgreSQL 数据库服务器" – install the PostgreSQL server group. yum info – display detailed information about a package or group. yum groupinfo – show information about a yum group. yum search all "keyword" – search package descriptions for a keyword. seq 5 – generate a sequence of numbers from 1 to 5. seq 3 5 – generate numbers from 3 to 5. seq 3 3 10 – generate numbers from 3 to 10 with a step of 3. seq -s "" 5 – output 12345 without separators. seq -w 10 – generate two‑digit numbers padded with leading zeros. hostname – display the system's host name. uname -r – show the kernel release version. uname -a – display all system information. uname -m – show the machine hardware name (e.g., x86_64). whoami – print the effective user ID (e.g., root). su - ping – switch to user ping with a login shell. logout – exit the current login shell. history – display the command history for the current user. history -d 122 – delete the entry at line 122 from the history. history -c – clear the entire command history. runlevel – show the previous and current runlevel (e.g., N 3). init 5 – change the system to runlevel 5. chkconfig sshd on – enable the SSH service to start at boot. chkconfig --list sshd – list the runlevel settings for the SSH service. which ps – locate the full path of the ps executable. whereis jobs – locate binary, source, and manual pages for jobs. whereis -b ping – locate only the binary for ping. ifdown eth0 && ifup eth0 – restart the eth0 network interface. /etc/init.d/network reload – reload network configuration. blkid – display UUIDs and other attributes of block devices.

Built‑in Bash commands include alias, bg, cd, echo, history, jobs, kill, pwd, type, ulimit, unalias, etc. cat /etc/sysconfig/network-scripts/ifcfg-eth0 – view network interface configuration (DEVICE, ONBOOT, NM_CONTROLLED, BOOTPROTO, IPADDR, NETMASK). cat /etc/resolv.conf – view DNS resolver configuration (nameserver entries).

Key points about DNS configuration:

Client DNS can be set in the network interface file (ifcfg‑eth0).

Client DNS can also be set in /etc/resolv.conf.

Settings in the interface file take precedence over /etc/resolv.conf. cat /etc/hosts – view static hostname‑to‑IP mappings used for local name resolution. cat /etc/sysconfig/network – view the system's hostname configuration file. cat /etc/fstab – view filesystem mount information for automatic mounting at boot. df -h – display disk space usage in human‑readable format. mount – list currently mounted filesystems. mount -t ext4 -o loop,noatime,noexec /dev/sdb1 /mnt – manually mount an ext4 filesystem with specific options. dd if=/dev/zero of=/dev/sdb1 bs=4096 count=10 – create a blank filesystem image. mkfs.ext4 /dev/sdb1 – format /dev/sdb1 with the ext4 filesystem.

Testing manual mount procedure:

Create a virtual block device: dd if=/dev/zero of=/dev/sdb1 bs=4906 count=100.

Format it: mkfs.ext4 /dev/sdb1.

Mount it: mount -t ext4 -o loop,noatime,noexec /dev/sda1 /mnt. fsck -A /dev/sda – check and repair all filesystems on /dev/sda.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Bashcommand-linesystem-administration
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.