Module 1: Standard Input, Output, and Error
- 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.txtControls:
Enter→ next line
Space→ next page
q→ quit
Module 3: Redirection
1. Output Redirection (>)
Redirect output into a file.
ls > output.txt2. Error Redirection (2>)
Redirect errors into a file.
Example:
ls -z 2> e.txtExplanation:
ls -z→ invalid option generates error
2>→ redirects error
e.txt→ stores error message
3. Append Output (>>)
echo "Hello" >> file.txtModule 4: Pipe & Grep
1. Pipe (|)
Used to send output of one command to another command.
command1 | command2Example:
ls | grep txt2. grep Command
Used to search text/pattern.
grep "word" filenameExample:
grep "hello" data.txtModule 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.txt2. file Command
Identifies file type.
file filename Example:
file image.pngModule 7: Shell Operators
1. Subshell ()
Loading...Runs commands in separate shell.
2. && Operator
Second command runs only if first command succeeds.
mkdir test && cd test3. ; Operator
Runs commands one after another regardless of success.
pwd ; ls4. || 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 usingrmdo 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
.jpg?table=block&id=29d76b1d-f1a8-8072-a9bf-cc78d1c7d881&cache=v2)