If I Had to Relearn Linux: The Most Essential Commands and Concepts

If I Had to Relearn Linux: The Most Essential Commands and Concepts

This guide is a distilled version of what actually matters: understanding the basics, controlling your system, troubleshooting issues, and making Linux your true working environment.


🔢 Filesystem Management

View Disk Usage

df -h        

Shows mounted filesystems and disk usage in human-readable format.

Show Mounted Filesystems

mount        

Lists currently mounted filesystems.

Show Block Devices

lsblk        

Displays information about block devices.

Filesystem Check and Repair

fsck /dev/sda1        

Check and repair a filesystem.


📅 Hardware Information

CPU Information

lscpu        

View detailed CPU info.

Full Hardware Summary

lshw        

Complete hardware listing (requires sudo).

PCI and USB Devices

lspci
lsusb        

List PCI and USB devices.

Memory Usage

free -h        

Shows memory usage in human-readable format.


💡 Process Management

List All Processes

ps aux        

View all processes.

Live Monitoring

top
htop        

Monitor active processes (htop is interactive).

Kill a Process

kill -9 <pid>        

Forcefully terminate a process.


🔗 File Links in Linux

Create Hard Link

ln source target        

Create Symbolic Link

ln -s source target        

✂️ Text Processing & Parsing

Cut

cut -d':' -f1 /etc/passwd        

Extract fields from text.

Grep

grep 'error' logfile.txt        

Search for specific text.

Awk

awk '{print $1, $5}' logfile.txt        

Extract specific columns.

Sed

sed 's/old/new/g' file.txt        

Find and replace text.


🔎 System Monitoring

System Summary

vmstat 1        

View system resource summary.

Uptime and Load

uptime        

See system uptime.

Kernel Info

uname -a        

Get kernel and OS info.

View Historical Stats

sar -u 1 3        

View CPU usage history.

Critical System Logs

journalctl -xe        

Investigate important logs.


👥 User and Group Management

User and Group Operations

useradd, usermod -aG, groupadd, passwd        

Manage users and groups.

File Permissions

chmod 644 file.txt
chown user:group file.txt        

Adjust file permissions and ownership.


📦 Compression and File Transfers

Archive and Extract

tar -czvf archive.tar.gz folder/
tar -xzvf archive.tar.gz        

Compress and extract directories.

Zip and Unzip

zip archive.zip file.txt
unzip archive.zip        

File Transfers

scp file user@remote:/path
rsync -avz source/ dest/        

Secure and efficient file transfer.


📚 Networking Essentials

Connectivity Testing

ping google.com
traceroute google.com        

Check connectivity and network hops.

DNS Lookup

dig google.com        

Query DNS records.

Open Ports and Connections

netstat -tulnp
ss -tuln        

List network ports and listening services.

External IP Check

curl ifconfig.me        

Debugging SSH

ssh -vvv user@host        

Verbose SSH connection debugging.


🔒 Advanced Networking & Security

View Firewall Rules

iptables -L        

View active firewall rules.

Capture Network Packets

tcpdump -i eth0 port 80        

Capture HTTP traffic.

Port Scanning

nmap -sS <target>        

Stealth scan a server.


📥 Volume Management (LVM)

Physical and Volume Group Management

pvcreate /dev/sdb1
vgcreate my_vg /dev/sdb1        

Logical Volume Management

lvcreate -L 10G -n my_lv my_vg
mkfs.ext4 /dev/my_vg/my_lv
mount /dev/my_vg/my_lv /mnt/data        

Create, format, and mount logical volumes.

Snapshots

lvcreate -s -L 1G -n snap /dev/vg/lv        

Create LVM snapshot.


⏳ Background Jobs and Automation

Manage Jobs

jobs
bg %1
fg %1
disown %1        

Handle background and foreground jobs.

Persistent Jobs

nohup command &        

Run jobs immune to logout.

Cron Jobs

crontab -e        

Schedule recurring tasks.

At Jobs (One-time Scheduling)

at now + 5 minutes        

Schedule a command once.


🔄 Bonus: Troubleshooting Disk Space

Find Large Directories

du -sh *        

Identify space-consuming folders.

Search for Specific Files

find /path -name '*.log'        

Find files matching criteria.


🛠️ Bonus: Package and Service Management

Install a Package (Debian/Ubuntu)

sudo apt install package-name        

Install software on Debian-based systems.

Install a Package (RHEL/CentOS/Fedora)

sudo yum install package-name
sudo dnf install package-name        

Install software on RedHat-based systems.

Manage Services with systemctl

sudo systemctl start service-name
sudo systemctl stop service-name
sudo systemctl status service-name        

Start, stop, and check the status of services.

Check SELinux Status (if applicable)

getenforce        

Check current SELinux mode.

Temporarily Disable SELinux

sudo setenforce 0        

Switch SELinux to permissive mode.


👊 Closing Thoughts

If I were learning Linux again from the beginning, this is exactly what I would focus on first.

Understand these commands, use them in real-world scenarios, and Linux will start feeling less like a foreign system and more like home.

Save it, practice it, and build upon it — because the basics never go out of style.

#linux #learningpath #opensource #systemadministration #devops #sre #cloudengineering

To view or add a comment, sign in

More articles by Anamika Sanjay

Insights from the community

Others also viewed

Explore topics