Linux Basics: A Comprehensive One-Line Guide to Essential Concepts
Photo by Gabriel Heinzer on Unsplash
Linux is a cornerstone of the IT world, powering servers, desktops, and embedded devices. Whether you're a beginner or brushing up, here's a concise guide covering key Linux concepts with commands to get started.
1. What is Linux?
Linux is an open-source operating system built around the Linux kernel, offering flexibility, stability, and community-driven development.
2. Linux Kernel and Distributions
Kernel: The core of Linux, managing hardware and system processes.
Distributions: Variants of Linux, such as Ubuntu (
sudo apt install
), CentOS (yum install
), and Fedora (dnf install
).
3. Linux Filesystem
Structure: Hierarchical organization starting at
/
.Key Directories:
/home
(user files)/etc
(configuration files)/bin
(essential commands likels
,cp
)
Command:
ls /
to view root directories.
4. User Management
Create a user:
sudo useradd username
Change password:
sudo passwd username
Check current user:
whoami
File permissions:
chmod u+x filename
to grant execution permission to the user.
5. Command Line Basics
Navigate:
cd /path/to/directory
List files:
ls -l
Create directory:
mkdir myfolder
Copy files:
cp source.txt destination/
6. Process and Job Management
Check running processes:
ps aux
Monitor system:
top
Kill a process:
kill PID
(replacePID
with the process ID fromps
).Background job: Run
command &
to execute a job in the background.
7. Package Management
Ubuntu/Debian:
sudo apt update && sudo apt install packagename
CentOS/RHEL:
sudo yum install packagename
Fedora:
sudo dnf install packagename
List installed packages:
dpkg -l
orrpm -qa
.
8. Networking Essentials
Ping a server:
ping
google.com
Check network interfaces:
ifconfig
orip addr
Network connections:
netstat -tuln
9. Shell Scripting
Create a script: Use a text editor (e.g.,
nano
script.sh
) and start with#!/bin/bash
.Example:
#!/bin/bash
echo "Hello, Linux!"
10. Security
File ownership:
chown user:group filename
View permissions:
ls -l
SSH into a server:
ssh user@hostname
Basic firewall setup:
sudo ufw enable
andsudo ufw allow 22
(allow SSH).
11. Conclusion
Mastering Linux requires practice, and these concepts form the foundation for advanced topics like DevOps and Cloud Computing. Start experimenting with these commands to deepen your understanding.