Essential Linux Commands Every Java Backend Engineer Should Master
This guide provides Java backend developers with a comprehensive collection of practical Linux commands for CentOS 7.6, covering system service management, file operations, compression, disk and network monitoring, as well as software installation and package management, all illustrated with clear examples and screenshots.
System Service Management
systemctl
systemctl is a combination of the service and chkconfig commands used to manage system services.
List the status of all services:
systemctl list-units --type=serviceCheck the running status of a service (example: firewalld):
systemctl status firewalldStop a service:
systemctl stop firewalldStart a service:
systemctl start firewalldRestart a service (regardless of its current state): systemctl restart firewalld Reload configuration without interrupting the service: systemctl reload firewalld Disable a service from starting at boot:
systemctl disable firewalldEnable a service to start at boot:
systemctl enable firewalldFile Management
ls
List all files in a specified directory, e.g., the root directory:
ls -l /pwd
Display the absolute path of the current working directory.
cd
Change the current working directory.
cd /usr/localdate
Show or modify the system date and time.
date '+%Y-%m-%d %H:%M:%S'passwd
Set a user password.
passwd rootsu
Switch user identity (e.g., become superuser).
su -clear
Clear the terminal screen.
man
Display help information for a specific command.
man lswho
Show the current runlevel:
who -rDisplay users currently logged in:
who -buTfree
Show memory usage in megabytes.
free -mps
Display dynamic information about system processes: ps -ef Show the running status of a specific process (e.g., sshd):
ps -ef | grep sshdtop
View real‑time active processes, similar to Windows Task Manager.
mkdir
Create a directory.
more
Paginate file viewing, e.g., display 10 lines per page of boot.log:
more -c -10 /var/log/boot.logcat
View a file with line numbers, e.g., Linux boot log:
cat -Ab /var/log/boot.logtouch
Create a file, e.g., text.txt:
touch text.txtrm
Delete a file: rm text.txt Force delete a directory and its contents:
rm -rf testdir/cp
Copy files or directories, e.g., copy test1 to test2:
cp -r /mydata/tes1 /mydata/test2mv
Move or overwrite a file:
mv text.txt text2.txtCompression and Extraction
tar
Archive files in /etc to etc.tar (no compression): tar -cvf /mydata/etc.tar /etc Compress /etc with gzip to etc.tar.gz: tar -zcvf /mydata/etc.tar.gz /etc Compress /etc with bzip2 to /etc.tar.bz2:
tar -jcvf /mydata/etc.tar.bz2 /etcPage through a gzip archive's contents:
tar -ztvf /mydata/etc.tar.gz | more -c -10Extract a gzip archive to the current directory: tar -zxvf /mydata/etc.tar.gz Extract a gzip archive to a specific directory:
tar -zxvf /mydata/etc.tar.gz -C /mydata/etcDisk and Network Management
df
Show disk space usage:
df -hTdu
Show size of files and directories in the current directory:
du -h --max-depth=1 ./*ifconfig
Display the status of network interfaces.
netstat
Show routing information:
netstat -rnList all active TCP connections: netstat -an Show listening services:
netstat -tulnpDisplay system resources in connection state:
netstat -atunpwget
Download files from the internet.
File Upload and Download
Install the upload/download tool lrzsz: yum install -y lrzsz Upload a file using XShell (command rz triggers the upload dialog).
Download a file using XShell (command sz fileName triggers the save dialog).
Software Installation and Management
rpm
RPM (Red‑Hat Package Manager) is a generic package format for Linux, handling .rpm files.
Install a package: rpm -ivh nginx-1.12.2-2.el7.x86_64.rpm Fuzzy search for a package: rpm -qa | grep nginx Exact query for a package: rpm -qa nginx List files installed by a package: rpm -ql nginx-1.12.2-2.el7.x86_64 Show package summary information: rpm -qi nginx-1.12.2-2.el7.x86_64 Verify package contents against installed files: rpm -V nginx-1.12.2-2.el7.x86_64 Update 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
Yum (Yellow dog Updater, Modified) automatically downloads RPM packages, resolves dependencies, and installs them.
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 nginxSigned-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.
