Linux Basics: The 6 Core Pillars You Actually Need
Introduction
Many beginners getting into Linux are often scared off by the thousands of available commands: complex parameters, the lack of a graphical interface, and the constant “Permission denied” errors.
But here is the truth: as a developer or DevOps engineer, we effectively only use about 20% of the core content in our daily work. Once you master this core, you will have built the skeleton of your Linux knowledge; the rest is just filling in the flesh by reading documentation.
This article strips away the non-essentials to guide you through the 6 core pillars of learning the Linux system.
🌏 Pillar 1: The Worldview: Understanding the Philosophy
Before memorizing commands, you must understand the two core “worldviews” of Linux. This will determine the height of your learning potential.
Everything is a File
In Windows, you are used to clicking hardware icons; but in Linux, hard drives, keyboards, mice, and even running processes are abstracted as files.
- Need to modify system configurations? Find the file.
- Need to check hardware status? Find the file.
Pipes and Composition (|)
Linux believes that “Small is Beautiful.” Every command does one thing and does it well. Through the Pipe (|), we can turn the output of one command into the input of another, building complex tasks like assembling LEGO blocks.
🛡️ Pillar 2: Survival Basics: File Systems & Permissions
You cannot move an inch in Linux without understanding permissions.
Directory Structure (FHS)
Don’t scatter files randomly. Linux has a strict hierarchy standard:
| Path | Description |
|---|---|
/ | The Root directory, the origin of everything |
/bin & /usr/bin | Stores common commands (e.g., ls, cp) |
/etc | Home of configurations (e.g., nginx.conf) |
/var | Stores variable files, primarily logs |
/home | The home directory for standard users |
Permission Management (The Gatekeeper)
When using ls -l, you will see codes like -rwxr-xr--.
| Symbol | Meaning |
|---|---|
r | Read access |
w | Write access |
x | Execute access |
Three Identities: Owner (User), Group, Others.
Core Commands:
chmod: Change mode/permissions (e.g.,chmod 755 script.shorchmod +x script.sh)chown: Change owner (e.g.,chown user:group file)
Permission denied, do not blindly use chmod 777 (granting everyone full permissions). This is extremely unsafe!⚔️ Pillar 3: The Weapons: Text Processing
Linux servers usually lack a GUI (Graphical User Interface). Efficient text processing is your core productivity tool.
The Editor of Gods: Vim
You don’t need to master all the magic of Vim, but you must master the basic skills to “survive”:
| Key | Action |
|---|---|
i | Enter Insert Mode (start typing) |
Esc | Return to Command Mode |
:wq | Save and Quit |
:q! | Force Quit without saving |
The Text Processing Trio (Grep, Awk, Sed)
These are artifacts for handling logs and data:
| Command | Purpose | Description |
|---|---|---|
grep | Search | The most used command. Filters the lines you care about from massive logs |
awk | Extract | Splits text by columns and extracts specific data (e.g., extracting IP addresses) |
sed | Replace | Batch modifies text streams |
Real-world Scenario: Log Analysis
Find all “404 Not Found” errors in the Nginx log and count the top 5 IPs:
⚡ Pillar 4: God Mode: Processes & Services
You need to know what is running on the system and how to control it.
Process Management
System slowing down? CPU spiking?
| Command | Description |
|---|---|
top / htop | View real-time system status (similar to Windows Task Manager) |
ps -ef | grep java | Find specific background processes |
kill -9 <PID> | Forcefully terminate a stuck process |
Real-world Scenario: Java Process Cleanup
Find the PID of a stuck Java application and kill it:
Service Management (Systemd)
Modern Linux distributions mostly use systemd to manage background services.
| Action | Command |
|---|---|
| Start service | systemctl start nginx |
| Stop service | systemctl stop nginx |
| Enable on boot | systemctl enable nginx |
🌐 Pillar 5: Connecting the World: Network Basics
Linux servers are usually managed remotely, so networking skills are essential.
SSH: The standard for remote login. Learn to configure Passwordless Login (SSH Keys) to boost efficiency.
Troubleshooting Commands:
| Command | Description |
|---|---|
ip addr | View local IP (replaces the old ifconfig) |
ping | Test network connectivity |
curl -v <url> | Test if an API is working and view HTTP headers |
netstat -tulpn (or ss) | Check which ports are occupied |
🤖 Pillar 6: Advanced: Automation (Shell Scripting)
When you find yourself typing the same commands repeatedly, it’s time to write a script. Shell scripting involves saving the above commands into a .sh file and adding logic (if/else) and loops. This is the crucial step to evolving from a “User” to an “Engineer.”
Real-world Scenario: Daily Log Backup
Here is a simple script to verify if you are a “User” or an “Engineer”:
| |
Conclusion
The learning curve of Linux is steep, but as long as you hold these 6 core positions, you possess the ability to solve most problems.
Final advice for beginners:
- Get Hands-on: Install a VM or buy the cheapest cloud server to mess around with.
- Use Man: If you don’t understand a command, type
man <command>or<command> --help. Official documentation is the best teacher. - Respect Root: Try to use a standard user account. Use
sudoonly when necessary, and always be vigilant withrm -rf.
Appendix: Linux Common Commands Cheat Sheet
File & Directory Operations (Basic)
| Command | Common Args/Example | Description |
|---|---|---|
ls | ls -l (or ll) | List files with details (permissions, size, etc.) |
cd | cd /var/log | Change current working directory |
pwd | pwd | Print Working Directory (show full path) |
cp | cp -r source target | Copy files or directories (-r for recursive) |
mv | mv old.txt new.txt | Move file, or Rename file |
rm | rm -rf dir_name | ⚠️ Force remove directory recursively w/o prompt |
mkdir | mkdir -p /a/b/c | Make directory (-p creates parent directories) |
find | find / -name "*.log" | Search for files in a specific directory hierarchy |
Text Viewing & Processing (Log Tools)
| Command | Common Args/Example | Description |
|---|---|---|
cat | cat file.txt | Concatenate and display full file content |
tail | tail -f app.log | View the end of a file in real-time (Vital for logs) |
less | less large.txt | View large files page by page (Press q to quit) |
grep | grep "error" app.log | Search for matching strings within text |
vim | vim file.txt | Powerful text editor |
System Status & Processes (DevOps Core)
| Command | Common Args/Example | Description |
|---|---|---|
top | top | Real-time system resource usage (CPU/Mem/Process) |
ps | ps -ef | grep nginx | View a snapshot of specific running processes |
kill | kill -9 <PID> | Force kill the process with the specified ID |
df | df -h | Disk Free (-h for human-readable format) |
free | free -m | Check memory usage (in MB) |
Permissions & Users (Security)
| Command | Common Args/Example | Description |
|---|---|---|
chmod | chmod +x script.sh | Change file mode (e.g., make executable) |
chown | chown user:group file | Change file owner and group |
sudo | sudo <command> | Execute command as superuser (root) |
passwd | passwd | Change current user password |
Network Operations (Connectivity)
| Command | Common Args/Example | Description |
|---|---|---|
ping | ping google.com | Test network connectivity to a host |
ip | ip addr | Show IP address (Replaces old ifconfig) |
netstat | netstat -ntlp | Network statistics (ports and listening sockets) |
curl | curl http://localhost | Transfer data from/to a server (Test APIs) |
ssh | ssh user@ip | Secure Shell remote login |
Compression & Archiving
| Command | Common Args/Example | Description |
|---|---|---|
tar (Extract) | tar -xzvf archive.tar.gz | Extract a .tar.gz file |
tar (Compress) | tar -czvf archive.tar.gz ./dir | Compress directory into .tar.gz |
zip/unzip | unzip file.zip | Handle .zip format files |