1. 📁 File Operations
Objective:
Master basic file and directory operations in Linux.
Basic Commands:
user@linux:~$ pwd
/home/user
user@linux:~$ ls
Documents  Downloads  Desktop
user@linux:~$ ls -la
total 28
drwxr-xr-x  5 user user 4096 Jan 15 10:00 .
drwxr-xr-x  3 root root 4096 Jan 15 09:30 ..
-rw-r--r--  1 user user  220 Jan 15 09:30 .bashrc
drwxr-xr-x  2 user user 4096 Jan 15 10:00 Desktop
drwxr-xr-x  2 user user 4096 Jan 15 10:00 Documents
drwxr-xr-x  2 user user 4096 Jan 15 10:00 Downloads
user@linux:~$ cd Documents
user@linux:~/Documents$ pwd
/home/user/Documents
                   File Viewing:
user@linux:~/Documents$ cat readme.md
# Linux Test
This is a test file.
## Commands
- ls
- cd
- cat
user@linux:~/Documents$ head -5 data.txt
line1
line2
line3
line4
line5
                   File Operations:
user@linux:~/Documents$ touch newfile.txt
File created: newfile.txt
user@linux:~/Documents$ cp readme.md readme_backup.md
Copied: readme.md -> readme_backup.md
user@linux:~/Documents$ mv newfile.txt renamed_file.txt
Moved: newfile.txt -> renamed_file.txt
user@linux:~/Documents$ rm renamed_file.txt
Removed: renamed_file.txt
                   2. 📝 Text Processing
Objective:
Learn powerful text processing commands for data manipulation.
Searching and Filtering:
user@linux:~/Documents$ grep "line2" data.txt
line2
user@linux:~/Documents$ grep -n "line" data.txt
1:line1
2:line2
3:line3
4:line4
5:line5
user@linux:~/Documents$ cat users.csv | grep "John"
John,25,NYC
                   Text Analysis:
user@linux:~/Documents$ wc -l data.txt
       5 data.txt
user@linux:~/Documents$ wc -w readme.md
      15 readme.md
user@linux:~/Documents$ sort data.txt
line1
line2
line3
line4
line5
                   3. 💻 System Information
Objective:
Monitor system resources and gather system information.
Basic System Info:
user@linux:~$ uname -a
Linux linux 5.15.0-72-generic #79-Ubuntu SMP Wed Apr 19 08:22:18 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
user@linux:~$ whoami
user
user@linux:~$ date
Fri Jan 15 15:30:45 UTC 2024
user@linux:~$ uptime
 15:30:45 up 2 days,  5:30,  1 user,  load average: 0.15, 0.20, 0.18
                   System Resources:
user@linux:~$ free -h
               total        used        free      shared  buff/cache   available
Mem:           7.8Gi       2.3Gi       1.2Gi       512Mi       4.3Gi       5.0Gi
Swap:          2.0Gi          0B       2.0Gi
user@linux:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1        20G  8.0G   11G  43% /
/dev/sda2       5.0G  1.0G  3.8G  22% /home
tmpfs           2.0G     0  2.0G   0% /dev/shm
                   Hardware Information:
user@linux:~$ lscpu
Architecture:                    x86_64
CPU op-mode(s):                  32-bit, 64-bit
CPU(s):                          4
Model name:                      Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
CPU MHz:                         1800.000
                   4. ⚙️ Process Management
Objective:
Monitor and manage running processes and system services.
Process Monitoring:
user@linux:~$ ps aux
USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root           1  0.0  0.1 225868  9876 ?        Ss   10:00   0:01 /sbin/init
user        1234  0.0  0.1  21532  5432 pts/0    Ss   10:00   0:00 -bash
user        2345  0.0  0.0  10240  1024 pts/0    R+   10:30   0:00 ps aux
user@linux:~$ top
top - 15:30:45 up 2 days,  5:30,  1 user,  load average: 0.15, 0.20, 0.18
Tasks: 150 total,   1 running, 149 sleeping,   0 stopped,   0 zombie
%Cpu(s):  2.3 us,  1.2 sy,  0.0 ni, 96.1 id,  0.4 wa,  0.0 hi,  0.0 si,  0.0 st
                   Process Control:
user@linux:~$ jobs
[1]+ Running    sleep 100 &
user@linux:~$ kill 1234
Process 1234 terminated
user@linux:~$ killall firefox
All firefox processes terminated
                   5. 🌐 Network Commands
