0% found this document useful (0 votes)
6 views4 pages

Unix Commands

The document provides an expanded reference for essential Linux commands, detailing various options, variations, and practical examples for each command. It covers commands such as `ls`, `cd`, `cat`, `rm`, and more, offering insights into their usage and functionalities. Additionally, it invites the reader to continue with more commands or organize the information into an interactive format.

Uploaded by

bhavanamn1234
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views4 pages

Unix Commands

The document provides an expanded reference for essential Linux commands, detailing various options, variations, and practical examples for each command. It covers commands such as `ls`, `cd`, `cat`, `rm`, and more, offering insights into their usage and functionalities. Additionally, it invites the reader to continue with more commands or organize the information into an interactive format.

Uploaded by

bhavanamn1234
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

Absolutely, Bhavana!

Let's supercharge your Linux command reference with **expanded


subcases** for each command—covering more options, variations, and practical
examples. This will be like your personal command-line encyclopedia 📘.

---

## 🧠 Expanded Linux Command Reference (Top Commands with Subcases)

### 📁 `ls` – List directory contents


```bash
ls # List files
ls -a # Include hidden files
ls -l # Long listing format
ls -lh # Long listing with human-readable sizes
ls -la # Long listing including hidden files
ls -ltr # Sort by time, reverse order
ls -R # Recursive listing
ls -d */ # List only directories
ls -1 # One file per line
ls -F # Classify file types with symbols
ls -i # Show inode numbers
ls -S # Sort by file size
ls -t # Sort by modification time
ls -X # Sort by extension
ls --color=auto # Enable color output
ls -l --time-style=long-iso # Custom time format
```

---

### 📂 `cd` – Change directory


```bash
cd /path/to/dir # Go to specific directory
cd .. # Move up one level
cd - # Go to previous directory
cd ~ # Go to home directory
cd ~/Documents # Go to Documents in home
cd ../.. # Move up two levels
```

---

### 📄 `cat` – View file contents


```bash
cat file.txt # Show contents
cat file1 file2 # Concatenate files
cat -n file.txt # Show line numbers
cat -b file.txt # Number non-blank lines
cat -s file.txt # Suppress repeated empty lines
```

---

### 🧹 `rm` – Remove files or directories


```bash
rm file.txt # Delete file
rm -i file.txt # Prompt before deleting
rm -r folder/ # Delete folder recursively
rm -rf folder/ # Force delete folder and contents
rm -v file.txt # Verbose output
rm --preserve-root -rf / # Prevent root deletion
```

---

### 🧼 `rmdir` – Remove empty directories


```bash
rmdir empty_dir/ # Remove empty directory
rmdir -p a/b/c # Remove nested empty directories
```

---

### 📦 `cp` – Copy files and directories


```bash
cp file1 file2 # Copy file1 to file2
cp -r dir1 dir2 # Copy directory recursively
cp -i file1 file2 # Prompt before overwrite
cp -u file1 file2 # Copy only if source is newer
cp -v file1 file2 # Verbose output
```

---

### 🚚 `mv` – Move or rename


```bash
mv old.txt new.txt # Rename file
mv file.txt /path/ # Move file to path
mv -i file1 file2 # Prompt before overwrite
mv -v file1 file2 # Verbose output
```

---

### 📝 `touch` – Create empty files


```bash
touch new.txt # Create new file
touch file{1..5}.txt # Create multiple files
touch -c file.txt # Do not create if missing
```

---

### 🔍 `find` – Search for files


```bash
find . -name "*.txt" # Find all .txt files
find / -type d -name "log" # Find directories named log
find . -size +1M # Files larger than 1MB
find . -mtime -7 # Modified in last 7 days
find . -user bhavana # Files owned by user
find . -perm 755 # Files with specific permissions
```

---

### 🔎 `grep` – Search inside files


```bash
grep "error" file.txt # Search for 'error'
grep -i "error" file.txt # Case-insensitive
grep -r "error" /path/ # Recursive search
grep -n "error" file.txt # Show line numbers
grep -v "error" file.txt # Show lines NOT matching
grep -c "error" file.txt # Count matches
```

---

### 🔐 `chmod` – Change permissions


```bash
chmod +x script.sh # Make script executable
chmod 755 file.sh # Set rwxr-xr-x
chmod u+rwx file.txt # Add all permissions to user
chmod g=r file.txt # Group read-only
chmod o-rwx file.txt # Remove all from others
```

---

### 👤 `chown` – Change ownership


```bash
chown user file.txt # Change owner
chown user:group file.txt # Change owner and group
chown -R user:group folder/ # Recursive ownership change
```

---

### 📅 `date` – Show current date/time


```bash
date # Current date/time
date "+%Y-%m-%d %H:%M:%S" # Custom format
date -u # UTC time
```

---

### 📆 `cal` – Show calendar


```bash
cal # Current month
cal 07 2025 # July 2025
cal -y # Full year calendar
```

---

### 🧠 `man` – Manual pages


```bash
man ls # Manual for ls
man -k search # Search manual pages
```

---

### 🧭 `pwd` – Print working directory


```bash
pwd # Show current path
```
---

### `whoami` – Show current user


```bash
whoami # Display username
```

---

### 🧮 `echo` – Print text


```bash
echo "Hello, Bhavana!" # Output text
echo $PATH # Show environment variable
```

---

### 🧰 `top` – Live process viewer


```bash
top # Show running processes
top -u bhavana # Show user-specific processes
```

---

### 🧾 `ps` – Show processes


```bash
ps # Current shell processes
ps aux # All processes
ps -ef # Full-format listing
```

---

### 🛑 `kill` – Terminate process


```bash
kill 1234 # Kill process by PID
kill -9 1234 # Force kill
kill -l # List signal names
```

---

Would you like me to continue with the next batch of commands like `tar`, `zip`,
`scp`, `ssh`, `awk`, `sed`, `df`, `du`, `alias`, `wget`, `curl`, and more? Or
should I organize this into a **Copilot Page** so you can interactively study and
add your own notes?

Let’s make this your ultimate Linux command arsenal 💪🔥.

You might also like