Linux Commands Tutorial for Beginners | System & File Basics

Linux Commands Tutorial for Beginners: System & File Basics

Linux is a powerful and widely used operating system in servers, cloud platforms, and modern DevOps workflows. Whether you are a DevOps engineer, system administrator, or developer, understanding basic Linux commands is essential for managing systems efficiently.

This article is the first part of our Linux Command Series. In this guide, you’ll learn essential Linux commands related to system information, hardware details, and file management. These commands form the foundation for working confidently on any Linux system.

Common Linux Commands Overview

CommandDescription
unameDisplays kernel and system information.
clear / Ctrl + LClears the terminal screen.
uptimeShows how long the system has been running.
hostnameDisplays or sets the system hostname.
dateShows the current system date and time.
lscpuDisplays CPU architecture details.
free -hShows memory usage.
df -hDisplays disk space usage.
lsLists files and directories.
cdChanges the current directory.
cpCopies files or directories.
mvMoves or renames files.
rmDeletes files.

System Commands

1. uname – Display System Information

uname
uname -r
uname -a

The uname command displays basic system information. Using -a shows all available details such as kernel version, system architecture, and operating system.

2. clear – Clear the Terminal Screen

clear

Clears the terminal screen. You can also use the keyboard shortcut Ctrl + L.

3. uptime – Show System Uptime

uptime
uptime -p

Displays how long the system has been running along with load averages. The -p option shows the output in a human-readable format.

4. hostname – Display or Change Hostname

hostname
hostname -i
sudo hostnamectl set-hostname new-server

Shows the system hostname. You can also view the system IP address or set a new hostname.

5. date and timedatectl – Manage Date and Time

date
timedatectl
sudo timedatectl set-timezone Asia/Kolkata

The date command shows the current date and time, while timedatectl allows you to view or change system time and timezone settings.

Hardware Commands

1. lscpu – CPU Information

lscpu

Displays detailed information about CPU architecture, cores, threads, and processor model.

2. free – Memory Usage

free -h

Shows memory usage including total, used, and available memory. The -h flag makes the output easy to read.

3. df – Disk Space Usage

df -h

Displays disk usage information for all mounted filesystems in a human-readable format.

File and Directory Commands

1. touch – Create Files

touch file.txt
touch file{1..5}.txt

Creates empty files. You can create multiple files at once using brace expansion.

2. rm – Delete Files

rm file.txt
rm -f *.txt
rm -f *

Deletes files. Use rm -f * with extreme caution, as it permanently removes all files in the current directory.

3. mkdir – Create Directories

mkdir folder
mkdir -p parent/child

Creates directories. The -p option creates parent directories automatically.

4. ls – List Files and Directories

ls
ls -l
ls -a

Lists directory contents. The -l option shows detailed information, and -a includes hidden files.

5. cd – Change Directory

cd folder
cd ..
cd ~
cd -

Navigates between directories on the filesystem.

6. cp – Copy Files and Directories

cp file.txt /backup/
cp -r folder1 folder2

Copies files and directories. Use -r to copy directories recursively.

7. mv – Move or Rename Files

mv old.txt new.txt
mv *.txt /backup/

Moves or renames files and directories.

Conclusion

These basic Linux commands are essential for anyone working with Linux systems. Mastering them will help you navigate servers, troubleshoot issues, and build a strong foundation for advanced DevOps and Linux administration tasks.

Be the first to comment

Leave a Reply

Your email address will not be published.


*