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.
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 firewalldFile 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/localdate
Display or modify system date and time:
date '+%Y-%m-%d %H:%M:%S'passwd
Set a user password (example for root):
passwd rootsu
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 lswho
Show the current runlevel: who -r List currently logged‑in users:
who -bUTfree
Display memory usage in megabytes:
free -mps
Show running processes: ps -ef Filter for sshd processes:
ps -ef | grep sshdtop
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.logcat
Display a file with line numbers, e.g., boot log:
cat -Ab /var/log/boot.logtouch
Create an empty file named text.txt:
touch text.txtrm
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/test2mv
Move or rename a file:
mv text.txt text2.txtCompression 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.gzDisk and Network Management
df
Show disk space usage in human‑readable format:
df -hTdu
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 -atunpwget
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_64yum
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 nginxFollow and like for more tips.
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.
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.
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.
