Operations 9 min read

Master Essential Linux Commands for System Management on CentOS 7.6

This guide compiles the most useful Linux commands for service control, file handling, compression, disk and network monitoring, and package management on CentOS 7.6, providing clear examples and visual references to help developers and sysadmins work efficiently.

macrozheng
macrozheng
macrozheng
Master Essential Linux Commands for System Management on CentOS 7.6

System Service Management

systemctl

List all service units: systemctl list-units --type=service Check a service status: systemctl status firewalld Stop a service: systemctl stop firewalld Start a service: systemctl start firewalld Restart a service (regardless of current state): systemctl restart firewalld Reload configuration without stopping the service: systemctl reload firewalld Disable a service from starting at boot: systemctl disable firewalld Enable a service to start at boot:

systemctl enable firewalld

File Management

ls

List all files in the root directory:

ls -l /

pwd

Show the absolute path of the current working directory.

cd

Change the current directory:

cd /usr/local

date

Display or modify system date and time:

date '+%Y-%m-%d %H:%M:%S'

passwd

Set a user password (example for root):

passwd root

su

Switch to another user, e.g., become superuser:

su -

clear

Clear the terminal screen.

man

Show manual page for a command, e.g., ls:

man ls

who

Show the current runlevel: who -r List currently logged‑in users:

who -bUT

free

Display memory usage in megabytes:

free -m

ps

Show running processes: ps -ef Filter for sshd processes:

ps -ef | grep sshd

top

Interactive view of active processes, similar to Windows Task Manager.

mkdir

Create a new directory.

more

Paginated view of a long file, e.g., show 10 lines per page of /var/log/boot.log:

more -c -10 /var/log/boot.log

cat

Display a file with line numbers, e.g., boot log:

cat -Ab /var/log/boot.log

touch

Create an empty file named text.txt:

touch text.txt

rm

Delete a file: rm text.txt Force delete a directory and its contents:

rm -rf testdir/

cp

Copy a directory recursively:

cp -r /mydata/tes1 /mydata/test2

mv

Move or rename a file:

mv text.txt text2.txt

Compression and Extraction

tar

Archive /etc without compression: tar -cvf /mydata/etc.tar /etc Compress /etc with gzip: tar -zcvf /mydata/etc.tar.gz /etc Compress /etc with bzip2: tar -jcvf /mydata/etc.tar.bz2 /etc List contents of a gzip archive (paged): tar -ztvf /mydata/etc.tar.gz | more -c -10 Extract a gzip archive to the current directory:

tar -zxvf /mydata/etc.tar.gz

Disk and Network Management

df

Show disk space usage in human‑readable format:

df -hT

du

Show size of files and directories in the current folder (depth 1):

du -h --max-depth=1 ./*

ifconfig

Display network interface status.

netstat

Show routing table: netstat -rn Show all active TCP connections: netstat -an Show listening services with program names: netstat -tulnp Show all connections with process info:

netstat -atunp

wget

Download a file from the internet.

Software Installation and Management

rpm

Install a package: rpm -ivh nginx-1.12.2-2.el7.x86_64.rpm Search packages (fuzzy): rpm -qa | grep nginx Query exact package name: rpm -qa nginx List files installed by a package: rpm -ql nginx-1.12.2-2.el7.x86_64 Show package information: rpm -qi nginx-1.12.2-2.el7.x86_64 Verify package integrity: rpm -V nginx-1.12.2-2.el7.x86_64 Upgrade a package: rpm -Uvh nginx-1.12.2-2.el7.x86_64 Remove a package:

rpm -e nginx-1.12.2-2.el7.x86_64

yum

Install a package: yum install nginx Check for available updates: yum check-update Update a specific package: yum update nginx Search package information in repositories: yum info nginx* List all installed packages: yum info installed List package names matching a pattern: yum list nginx* Fuzzy search for packages:

yum search nginx

Follow and like for more tips.

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.

LinuxSysadminCentOScommand-linesystemctl
macrozheng
Written by

macrozheng

Dedicated to Java tech sharing and dissecting top open-source projects. Topics include Spring Boot, Spring Cloud, Docker, Kubernetes and more. Author’s GitHub project “mall” has 50K+ stars.

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.