Operations 13 min read

Master Essential Linux Commands for File, Directory, and System Management

This guide provides a comprehensive overview of essential Linux commands for navigating directories, managing files, handling permissions, searching, compressing, and performing system operations such as shutdown and network testing, enabling users to efficiently control and maintain their Linux environments.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Master Essential Linux Commands for File, Directory, and System Management

Linux Common Commands

ls – List directory contents. Usage examples: ls (current directory), ls -l (long format), ls -a (all files including hidden), ls -al (long format with hidden), ls -h (human‑readable sizes), ls -d (show directory itself).

cd – Change directory. Examples: cd /usr/local/src (absolute path), cd ~ (home), cd - (previous), cd .. (parent), cd . (current).

pwd – Print working directory.

Directory Operations Commands

mkdir – Create directories. mkdir test creates a directory, mkdir -p test1/test2/test3 creates nested directories.

rmdir – Remove empty directories.

File Operations Commands

touch – Create an empty file or update timestamps. touch test.py.

rm – Remove files or directories. rm file, rm -r dir (recursive), rm -f file (force), rm -rf dir (force recursive).

cp – Copy files or directories. cp source target, cp -r source_dir target_dir, cp -p source target (preserve attributes), cp -a source target (archive mode).

mv – Move or rename files/directories. mv source target, mv /root/test /tmp/, mv /root/test newtest.

cat – Display file contents. cat file, cat -n file (with line numbers).

more – Paginated view of file contents. Use space to advance, b to go back, q to quit.

head – Show the beginning of a file. head file (default 10 lines), head -n 20 file, head -n -20 file (last 20 lines).

ln – Create links. ln -s source target creates a symbolic link.

Permission Management

chmod – Change file permissions. Symbolic examples: chmod u+x file, chmod g+w,o+w file, chmod u=rwx file. Numeric examples: chmod 755 file, chmod 644 file.

chown – Change file ownership. chown user file, chown user:group file.

User Operations

useradd username

– Add a new user. passwd username – Set user password.

Help Commands

man – View manual pages. --help – Show command help.

Search Commands

whereis – Locate command binaries and manuals. find – Search files with options like -name, -user, -size, -type, -perm, -iname. grep – Search for patterns in files. Options: -i (ignore case), -v (invert match). Example: grep -i "root" /etc/passwd. Use pipelines, e.g., cat file | grep "text" or ls -l /etc | more.

Compression and Decompression

Common formats: .gz, .bz2. Archive commands: tar -zcvf archive.tar.gz files (create gzipped archive). tar -zxf archive.tar.gz (extract). tar -jcvf archive.tar.bz2 files (create bzip2 archive). tar -jxf archive.tar.bz2 (extract). List contents without extracting: tar -ztvf archive.tar.gz, tar -jtvf archive.tar.bz2. Use -C /path to specify extraction directory.

Shutdown and Reboot Commands

shutdown – Power off or reboot. shutdown -h now (halt), shutdown -r now (reboot).

reboot – Reboot the system.

Mount Commands

mount – Mount storage devices. Example: mount -t iso9660 /dev/cdrom /mnt/cdrom. umount – Unmount devices. Example: umount /dev/cdrom or umount /mnt/cdrom (ensure you leave the mount point first).

Network Commands

ping – Test network connectivity. ping -c 4 8.8.8.8 sends four packets. ifconfig – Display or configure network interfaces (requires root).

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.

Bashfile managementcommand-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.