Master Linux System Monitoring: Directories, CPU, Memory, Disk & Essential Commands
This guide walks you through Linux's directory layout, how to inspect CPU details via /proc, monitor utilization with top, retrieve version, memory and disk statistics, manage character sets, control services, and use common commands for file handling, permissions, networking, and process management.
Directory Structure
Directory
Description
/bin
Executable files
/boot
Kernel and boot files
/dev
Device files
/etc
Configuration information
/etc/rc.d
Scripts used during shutdown/startup
/etc/rc.d/init.d
Default service start scripts
/etc/xinetd.d
Service startup definitions
/etc/X11
X Window configuration files
/lib
Libraries needed for program execution or compilation
/proc
Kernel and process information stored in memory
/root
Root user's home directory
/sbin
System administration binaries
/tmp
Temporary files
/usr
Programs and utilities (similar to Windows "Program Files")
Key directories to master are /etc and /proc .
Monitoring
View CPU Details
CPU information resides in /proc/cpuinfo. Use: cat /proc/cpuinfo Sample output (truncated):
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 60
model name : Intel(R) Pentium(R) CPU G3260 @ 3.30GHz
stepping : 3
cpu MHz : 800.000
cache size : 3072 KB
physical id : 0
siblings : 2
core id : 0
cpu cores : 2
...Important fields are processor , physical id , siblings , core id and cpu cores . The diagram below explains their meaning:
The server has one physical CPU with two logical processors (threads) and two cores.
Query Logical CPU Count
cat /proc/cpuinfo | grep "processor" | wc -lQuery Physical CPU Count
cat /proc/cpuinfo | grep "physical id" | sort | uniq | wc -lQuery Core Count per Physical CPU
cat /proc/cpuinfo | grep "core id" | wc -lCPU Utilization
Use top to view real‑time CPU usage, process IDs, memory usage, etc.
Linux Version Information
Two ways:
cat /proc/version lsb_release -aSample output:
Linux version 2.6.32-431.el6.x86_64 ([email protected]) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC) ) #1 SMP Sun Nov 10 22:19:54 EST 2013
LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: RedHatEnterpriseServer
Description: Red Hat Enterprise Linux Server release 6.5 (Santiago)
Release: 6.5
Codename: SantiagoMemory Information
Commands:
cat /proc/meminfo
free -m
topSample free -m output:
total used free shared buffers cached
Mem: 7747 5392 2355 0 230 3258
-/+ buffers/cache: 1903 5843
Swap: 7999 0 7999Metric
Meaning
Size
total
Total memory
7747M
used
Memory in use
5392M
free
Free memory
2355M
shared
Always 0 (unused)
0
buffers
Buffer cache
230M
cached
Page cache
3258M
Real memory usage = used - buffers - cached (1903 M). Free memory = free + buffers + cached (5843 M). Heavy swap usage indicates insufficient physical RAM.
Disk Status
Common commands:
df -h # display sizes in G
fdisk -l # detailed disk info
lsblk # tree view of block devicesSample lsblk output:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 461G 0 disk
├─sda1 8:1 0 402.9G 0 part /
├─sda2 8:2 0 50.4G 0 part /home
└─sda3 8:3 0 7.8G 0 part [SWAP]
sr0 11:0 1 1024M 0 romSample df -h output:
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 397G 21G 356G 6% /
tmpfs 3.8G 0 3.8G 0% /dev/shm
/dev/sda2 50G 180M 47G 1% /homeCharset Related
echo $LANG # show current locale
locale -a # list all locales
export LANG=zh_CN.UTF-8 # temporary change
vi /etc/sysconfig/i18n # permanent configurationServices
Firewall Control
# service iptables status
# service iptables start
# service iptables stop
# service iptables restartFTP Service Control
# service vsftpd status
# service vsftpd start
# service vsftpd stop
# service vsftpd restartCommon Commands
View Text Files
cat file.txt
tail -n 5 /proc/cpuinfo
vim file.txtsed (Stream Editor)
Reference: https://man.linuxde.net/sed
Modify System Time
date -s "20160408 12:52:00" # set system time
hwclock --systohc # sync hardware clock to system clock
hwclock --hctosys # sync system clock to hardware clockFile Search (find)
find /home -name "*.txt"Remote Copy (scp)
# copy from remote to local
scp -r [email protected]:/opt/soft/mongodb /opt/soft/
# copy from local to remote
scp /opt/soft/mysql-5.6.0.tar.gz [email protected]:/opt/soft/scptest
# copy between remotes
scp -r [email protected]:/opt/soft/mongodb [email protected]:/opt/softDirectory Operations
mkdir -p /tmp/aa/bb/cc
rmdir /tmp/aa # only removes empty directoriesFile Deletion (rm)
rm -rf /tmp/aaFile Move/Rename (mv)
mv /tmp/test.file /tmp/lib/
mv /tmp/test.file /tmp/lib/test1.fileCheck Logged‑in Users
who
whoamiSystem Reboot
rebootPing Test
ping 159.179.160.43 -tChange Permissions (chmod)
chmod u+rwx,g+rw,o+r aa.txt
chmod 764 aa.txtChange Owner/Group (chown)
chown weblogic nohup.log # change owner
chown :weblogic nohup.log # change group
chown weblogic:weblogic nohup.log # change bothCompression & Extraction
# Create tar archive
tar cvf backup.tar /etc
# Compress
gzip backup.tar # -> backup.tar.gz
bzip2 backup.tar # -> backup.tar.bz2
# Equivalent one‑liner
tar cvfz backup.tar.gz /etc
# Extract
gunzip backup.tar.gz
tar xvf backup.tarProcess Management (ps, kill)
ps -ef | grep java
kill 11588 # graceful
kill -9 11588 # force
pkill -9 javaNetwork Connections (netstat)
Common options: -a all, -t TCP, -u UDP, -n numeric, -l listening, -p show program, -r routing table.
netstat -antup | grep ssh
netstat -rLinux Configuration Files
File
Purpose
/etc/profile
Global environment variables
~/.bash_profile
User‑specific environment variables
/etc/xinetd.conf and /etc/xinetd.d/*
Service configuration
/etc/rc.d/rc.local
Startup script
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.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
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.
