Linux Basic Operations and Command Reference
This article provides a comprehensive reference of essential Linux commands and procedures, covering system shutdown and reboot, hardware and environment inspection, file and directory management, user and permission handling, networking utilities, performance monitoring tools, and common text processing techniques for administrators and developers.
Basic Operations
Commands for shutting down ( shutdown -h now ) and rebooting ( shutdown -r now ) the system, inspecting kernel information ( uname -a ), CPU details ( cat /proc/cpuinfo ), and environment variables ( env ).
Creating symbolic links ( ln -s /usr/local/jdk1.8/ jdk ), checking RPM installations ( rpm -qa | grep package ), generating SSH keys ( ssh-keygen -t rsa -C [email protected] ), defining command aliases ( alias ll='ls -alF' ), synchronizing time ( sudo ntpdate -u ntp.api.bz ), running background jobs with nohup , forcing user logout ( pkill -kill -t TTY ), locating command paths ( which command ), and viewing file descriptor limits ( ulimit -n ).
Configuring DNS ( vim /etc/resolv.conf ), using nslookup , checking recent logins ( last -n 5 ), setting static IP ( ifconfig em1 192.168.5.177 netmask 255.255.255.0 ), and changing file ownership ( chown eagleye.eagleye xxx.log ).
File and Directory Operations
Vim editing shortcuts, saving read‑only files ( :w !sudo tee % ), and disk usage commands ( mount , df , du -H -h , du -sh * ).
Word count utilities ( wc -l filename , wc -w filename , wc -L filename , wc -c ).
Compression and Extraction
Compress with tar czvf xxx.tar directory or zip -r xxx.zip directory ; extract with tar zxvf xxx.tar , tar zxvf xxx.tar -C /target/dir , or unzip xxx.zip .
File Ownership and Copying
Change ownership ( chown user.group file ), copy files ( cp xxx.log , cp -f xxx.log , cp -r src dst ), remote copy with scp -P port user@host:/path /local , create nested directories ( mkdir -p /a/b/c ), and compare files ( diff -u 1.txt 2.txt ).
Log and Text Processing
Append performance markers to logs ( tail -f xxx.log | pv -bt ), view special characters ( cat -v xxx.sh ), remove them with sed -i 's/^M//g' env.sh , convert line endings ( dos2unix ), and duplicate output with awk '{print $0}' xxx.log | tee test.log .
Search Utilities
Grep examples for inverse matching, line numbers, counting occurrences, and case‑insensitive search.
Awk examples for field filtering and character counting.
Find command examples for name patterns, time‑based searches, user ownership, and batch deletion.
Network Related Commands
Identify processes using a port ( lsof -i:port ), obtain local IP addresses, manage firewall rules with iptables , test TCP connections with nc , capture packets ( tcpdump -i em1 tcp port 12301 -s 1500 -w abc.pcap ), trace routes ( traceroute -I www.163.com ), and inspect sockets with ss and netstat .
Performance Monitoring
Interactive process viewer top with sorting shortcuts, kernel ring buffer ( dmesg ), disk I/O statistics ( iostat -xz 1 ), memory usage ( free -m ) and its interpretation, network throughput ( sar -n DEV 1 ) and TCP state ( sar -n TCP,ETCP 1 ), and comprehensive system snapshot with vmstat 2 1 .
Laravel Tech Community
Specializing in Laravel development, we continuously publish fresh content and grow alongside the elegant, stable Laravel framework.
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.