Skip to main content

Command Palette

Search for a command to run...

Basic Linux Commands

Day 3 : 90Days of DevOps Challenge

Published
•2 min read•View as Markdown


Task: What is the Linux command??


The term "Linux command" refers to a command-line instruction or a series of commands used in a Linux operating system. Linux is a Unix-like operating system, and one of its strengths lies in its command-line interface, where users can interact with the system by typing commands.

Linux commands are entered in a terminal or shell, and they perform various tasks such as file manipulation, process management, system configuration, and more. These commands are case-sensitive and often consist of a command name followed by options and arguments.

  1. To view what's written in a file:

     cat filename
    
  2. To change the access permissions of files:

     chmod permissions filename
    
  3. To check which commands you have run till now:

     history
    
  4. To remove a directory/ Folder:

     rm -r directoryname
    
  5. To create a fruits.txt file and to view the content:

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

     echo -e "Apple\nMango\nBanana\nCherry\nKiwi\nOrange\nGuava" > devops.txt
    
  7. To show only the top three fruits from the file:

     head -n 3 devops.txt
    
  8. To show only the bottom three fruits from the file:

     tail -n 3 devops.txt
    
  9. To create another file Colors.txt and to view the content:

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

    echo -e "Red\nPink\nWhite\nBlack\nBlue\nOrange\nPurple\nGrey" > Colors.txt
    
  11. To find the difference between fruits.txt and Colors.txt file:

    diff fruits.txt Colors.txt