Master Essential Linux Commands for Efficient System Management
This guide introduces the most commonly used Linux command‑line tools for file handling, content viewing, system monitoring, networking, and permission management, providing clear examples and options to help users quickly become proficient in everyday Linux administration tasks.
File and Directory Management
1. ls – List directory contents
The ls command displays files and directories. Common options include -l for detailed listings and -a to show hidden entries.
ls</code>
<code>ls -l</code>
<code>ls -a2. cd – Change directory
Use cd to move between directories. .. refers to the parent directory and ~ to the user's home.
cd /path/to/directory</code>
<code>cd ..</code>
<code>cd ~3. pwd – Print working directory
Shows the absolute path of the current directory.
pwd4. mkdir – Create directories
mkdir new_directorycreates a single folder; -p creates nested directories as needed.
mkdir new_directory</code>
<code>mkdir -p /path/to/new_directory5. rm – Remove files or directories
Delete a file with rm file. Use -r for recursive removal of directories.
rm file</code>
<code>rm -r directory6. cp – Copy files or directories
Copy a file with cp source_file destination_file. Use -r to copy directories recursively.
cp source_file destination_file</code>
<code>cp -r source_directory destination_directory7. mv – Move or rename files/directories
Move or rename items using mv old_name new_name or mv file /path/to/destination.
mv old_name new_name</code>
<code>mv file /path/to/destination8. touch – Create empty file or update timestamps
Creates a new empty file or updates the access/modification time of an existing file.
touch new_fileFile Content Viewing and Editing
1. cat – Concatenate and display file content
Shows the entire content of a file, suitable for small files.
cat file2. less – Page through file content
Provides interactive paging for large files.
less file3. head – Display the first lines
Shows the first 10 lines by default; use -n to specify a different count.
head -n 10 file4. tail – Display the last lines
Shows the last 10 lines by default; -n changes the number of lines.
tail -n 10 file5. nano and vim – Text editors
nano fileoffers a simple, user‑friendly interface, while vim file provides powerful editing capabilities for experienced users.
nano file</code>
<code>vim fileSystem Management
1. ps – View running processes
ps auxlists all processes for all users with detailed information.
ps aux2. top – Real‑time system resource monitor
Displays CPU, memory, and other resource usage live.
top3. kill – Terminate a process
Terminate a process by PID; -9 forces termination.
kill PID</code>
<code>kill -9 PID4. df – Disk space usage
Shows filesystem disk usage; -h formats sizes in a human‑readable way.
df -h5. du – Directory size
Displays the size of a directory; -sh provides a summarized, human‑readable total.
du -sh directory6. free – Memory usage
Shows memory statistics; -h makes the output human‑readable.
free -h7. uname – System information
Provides kernel and system details; -a prints all available information.
uname -aNetwork Management
1. ifconfig – Configure network interfaces
Displays and configures network interface parameters.
ifconfig2. ping – Test network connectivity
Sends ICMP echo requests to verify reachability of a host.
ping www.example.com3. netstat – Network connections and routing
Shows active connections, routing tables, and interface stats; -an lists all connections.
netstat -an4. ssh – Secure remote login
Connects to a remote host over the SSH protocol.
ssh user@host5. scp – Secure copy files
Copies files between local and remote machines securely.
scp file user@host:/path/to/destination</code>
<code>scp user@host:/path/to/source filePermission Management
1. chmod – Change file permissions
Adjusts access rights using numeric (e.g., 755) or symbolic modes (e.g., u+x).
chmod 755 file</code>
<code>chmod u+x file2. chown – Change file ownership
Sets the owning user and group of a file or directory.
chown user:group file3. sudo – Execute commands as superuser
Runs a command with elevated privileges. sudo command Mastering these commands greatly improves productivity when working in Linux environments.
Full-Stack DevOps & Kubernetes
Focused on sharing DevOps, Kubernetes, Linux, Docker, Istio, microservices, Spring Cloud, Python, Go, databases, Nginx, Tomcat, cloud computing, and related technologies.
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.
