Linux Command Line Basics: System Monitoring, Files & Hardware

Venkat ReddyVenkat Reddy
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.

CommandDescription
unameShow the kernel name.
uname -rDisplay the kernel version.
uname -aShow all system information.
clear / Ctrl+LClear the terminal screen.
uptimeShow how long the system has been running.
uptime -pShow uptime in a pretty (human-readable) format.
hostnameShow the system hostname.
hostname -iShow the IP address(es) for the hostname.
hostnamectl set-hostnameChange the system hostname (requires sudo).
dateShow current date and time.
timedatectlShow/modify system time settings.
timedatectl set-timezoneSet the system timezone (requires sudo).
lscpuShow CPU architecture and details.
free -hShow memory usage in human-readable format.
df -hShow disk usage for mounted filesystems (human-readable).
touchCreate an empty file (or update timestamp).
rmDelete a file (prompts depending on shell/flags).
rm -fForce remove a file without confirmation.
rm -f *Remove all files in the current directory — dangerous.
mkdirCreate a directory.
mkdir -pCreate nested directories (parents as needed).
lsList files and directories.
ls -lLong/detailed listing.
ls -aInclude hidden files.
cdChange directory.
cd ..Go to the parent directory.
cd ~Go to the home directory.
cd -Go to the previous directory.
cpCopy file(s).
cp -rCopy directory recursively.
mvMove 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

Venkat Reddy
Venkat Reddy