Objective:
Test network connectivity and monitor network interfaces.
Connectivity Tests:
user@linux:~$ ping google.com
PING google.com (142.250.191.14) 56(84) bytes of data.
64 bytes from google.com: icmp_seq=1 ttl=64 time=0.045 ms
64 bytes from google.com: icmp_seq=2 ttl=64 time=0.041 ms
^C
--- google.com ping statistics ---
2 packets transmitted, 2 received, 0% packet loss
user@linux:~$ wget http://example.com/file.txt
--2024-01-15 15:30:45--  http://example.com/file.txt
Resolving example.com... 93.184.216.34
Connecting to example.com|93.184.216.34|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1024 (1.0K) [text/plain]
Saving to: 'file.txt'
                   Network Configuration:
user@linux:~$ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
       inet 192.168.1.10  netmask 255.255.255.0  broadcast 192.168.1.255
       ether 08:00:27:4e:66:a1  txqueuelen 1000  (Ethernet)
user@linux:~$ netstat -l
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 127.0.0.1:22            0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN
                   6. 📦 Archive Operations
Objective:
Create and extract compressed archives for file management.
Creating Archives:
user@linux:~/Documents$ tar -czf backup.tar.gz *.txt
Archive operation: -czf backup.tar.gz *.txt
user@linux:~/Documents$ zip archive.zip *.md
adding: readme.md (deflated 50%)
user@linux:~/Documents$ gzip data.txt
GZIP operation: data.txt
                   Extracting Archives:
user@linux:~/Documents$ tar -xzf backup.tar.gz
Archive operation: -xzf backup.tar.gz
user@linux:~/Documents$ unzip archive.zip
Archive:  archive.zip
 inflating: readme.md
user@linux:~/Documents$ gunzip data.txt.gz
GUNZIP operation: data.txt.gz
                   7. 🔐 Permissions and Security
Objective:
Manage file permissions and user access controls.
Permission Management:
user@linux:~/Documents$ ls -la script.sh
-rw-r--r-- 1 user user 1024 Jan 15 10:00 script.sh
user@linux:~/Documents$ chmod +x script.sh
Permissions changed: +x script.sh
user@linux:~/Documents$ chmod 755 script.sh
Permissions changed: 755 script.sh
user@linux:~/Documents$ chown user:user script.sh
Ownership changed: user:user script.sh
                   Sudo Operations:
user@linux:~$ sudo apt update
[sudo] password for user: 
Reading package lists... Done
Building dependency tree... Done
user@linux:~$ su -
Password: 
                   8. 📦 Package Management
Objective:
Install, update, and remove software packages using apt.
Package Operations:
user@linux:~$ sudo apt update
Hit:1 http://archive.ubuntu.com/ubuntu jammy InRelease
Get:2 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [119 kB]
Fetched 229 kB in 2s (114 kB/s)
Reading package lists... Done
user@linux:~$ sudo apt install htop
Reading package lists... Done
Building dependency tree... Done
The following NEW packages will be installed:
 htop
Need to get 123 kB of archives.
After this operation, 456 kB will be used.
user@linux:~$ apt search editor
Sorting... Done
Full Text Search... Done
nano/jammy 6.2-1 amd64
 small, friendly text editor
                   Package Information:
user@linux:~$ dpkg -l | grep git
ii  git              1:2.34.1-1ubuntu1.9 amd64        fast, scalable, distributed revision control system
user@linux:~$ which git
/usr/bin/git
                   9. 🌍 Environment Variables
Objective:
Manage environment variables and shell configuration.
Environment Commands:
user@linux:~$ env
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
HOME=/home/user
USER=user
SHELL=/bin/bash
TERM=xterm-256color
LANG=en_US.UTF-8
user@linux:~$ export EDITOR=nano
Exported: EDITOR=nano
user@linux:~$ alias ll='ls -la'
Alias set: ll='ls -la'
                   Shell History:
user@linux:~$ history
   1  ls
  2  cd Documents
  3  cat readme.md
  4  ps aux
user@linux:~$ history -c
History cleared
                   10. ✏️ Text Editors
Objective:
Use different text editors for file editing tasks.
Nano Editor:
user@linux:~$ nano readme.txt
GNU nano 6.2    readme.txt
[ File content would appear here ]
[ This is a simulation of nano editor ]
[ Press Ctrl+X to exit ]
^G Get Help  ^O Write Out ^W Where Is  ^K Cut Text
^X Exit      ^R Read File ^\\ Replace   ^U Paste
                   Vim Editor:
user@linux:~$ vim document.txt
VIM - Vi IMproved 8.2
~                              VIM - Vi IMproved
~                               version 8.2.3458
~        type  :q<Enter>               to exit
~        type  :help<Enter>  or  <F1>  for on-line help
"document.txt" [New File]
-- INSERT --
                   11. 🔍 Essential Show Commands
