In this blog post, we'll embark on a journey through fundamental Linux commands — the building blocks that empower you to interact with the system, manage files, and unleash the true potential of this robust operating system. Whether you're a curious tech enthusiast, a student diving into the world of IT, or a professional seeking to expand your skill set, mastering these basic commands is your passport to a seamless Linux experience.
So, buckle up as we demystify the command line, guiding you through essential Linux commands that will not only make you feel at home in the terminal but also empower you to perform tasks efficiently and like a seasoned Linux user. Let's dive in and discover the commands that form the backbone of Linux proficiency. Whether you're aiming to manipulate files, navigate directories, or understand what's happening under the hood, we've got you covered.
Ready to embrace the command line and level up your Linux game? Let's get started!
pwd - Print the current working directory.
ls - List files and directories
Additional options:
-l
: Long format, showing detailed information.-a
: Show hidden files.
cd - Change directory
mkdir - Create a new directory
cp - Copy files or directories.
Additional options:
-r
: Copy directories recursively.
mv - Move or rename files or directories.
rm - Remove files or directories.
Additional options:
-r
: Remove directories recursively.-f
: Force removal without confirmation
touch - Create an empty file or update the timestamp of an existing file.
cat - Display the contents of a file
man - Display the manual for a command
Task For Day 3
Task: What is the Linux command to
To view what's written in a file
cat command is used to see the content of the files
command syntax: cat filename
To change the access permissions of files
chmod - Change file permissions
command syntax: chmod 644 filename
To check which commands you have run till now
History: This command will display a numbered list of previously executed commands along with their respective command numbers
To remove a directory/ Folder
rmdir is used to remove any directory in linux
command syntax: rmdir foldername
To create a fruits.txt file and to view the content
Add content in devops.txt (One in each line) - Apple, Mango, Banana, Cherry, Kiwi, Orange, Guava.
To Show only top three fruits from the file.
The
head
command in Linux is used to display the first few lines of a text file or input provided through a pipeline. By default, it shows the first 10 lines of the specified file. Here's the basic syntax:head [options] [file(s)]
To Show only bottom three fruits from the file.
The
tail
command in Linux is used to display the last few lines of a text file or the output of a command. It is the counterpart to thehead
command, which shows the beginning of a file. By default,tail
displays the last 10 lines of a file. Here's the basic syntax:tail [options] [file(s)]
Add content in Colors.txt (One in each line) - Red, Pink, White, Black, Blue, Orange, Purple, Grey.
To find the difference between fruits.txt and Colors.txt file
Diff: This command is used to find the difference between two files.