Getting Hands Dirty On Linux

Hrithik RoyHrithik Roy
3 min read

Introduction

Have you ever wondered what goes behind the scenes of your computer? Or maybe you heard about an open-source customizable operating system called Linux? If so, then you have come to the right place!

Linux isn't only for tech nerds and servers! it's a versatile operating system powering everything from smartphones to web servers. Also, the fun part is that Linux is completely free and open-source, meaning anyone can contribute to it and customize it to their needs.

Navigating the Linux Landscape

The world of Linux offers a variety of choices! Unlike a single operating system, it has different flavours called distribution (distros). These distros are made for different use cases some focusing on user-friendliness like Ubuntu and other power and customization like Arch Linux and some on security and strong encryption like Kali Linux.

Most used Linux distros currently in the IT industry:

RPM-based: RHEL & Centos

Debian-based: Ubuntu

Getting Comfortable with the Terminal

As developers, we should be comfortable with the terminal and use the terminal more and more. Imagine the terminal as a friend who understands specific instructions.

Terminal is a text-based interface that can be used for navigating through the computer, managing files, running commands, and more.

Let's get familiar with some basic navigation commands:

pwd : Print Working Directory(shows your current location)

ls : List files and folders in the current directory

cd : Change Directory (move between folders)

File and Directory Management

Before diving into File and Directory Management we should get an understanding of Path. A path is a unique location of a file or a folder in a file system of an OS. A path to a file is a combination of / and alpha-numeric characters.

  • Absolute Path: An absolute path is defined as specifying the location of a file or directory from the root directory(/). In other words, we can say an absolute path is a complete path from the start of the actual filesystem from the / directory.

  • Relative Path: A relative path is defined as a path related to the present working directory(pwd). Suppose I am located in /home/hrithik and I want to change the directory to /home/hrithik/Linux. I can use the relative path concept to change the directory to Linux.

Let's dive into the File and Directory Management Commands:

mkdir: to create a directory

  • created directories using absolute and relative path

cp: to copy files

  • Copying files into directory

mv: to move files and directories

  • Moving files from one location to another

rm: to remove files and directories

  • Removing files and directories

Some more useful commands

  • touch: Create a new empty file or update the access and modification times of a file.

      touch file.txt
    
  • cat : Concatenate and display files.

      cat file.text
    
  • head: Display the first lines of a file.

      head file.txt
    
  • tail: Display the last lines of a file.

      tail file.txt
    
  • grep: Search for patterns in files.

      grep pattern file.txt
    

man: Manual pages (detailed information on commands)

Conclusion

I am ending this blog about Linux here, but this should not be the end of your learning journey with Linux. Linux is a vast landscape, and I have just helped you get started. So, embrace the learning process and don't be afraid to experiment. Also, leverage the wealth of online resources available

Some of my favourite resources for learning Linux :

36
Subscribe to my newsletter

Read articles from Hrithik Roy directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Hrithik Roy
Hrithik Roy