System Monitoring:
user@linux:~$ ps aux          # Process list
user@linux:~$ free -h         # Memory usage
user@linux:~$ df -h           # Disk usage
user@linux:~$ top             # Real-time processes
user@linux:~$ lscpu           # CPU information
user@linux:~$ lsblk           # Block devices
user@linux:~$ mount           # Mounted filesystems
user@linux:~$ uptime          # System uptime
user@linux:~$ whoami          # Current user
user@linux:~$ id              # User ID info
                  Network Information:
user@linux:~$ ifconfig        # Network interfaces
user@linux:~$ ip addr show    # IP addresses
user@linux:~$ ip route show   # Routing table
user@linux:~$ netstat -l     # Listening ports
user@linux:~$ ss -tuln       # Socket statistics
user@linux:~$ ping 8.8.8.8   # Test connectivity
                  File System Information:
user@linux:~$ ls -la          # Detailed file listing
user@linux:~$ du -sh *        # Directory sizes
user@linux:~$ find / -name "*.conf" # Find config files
user@linux:~$ locate filename # Locate files
user@linux:~$ file /bin/ls    # File type
user@linux:~$ stat filename   # File statistics
                  12. ✨ Advanced Features and Enhancements
🆕 Enhanced File Operations
- ls -la - Detailed file listing with colors
- find - Advanced file searching
- tree - Directory tree visualization
- file - File type detection
- stat - Detailed file information
- du -sh - Human-readable disk usage
🔧 Text Processing Power
- grep -n - Line numbers in search results
- awk - Advanced text processing
- sed - Stream editor for filtering
- sort - Sorting with multiple options
- uniq - Remove duplicate lines
- cut - Extract columns from text
⚙️ System Monitoring
- ps aux - Detailed process information
- top - Real-time system monitor
- htop - Enhanced process viewer
- free -h - Human-readable memory info
- lscpu - CPU architecture details
- lsblk - Block device tree
🌐 Network Tools
- ping - Network connectivity testing
- wget/curl - File downloading
- ssh - Secure shell connections
- netstat - Network statistics
- ifconfig - Network interface config
- ip - Advanced network management
📦 Package Management
- apt update - Update package lists
- apt install - Install packages
- apt search - Search for packages
- dpkg -l - List installed packages
- snap - Universal package manager
- which - Locate commands
🔐 Security Features
- chmod - Change file permissions
- chown - Change file ownership
- sudo - Execute as superuser
- passwd - Change user password
- su - Switch user account
- id - Display user and group IDs
🎯 Realistic Test Scenarios
You can now run these comprehensive scenarios:
1. System Administration Scenario:
user@linux:~$ sudo apt update
user@linux:~$ sudo apt install htop
user@linux:~$ htop
user@linux:~$ systemctl status nginx
user@linux:~$ ps aux | grep nginx
                  2. File Management Scenario:
user@linux:~$ find /home -name "*.log" -type f
user@linux:~$ tar -czf backup_$(date +%Y%m%d).tar.gz Documents/
user@linux:~$ chmod 644 *.txt
user@linux:~$ chown user:user backup_*.tar.gz
                  3. Network Troubleshooting:
user@linux:~$ ping -c 4 google.com
user@linux:~$ traceroute google.com
user@linux:~$ netstat -tuln | grep :80
user@linux:~$ ss -s
                  4. Text Processing Pipeline:
user@linux:~$ cat /var/log/syslog | grep error | tail -10
user@linux:~$ ps aux | awk '{print $1, $2, $11}' | sort
user@linux:~$ df -h | grep -v tmpfs | sort -k5 -nr
                  🔧 Interactive Features
- • Command History: Up/down arrows to navigate previous commands
- • Tab Completion: Auto-complete commands and file names
- • Aliases: Built-in shortcuts like ll, la, l for ls variations
- • Pipe Support: Chain commands with | for complex operations
- • Redirection: Use > and >> to redirect output to files
- • Realistic File System: Complete directory structure with sample files
💡 Learning Tips
- 📚 Start Simple: Begin with basic commands like ls, cd, pwd
- 🔗 Use Pipes: Combine commands with | to create powerful workflows
- 📖 Read Man Pages: Use man command to learn about any command
- ⚡ Practice Regularly: The more you use these commands, the easier they become
- 🎯 Learn Shortcuts: Master aliases and keyboard shortcuts for efficiency
🎯 Summary
This Linux Bash simulator now provides a comprehensive terminal experience! With 150+ commands, realistic file system, and advanced features like pipes and redirection, it's the perfect tool for learning Linux system administration and command-line skills.