Fundamentals 38 min read

Master Essential Linux Commands and System Administration Basics

This comprehensive guide covers fundamental Linux commands such as ls and cat, user and group management, package handling with RPM and yum, process monitoring tools, file searching utilities, scheduled task creation with at and crontab, and automating interactions using Expect, providing clear examples and code snippets for each topic.

21CTO
21CTO
21CTO
Master Essential Linux Commands and System Administration Basics

ls Command

Common usage examples of ls with options -l, -a, -F, -r, -R, -lS, -g, -lG, -li, -lt, and --version.

# ls
# ls -l
# ls -a
# ls -F
# ls -r
# ls -R
# ls -lS
# ls -g
# ls -lG
# ls -li
# ls -lt
# ls --version

cat Command

Examples of cat for displaying files, numbering lines, creating and appending files, and showing help.

# cat -n a
# cat > b <<EOF
# cat a > b
# cat a >> b
# cat --help

User and Group Management

Explanation of root and regular users, UID/GID ranges, and the formats of /etc/passwd, /etc/shadow, and /etc/group files with examples.

# cat /etc/passwd
# cat /etc/shadow
# cat /etc/group

Package Management Basics

Overview of RPM, yum, and related commands for installing and managing packages.

# rpm -ivh package.rpm
# yum install package
RPM package naming example
RPM package naming example

Process Management Basics

Descriptions of process types, attributes, and common tools: ps, top, kill, /proc, and free.

# ps aux
# top
# kill -9 1234
# free -m

File Search Utilities

Usage of which, whereis, locate, grep, and find with practical examples.

# which ls
# whereis ls
# locate filename
# grep pattern file
# find . -name "test*"

Scheduled Tasks

Creating one‑time tasks with at and recurring tasks with crontab, including syntax examples.

# at 21:17
# crontab -e
# 30 20 * * * /usr/local/nginx/sbin/nginx -s reload

Expect Scripting

Brief introduction to Expect for automating interactive sessions, with a sample script for password‑less SSH.

#!/usr/bin/expect -f
spawn ssh root@ip
expect {
    "yes/no" { send "yes\r"; exp_continue }
    "*password:" { send "password\r" }
}
interact

These sections provide a solid foundation for Linux system administration and command‑line proficiency.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Linuxcommand-linecronSystem AdministrationShell scripting
21CTO
Written by

21CTO

21CTO (21CTO.com) offers developers community, training, and services, making it your go‑to learning and service platform.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.