Master Essential Linux Shell Commands: A Complete Guide for System Operations
This comprehensive guide introduces Linux shell fundamentals, compares popular shells like Bourne, Csh, Korn, and Bash, and provides detailed usage of over 30 essential commands for file management, process control, networking, and system administration, empowering users to work efficiently in a command‑line environment.
Linux Shell Overview
Using the Linux shell is a daily task for many programmers, but useful commands and tricks are often forgotten. While you may remember commands, you might not recall how to use them for specific tasks, and some usages require additional software installed on your Linux system.
The shell is a command interpreter that provides an interface between the user and the operating system. It is text‑based, unlike the graphical X Window system. You type commands, the shell interprets them, and passes them to the OS for execution.
The shell can execute internal Linux commands as well as external applications, and you can write shell scripts to perform complex tasks.
Linux offers several shells. Common ones include Bourne (sh), C (csh), and Korn (ksh), each providing basic functionality with their own characteristics.
Bourne Shell
The Bourne shell, written by Stephen Bourne, is the default UNIX shell. It has strong scripting capabilities but lacks interactive features. Bash is an enhanced version of the Bourne shell.
C Shell
The C shell, created by Bill Joy at UC Berkeley, adds interactive features such as command completion, aliases, and history substitution that the Bourne shell lacks. Its syntax resembles the C language, making it comfortable for C programmers. tcsh is a fully compatible, enhanced version of Csh.
Korn Shell
The Korn shell, written by David Korn, combines the advantages of Csh and Bourne shell while remaining fully compatible with Bourne. The public‑domain Korn shell (pdksh) is an enhanced version.
Bash
Bash is the default shell on most Linux systems. It overcomes the shortcomings of the Bourne shell while remaining fully compatible.
Command line completion: press Tab to auto‑complete commands or program names.
Wildcard support: use * and ? for pattern matching.
History: Bash records each command in a history list, controlled by the HISTSIZE variable. Use history, fc, or !n to recall or edit previous commands.
Aliases: Define shortcuts with alias and remove them with unalias.
Logging into the Shell
After Linux boots, you are prompted with login. Enter your username and password. If correct, you enter the shell prompt where you can type commands. Use logout to exit.
Common Shell Commands
Change user password : passwd Online help : man <command> Remote login : rlogin <host> [-l username] or telnet <host> List files : ls [-atFlgR] [name] (options: -a show hidden files, -t sort by modification time, -F append type indicator, -l long format, -R recursive)
Change directory : cd [directory] Copy files : cp [-r] source destination Move/rename files : mv source destination Create directory : mkdir dirname Remove directory : rmdir dirname or rm -r dirname Delete files : rm filename (wildcards *, ? supported)
Print working directory : pwd View file contents : cat filename Paginated view : more filename or cat filename | more Disk usage : du [-s] directory File transfer : rcp [-r] source host:dest, rcp [-r] host:source dest, ftp host Change permissions : chmod [-R] mode name Change ownership : chown [-R] user name Change group : chgrp [-R] group name Update timestamps : touch name Create links : ln old new or ln -s old new Search strings : grep string file Find files : find path -name filename -print Compare files/directories : diff [-r] name1 name2 Print jobs : lpr [-Pprinter] filename, enscript, ptroff Process control : ps [-aux], kill [-9] PID, run in background with &, suspend with Ctrl+Z, resume with bg, list jobs with jobs Shell variables : view with set, set with set var=value, unset with unset var Aliases : view with alias, define with alias name='command', remove with unalias name History : set length with set history=n, view with history, repeat with !!, !n, !string, edit with ^old^new Compression : compress filename, uncompress filename, compressdir dirname, uncompressdir dirname Pipelines : command1 | command2 Input/Output redirection : command < file, command > file, command >! file, command >& file, command >> file, command >>& file View users : who, finger, w, su username, who am i, rusers Talk to users : talk username@host Network test : ping hostname or ping IP Email basics : mail -s "subject" address < file, mail username, mail address, check queue with /usr/magedu/sendmail -bp For more advanced Linux operations and career development, see the advertised "Linux Cloud Computing and Operations Architect High‑Salary Practical Class" starting on December 10, 2018, promising a 120‑day path to a 300,000 CNY annual salary for Linux operations.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
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.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
