Day 3 : Basic Linux Commands

Day 3 : Basic Linux Commands

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!

  1. pwd - Print the current working directory.

  2. ls - List files and directories

    Additional options:

    • -l: Long format, showing detailed information.

    • -a: Show hidden files.

  3. cd - Change directory

  4. mkdir - Create a new directory

  5. cp - Copy files or directories.

    Additional options:

    • -r: Copy directories recursively.

  6. mv - Move or rename files or directories.

  7. rm - Remove files or directories.

    Additional options:

    • -r: Remove directories recursively.

    • -f: Force removal without confirmation

  8. touch - Create an empty file or update the timestamp of an existing file.

  9. cat - Display the contents of a file

  10. man - Display the manual for a command

Task For Day 3

Task: What is the Linux command to

  1. To view what's written in a file

    cat command is used to see the content of the files

    command syntax: cat filename

  2. To change the access permissions of files

    chmod - Change file permissions

    command syntax: chmod 644 filename

  3. 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

  4. To remove a directory/ Folder

    rmdir is used to remove any directory in linux

    command syntax: rmdir foldername

  5. To create a fruits.txt file and to view the content

  6. Add content in devops.txt (One in each line) - Apple, Mango, Banana, Cherry, Kiwi, Orange, Guava.

  7. 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)]

  8. 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 the head 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)]

  9. Add content in Colors.txt (One in each line) - Red, Pink, White, Black, Blue, Orange, Purple, Grey.

  10. To find the difference between fruits.txt and Colors.txt file

    Diff: This command is used to find the difference between two files.