Skip to main content

Command Palette

Search for a command to run...

Basic Linux Commands

Day 3 of 90daysofdevops

Updated
•1 min read•View as Markdown
Basic Linux Commands
  1. To view what's written in a file.

    cat filename

  2. To change the access permissions of files.

    chmod [permissions] [filename]
    4: Read (r) 2: Write (w) 1: Execute (x)

  3. To check which commands you have run till now.

    history

  4. To remove a directory/ Folder.

    rm [filename]

    rmdir [dirname]

    rm -r [dirname]

  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.

    vim devops.txt

    an editor will open and write

    Apple

    Mango

    Banana

    Cherry

    Kiwi

    Orange

    Guava

    esc :wq!

    : used to enter cmds

    w for saving

    q to quit

    ! used for frocefully

  7. To Show only top three fruits from the file.

    head -n 3 fruits.txt

  8. To Show only bottom three fruits from the file.

    tail -n 3 fruits.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.

    follow the steps mention in step 6 and add below it.

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

    diff [file1] [file2]