Day #2 Basics linux command

ยท

4 min read

Hi there, Linux Explorer! Are you ready to embark on a journey through the Linux command line? Don't worry; I promise to keep it simple and easy.

What is Linux? Relationship with Kernel

Linux is an open-source, Unix-like operating system kernel that serves as the core or heart of a complete operating system. It's often referred to as the "Linux kernel" to distinguish it from the entire operating system, which is commonly known as a "Linux distribution" or "Linux distro."

Linux Kernel: The kernel is the central component of an operating system. It interacts directly with the computer hardware, managing resources such as the CPU, memory, storage devices, and peripherals.

Relationship with Kernel: In simple terms, Linux is like a recipe, and the kernel is the most crucial ingredient in that recipe. Let me explain this relationship:

Linux is like a blueprint for building a house, and the kernel is the foundation on which the house stands.

  1. Linux: Think of Linux as a detailed blueprint that provides instructions on how to construct a house. It includes plans for the walls, rooms, doors, and windows. The blueprint serves as a guide, helping builders create a complete, functional house.

  2. Kernel: The kernel, in this analogy, is akin to the foundation upon which the house is built. It's the base layer of the operating system, responsible for managing the essential components of your computer, such as the processor, memory, and input/output devices. Without the kernel, like building a house without a solid foundation, the entire operating system cannot function.


    Below are the commands which we are going to cover today:

  • Listing Commands

  • Directory Operation Commands

  • Directory Creation

Check Your Present Working Directory:

Imagine your computer as a big library, and your current location in the library is your "present working directory." To find out where you are, you can use the pwd command (which stands for "print working directory"). Open your terminal, type pwd, and hit Enter. It'll tell you the full path to your current location in your Linux system.

For instance, if you're in your home directory, it might say something like /home/yourusername.

2. List All the Files and Directories:

To see all the files and directories (including hidden ones) in your current location, use the ls command. Remember, Linux likes to hide some things, like secrets in a treasure chest! Hidden files and directories start with a dot (.), so you can reveal them by typing ls -a.

For instance, ls -a might show you something like:

ls -a
file2
.hiddenfile
directory1
.directory2

3. Create a Nested Directory:

Now, let's build our directory tree. Creating a nested directory is like building a series of folders inside folders, just like a Russian nesting doll. To do this, use the mkdir command (which stands for "make directory"). You can create a whole tree at once with the -p option.

For example, if you want to create a nested directory like this: A/B/C/D/E, you can use this command:

mkdir -p A/B/C/D/E

And just like that, you've crafted your own nested directory, ready to store your files in an organized manner.

Linux is like an endless playground with countless commands to explore, but these three basics will help you navigate your way and organize your files. So, go ahead, open your terminal, and give them a try. The Linux adventure awaits you! ๐ŸŒŸ๐Ÿข๐Ÿš€

Conclusion

In Day 2 of our Linux journey, we delved into the fundamental Linux commands. We learned how to navigate our way in the Linux world:

  • We discovered how to use the pwd command to identify our present location, like a GPS for our digital adventure.

  • The ls command unveiled the contents of our directories, revealing both the seen and the hidden, just like turning on the lights in a dark room.

  • Lastly, we mastered the art of creating nested directories with the mkdir command, crafting a structured system of directories within directories, much like building a set of rooms inside rooms.

ย