Introduction
Welcome to the fascinating world of Linux, a powerful and versatile operating system that has captured the hearts of tech enthusiasts and professionals worldwide. Whether you are a complete newbie or an experienced user from another platform, this blog will introduce you to the fundamentals of Linux and help you get started with some essential commands.
What is Linux?
Linux is an operating system that serves as the backbone of countless devices, from personal computers and servers to smartphones and home appliances. It was created by Linus Torvalds in 1991 and has since grown into an open-source community-driven platform with a vast array of distributions.
Why Use Linux?
The benefits of Linux are numerous: it's highly customizable, secure, stable, and most importantly, it's free to use. This makes it an ideal choice for developers, system administrators, and anyone seeking a reliable and efficient computing environment.
Architecture of Linux
The architecture of Linux explains to us how Linux works. Let us see the meaning of each layers of Linux.
Application or Utilities: These are the software that is operated by us installed in the hardware and operated by us.
Shell: It is a dark screen full of errors and also a medium to connect to the kernel. It is a receiver and giver of commands from application or utilities to kernel and vice-versa.
Kernel: It is the heart of Linux, it contains the core code of Linux in C language written by Linux Torvalds. It connects hardware with an application or utilities.
Hardware: A physical device like a screen or monitor of a computer that displays all the applications and utilities that are operated through a shell and kernel.
Basic Linux Commands
pwd (Print Working Directory): This command displays the current directory you are in. It helps you stay oriented within the file system. It is also known as Present Working Directory.
ls (List): Use this command to list the contents of the current directory.
makefileCopy codeExample: $ ls Output: file1.txt file2.png folder1 folder2
ls -l: Provides a detailed list view, showing file permissions, owner, size, and modification date.
ls -a: Lists all files, including hidden files that start with a dot (e.g., .config)
cd (Change Directory): To move around the file system, use the cd command followed by the directory's name.
bashCopy codeExample: $ cd folder1
cd path/to/directory: This takes you directly to the specified directory.
cd ..: Moves you one level up to the parent directory.
cd /: Takes you to the beginning of the user directory which is denoted by /.
cd ~: Takes you to the home directory in ubuntu.
mkdir (Make Directory): Create a new directory with this command.
mkdir -p dir1/dir2/dir3/dir4/dir: it creates a nested directory or a directory within a directory by using the in the command.
rmdir (Remove Directory): Use this command to delete an empty directory.
arduinoCopy codeExample: $ rmdir unwanted_folder
touch: Create a new empty file with the
touch
command.touch file_name{1..n}.txt: Creates the numbers of files mentioned in { } .
cp (Copy): To copy a file or directory, use the
cp
command.bashCopy codeExample: $ cp file1.txt /path/to/destination
mv (Move): Move files or directories from one location to another with the
mv
command.bashCopy codeExample: $ mv file1.txt /path/to/destination
rm (Remove): Delete a file with the
rm
command. Be cautious, as there is no trash bin; files are deleted permanently.bashCopy codeExample: $ rm unwanted_file.txt
cat (Concatenate): Display the contents of a file on the terminal.
bashCopy codeExample: $ cat file1.txt
man name_of_command: Access the manual pages for commands to get detailed information and usage instructions. (e.g. man mkdir)
echo: It prints the string on the screen. (e.g. Hello Friends)
clear: It clears the screen.
date: It shows the current date.
whoami: shows through which user you have logged in.
Conclusion
Congratulations! You've taken your first steps into the captivating world of Linux. These basic commands will serve as the foundation for your future adventures in this powerful operating system. As you explore further, you'll discover a plethora of additional commands and functionalities that will empower you to unleash the true potential of Linux. Happy learning!