Linux Command Line Basics: System Monitoring, Files & Hardware

3 min read
*Originally published on [DevTutsPro]
Linux is a powerful operating system widely used in servers, cloud environments, and development workflows. Understanding Linux commands is essential for DevOps professionals, system administrators, developers, and IT professionals. This is the first of our Linux command series; we'll discuss the fundamentals of system, hardware, and file commands.
Command | Description |
uname | Show the kernel name. |
uname -r | Display the kernel version. |
uname -a | Show all system information. |
clear / Ctrl+L | Clear the terminal screen. |
uptime | Show how long the system has been running. |
uptime -p | Show uptime in a pretty (human-readable) format. |
hostname | Show the system hostname. |
hostname -i | Show the IP address(es) for the hostname. |
hostnamectl set-hostname | Change the system hostname (requires sudo). |
date | Show current date and time. |
timedatectl | Show/modify system time settings. |
timedatectl set-timezone | Set the system timezone (requires sudo). |
lscpu | Show CPU architecture and details. |
free -h | Show memory usage in human-readable format. |
df -h | Show disk usage for mounted filesystems (human-readable). |
touch | Create an empty file (or update timestamp). |
rm | Delete a file (prompts depending on shell/flags). |
rm -f | Force remove a file without confirmation. |
rm -f * | Remove all files in the current directory — dangerous. |
mkdir | Create a directory. |
mkdir -p | Create nested directories (parents as needed). |
ls | List files and directories. |
ls -l | Long/detailed listing. |
ls -a | Include hidden files. |
cd | Change directory. |
cd .. | Go to the parent directory. |
cd ~ | Go to the home directory. |
cd - | Go to the previous directory. |
cp | Copy file(s). |
cp -r | Copy directory recursively. |
mv | Move or rename file/directory. |
File Commands (Common File & Directory Operations)
1. touch
— Create files
# Create a single file
touch file1.txt
# Create multiple files
touch file1.txt file2.txt file3.txt
# Create a sequence
touch file{1..5}.txt
2. rm
— Remove files (use with caution)
# Remove a single file (may prompt depending on settings)
rm file1.txt
# Force remove without confirmation
rm -f file1.txt
# Remove all .txt files
rm -f *.txt
# Remove a sequence of files
rm -f file{1..5}.txt
# Remove all files in the current directory (DANGEROUS)
rm -f *
Warning: rm -f *
is irreversible in ordinary circumstances. Double-check your current directory before running destructive commands
3. mkdir
— Create directories
# Single directory
mkdir folder1
# Multiple directories
mkdir folder1 folder2 folder3
# Nested directories (create parents as needed)
mkdir -p parent/child/grandchild
# Sequence of directories
mkdir folder{1..5}
4. ls
— List directory contents
ls
# Example:
# file1.txt file2.txt folder1
ls -l
# Example: detailed listing (permissions, owner, size, date)
ls -a
# Shows hidden files (names starting with a dot)
5. cd
— Change directory
cd folder1 # enter folder1
cd .. # move up one level
cd ../.. # move up two levels
cd ~ # go to home directory
cd / # go to root directory
cd - # go to previous directory
6. cp
— Copy files and directories
# Copy a single file
cp source.txt destination.txt
# Copy multiple files into a directory
cp file1.txt file2.txt /backup/
# Copy directory recursively
cp -r folder1 folder2
7. mv
— Move or rename files
# Rename a file
mv oldname.txt newname.txt
# Move a file to another directory
mv file1.txt /backup/
# Move multiple files
mv *.txt /backup/
0
Subscribe to my newsletter
Read articles from Venkat Reddy directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
