Master Linux Basics: From Shell Commands to System Management
This comprehensive guide walks you through essential Linux concepts, from understanding operating systems and distributions to mastering shell commands, file handling, user permissions, networking, process management, package installation, compression, and even Vim editor basics, empowering programmers to become proficient Linux users.
Introduction
Linux is a crucial skill for programmers, especially for front‑end developers who have fewer opportunities to work with it compared to back‑end developers.
Linux Fundamentals
Operating System
An operating system (OS) is the software layer that manages hardware resources and provides basic services to applications.
What Is Linux?
Linux refers to the kernel, while a Linux distribution (distro) combines the kernel with a collection of software packages.
Linux vs Windows
Stable and efficient
Free or low‑cost
Fewer vulnerabilities and quick patches
Multi‑user and multitasking
Strong security model
Suitable for embedded systems
Low resource consumption
Popular Distributions
RHEL (Red Hat Enterprise Linux)
Fedora
CentOS
Deepin
Debian
Ubuntu
Connecting to a Server
Use SSH to log in to a remote Alibaba Cloud ECS instance:
ssh [email protected]Shell Overview
The shell provides a command‑line interface (CLI) for interacting with the OS. Common shells include Bash, Zsh, Fish, etc.
Common Shell Commands
pwd– display current directory ls – list files (options: -a, -l, -h, -t, -i) cd – change directory du – show directory size cat, less, head, tail – view file contents cp, mv, rm – copy, move, delete files mkdir, rmdir – create, remove directories
File and Directory Management
Use chmod, chown, and chgrp to control permissions and ownership.
# Example: give user read/write/execute
chmod 740 file.txtUser and Group Management
Create users with useradd, set passwords with passwd, and manage groups with groupadd, usermod, etc.
Searching Files
Use locate for quick name searches and find for powerful criteria (name, size, time).
find / -name "*.log" -size +10MSoftware Repositories and Package Management
Linux packages are stored in repositories. Manage them with yum (CentOS/RHEL) or apt (Debian/Ubuntu).
yum install vim
yum update
yum remove httpdManual Pages
Use man to read command documentation, or command --help for a quick summary.
Advanced Topics
Redirection and Pipes
Redirect output with > (overwrite) or >> (append). Combine commands with a pipe |.
ls -l | grep "\.conf"Process Management
View processes with ps, top, or w. Control them with kill, bg, fg, jobs, and nohup.
Daemons and systemd
System services run as daemons (PID 1). Manage them with systemctl (start, stop, enable, status).
systemctl start nginx
systemctl enable nginxCompression and Archiving
Create archives with tar and compress with gzip or bzip2. Extract with tar -xvf.
tar -czvf archive.tar.gz /path/to/dirCompiling Software from Source
Typical steps: download source, tar -xvf, ./configure, make, make install.
Networking Basics
Check IP configuration with ifconfig (or ip addr). Resolve hostnames with host. Transfer files with scp or rsync.
Vim Editor
Vim has three main modes: Normal (navigation), Insert (editing), and Command (ex commands). Common actions:
Enter Insert mode: i, a, o Delete: x, dd, dw Copy/Yank: yy, yw Paste: p Search: /pattern and n / N Replace: :%s/old/new/g Configure Vim permanently in ~/.vimrc (e.g., set number, syntax on).
Conclusion
By mastering these Linux commands, concepts, and tools, programmers can efficiently manage systems, automate tasks, and develop robust applications across diverse environments.
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.
