Many of us have been using Windows or Mac as our operating systems, which require a purchase (for example, the latest Windows 11 costs $139). But what if I told you that you can use Linux without spending any money? Isn't it fascinating that in today's world, we have access to a free operating system?
Linux History
Linux is an open-source operating system developed by Linus Torvalds in 1991. Initially, he started it as a personal project, but it quickly became open-source, encouraging contributions from developers worldwide. Although it began as a command-line interface (CLI) based system, Linux has grown exponentially. Today, it is widely used in various domains such as DevOps, cloud computing, air traffic control, business, and many more.
Now that you have a bit of motivation to study Linux, let me introduce you to some of its basic commands and its file system. Before we dive in, it's important to know that Linux has many distributions, such as Ubuntu, RedHat, CentOS, Kali, and more. You can choose one based on your needs or future goals. For more information about these distributions, click here. The basic commands remain the same across all distributions.
Basic Commands
If this is your first time to work in an CLI O.S. then you'll be suprised to know that you can do everything using commands from creating any folder/file to installing a software or adding any other user.
pwd : shows us the current directory in which we are working
mkdir <directory _name> : to create a folder which is also called a directory in Linux
cd <directory_name> : to change current directory
touch <file_name > : to create a file
ls : to list the content of a directory in which you are present
rm <file_name>/<directory_name> : to delete a file or directory
You can create multiple files and directories by writing their names in front of command.
Also you can create 100's or 1000's files using linux with just one command i.e.
touch file{1..10}. Isn't is easy then clicking again and again in any other O.S. .
Ex. touch apple oranges banana will create 3 files with names apple, oranges, banana respectively
- cp <source> <destination> : this command is used to copy a file or directory from the source folder to the destination folder. You can also add different options as per your need.
Options are like modifier in Linux that are used to provide additional functionality.
Ex. ls -a: ls is used to list the content of directory while -a is used to also show hidden files
usedadd <user_name> : to add any new user. in Windows you cann't add a user in such a simple way.
passwd <user_name> : to create any user account password.
su <user_name> : to switch user account.
exit : to log out from user account.
userdel <user_name> : to delete any user account.
In the above image, you can see that I'm using sudo
repeatedly. So, what is the use of sudo ?
In Linux, the root user is the superuser with full administrative privileges, allowing them to perform operations that regular users cannot. Some tasks, such as installing software, modifying system files, or changing system settings, require root-level permissions.
So either you switch to root directory again and again or use sudo, choice is yours but only in your personal device, In professional environments, direct root access is often restricted for security reasons. Instead, you will typically use sudo to perform administrative tasks. Now let me also tell you about Linux File System Hierarchy.
Linux File System Hierarchy
As already told the main directory of Linux is Root directory, represented by / . It's a top level directory in Linux.
Let's look what each directory inside root contains.
/bin : contains common Linux commands that you can use are located in this
directory, but the commands are those which you need to use in single-
user models(only one user).
/sbin : it also contains commands, but commands under this directory are mostly used by system administrator, for system maintainance purpose.
/dev : contains hardware devices files, like usb or any other device connected to the system.
/var : contain files that are tend to grow, like var/lib which contains database and package files.
/etc : contains all configuration files of server, it controls the behaviour of O.S..
/home : contains secondary users home dirctory.
/tmp : contains temporary files created by system and users.
Above were tha main directories whose definitions you should know.
Install any software with just One Command
Now, let me tell you about the magic of Linux when it comes to downloading software. In Windows or other operating systems, you often have to download software from the official website, install it, and set the environment variables, which can be quite a tedious process. But in Linux, you can install any software with just one command: the apt-get command. Just don't forget to use sudo.
sudo apt-get install <software name>
At last, let me tell you one of the most usefull command of linux i.e man command.
man <command_name> : it gives you all the detailed information of the command.
Conclusion
So that's all for this blog. However, this is just a tiny fraction, perhaps 1%, of what Linux has to offer. Linux is vast and complex, and I hope this blog has provided you with a brief introduction to its capabilities. As you continue to explore, you'll discover a wide array of features and functionalities that make Linux a powerful and versatile operating system. Happy learning!