Back to DevOps Series

Some Advance Commands :

Module 1: Standard Input, Output, and Error

  1. Standard Input, Output, and Error
      • Standard Input (stdin)
      • Standard Output (stdout)
      • Standard Error (stderr)

Module 2: File Viewing Commands

1. head Command

Used to display first few lines of a file.
head filename.txt
  • Example: head data.txt
 

2. tail Command

Used to display last few lines of a file.
tail filename.txt
  • Example: tail log.txt

3. less Command

Used to read large files page by page.
less filename.txt
Controls:
  • Enter → next line
  • Space → next page
  • q → quit

Module 3: Redirection

1. Output Redirection (>)

Redirect output into a file.
ls > output.txt

2. Error Redirection (2>)

Redirect errors into a file.
Example: ls -z 2> e.txt
Explanation:
  • ls -z → invalid option generates error
  • 2> → redirects error
  • e.txt → stores error message

3. Append Output (>>)

echo "Hello" >> file.txt

Module 4: Pipe & Grep

1. Pipe (|)

Used to send output of one command to another command.
command1 | command2
Example:
ls | grep txt

2. grep Command

Used to search text/pattern.
grep "word" filename
Example: grep "hello" data.txt

Module 5: Arithmetic in Linux

Arithmetic Operations

Loading...

Module 6: File Information Commands

1. stat Command

Displays detailed file information.
stat filename
  • Shows:
    • File size
    • Permissions
    • Access time
    • Modify time
Example: stat data.txt

2. file Command

Identifies file type.
file filename
Example: file image.png

Module 7: Shell Operators

1. Subshell ()

Loading...
Runs commands in separate shell.

2. && Operator

Second command runs only if first command succeeds.
mkdir test && cd test

3. ; Operator

Runs commands one after another regardless of success.
pwd ; ls

4. || Operator

Second command runs only if first command fails.
mkdir test || echo "Failed"

Module 8: Dollar ($) Sign Usage

1. Variable Access

Loading...

2. Command Substitution

Loading...

3. Arithmetic

Loading...

Module 9: Remove (rm) Command

Important: Files deleted using rm do NOT go to recycle bin.

1. Remove Empty Directory

Loading...

2. Recursive Delete

Loading...
Deletes directory and all files inside it.

3. Delete Multiple Files

Loading...
Deletes files:
  • a
  • b
  • c