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.
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 --versioncat 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 --helpUser 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/groupPackage Management Basics
Overview of RPM, yum, and related commands for installing and managing packages.
# rpm -ivh package.rpm
# yum install packageProcess Management Basics
Descriptions of process types, attributes, and common tools: ps, top, kill, /proc, and free.
# ps aux
# top
# kill -9 1234
# free -mFile 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 reloadExpect 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" }
}
interactThese sections provide a solid foundation for Linux system administration and command‑line proficiency.
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.
21CTO
21CTO (21CTO.com) offers developers community, training, and services, making it your go‑to learning and service platform.
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.
