Operations 12 min read

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.

macrozheng
macrozheng
macrozheng
Essential Linux Commands Every Java Backend Engineer Should Master

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=service

Check the running status of a service (example: firewalld):

systemctl status firewalld

Stop a service:

systemctl stop firewalld

Start a service:

systemctl start firewalld

Restart 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 firewalld

Enable a service to start at boot:

systemctl enable firewalld

File 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/local

date

Show or modify the system date and time.

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

passwd

Set a user password.

passwd root

su

Switch user identity (e.g., become superuser).

su -

clear

Clear the terminal screen.

man

Display help information for a specific command.

man ls

who

Show the current runlevel:

who -r

Display users currently logged in:

who -buT

free

Show memory usage in megabytes.

free -m

ps

Display dynamic information about system processes: ps -ef Show the running status of a specific process (e.g., sshd):

ps -ef | grep sshd

top

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.log

cat

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

cat -Ab /var/log/boot.log

touch

Create a file, e.g., text.txt:

touch text.txt

rm

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/test2

mv

Move or overwrite a file:

mv text.txt text2.txt

Compression 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 /etc

Page through a gzip archive's contents:

tar -ztvf /mydata/etc.tar.gz | more -c -10

Extract 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/etc

Disk and Network Management

df

Show disk space usage:

df -hT

du

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 -rn

List all active TCP connections: netstat -an Show listening services:

netstat -tulnp

Display system resources in connection state:

netstat -atunp

wget

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_64

yum

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 nginx
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.

Backend DevelopmentLinuxSystem AdministrationCentOS
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.