Here’s a comprehensive learning syllabus for Unix/Linux commands, tailored for beginners to intermediate learners:
Week 1: Introduction to Unix/Linux and Basic Commands
Day 1: Overview of Unix/Linux
- What is Unix/Linux?
- Basic structure: Kernel, Shell, and File System
- Types of Unix/Linux distributions
Day 2: Getting Started
- Logging into a Unix/Linux system
- Understanding the command-line interface
- File and directory structure
Day 3: Basic File and Directory Management
pwd
– Print working directoryls
– List directory contentscd
– Change directoriesmkdir
– Create directoriesrmdir
– Remove empty directoriestouch
– Create an empty file
Day 4: Viewing and Manipulating Files
cat
– View file contentsless
,more
– Paginated file viewingcp
– Copy filesmv
– Move/rename filesrm
– Delete files
Day 5: File Permissions
- File ownership and permissions
chmod
– Change permissionschown
– Change ownershipls -l
– Detailed listing with permissions
Week 2: Intermediate Commands and System Navigation
Day 6: Searching and Finding Files
find
– Search for fileslocate
– Quickly locate fileswhich
– Locate executablesgrep
– Search within files
Day 7: Managing Processes
ps
– View active processestop
– Real-time process monitoringkill
,killall
– Terminate processesbg
,fg
,jobs
– Background and foreground processes
Day 8: File Compression and Archiving
tar
– Archive filesgzip
,gunzip
– Compress and decompress fileszip
,unzip
– File compression and extraction
Day 9: Networking Commands
ping
– Test network connectivitycurl
,wget
– Download files and interact with URLsnetstat
,ss
– View network connections
Day 10: Disk Usage and Space Management
df
– Display disk space usagedu
– Show directory space usagemount
,umount
– Mount/Unmount file systems
Week 3: Advanced Commands and Scripting Basics
Day 11: Text Processing
head
,tail
– View beginning and end of filescut
,awk
,sed
– Advanced text processingsort
,uniq
– Sorting and deduplicationwc
– Word, line, and byte count
Day 12: User and Group Management
who
,whoami
,id
– User informationadduser
,deluser
– Add/remove userspasswd
– Change passwordsgroups
– Display user groups
Day 13: Package Management
- For Debian/Ubuntu:
apt-get
,apt
- For Red Hat/CentOS:
yum
,dnf
rpm
– Manage individual packages
Day 14: Introduction to Shell Scripting
- What is a shell script?
- Writing and executing basic scripts
- Using variables, loops (
for
,while
), and conditions (if
,case
)
Week 4: System Administration and Best Practices
Day 15: System Monitoring
uptime
,dmesg
– System uptime and messagesvmstat
,iostat
– CPU and I/O statisticsfree
– Check memory usage
Day 16: Scheduling Tasks
cron
,crontab
– Automating tasksat
– Schedule one-time jobs
Day 17: Logs and Troubleshooting
tail -f
– Monitor log files- System log locations (
/var/log
) journalctl
– System logs for systemd
Day 18: Permissions and Security
sudo
– Execute commands as another user- Securing SSH (
ssh
,scp
,ssh-keygen
) - Understanding and managing firewalls (
ufw
,iptables
)
Day 19: Version Control
- Basics of
git
for version control - Common commands:
init
,clone
,add
,commit
,push
,pull
Day 20: Review and Practical Exercises
- Practice exercises for all commands learned
- Troubleshooting common scenarios
- Explore man pages (
man
) and help options (--help
)
Resources for Learning
Books:
- “The Linux Command Line” by William Shotts
- “Linux Pocket Guide” by Daniel J. Barrett
Online Platforms:
- Codecademy: Linux Command Line Basics
- Udemy: Linux for Beginners
- Linux Foundation Training (free courses)
Practice Tools:
- Use a virtual machine (e.g., VirtualBox with Ubuntu)
- Online terminals: JSLinux or Linux Containers
Here’s a detailed day-by-day exercise plan to complement the syllabus
Week 1: Introduction to Unix/Linux and Basic Commands
Day 1: Overview of Unix/Linux
- Explore your Unix/Linux distribution (use
uname -a
). - Open the terminal and familiarize yourself with it.
Day 2: Getting Started
- Practice logging into a Unix/Linux system.
- Use
pwd
to check your current working directory. - Use
ls
to view directory contents.
Day 3: Basic File and Directory Management
- Create a directory called
my_test
. - Navigate to the new directory with
cd my_test
. - Create an empty file named
file1.txt
withtouch
. - Practice creating multiple directories (
mkdir dir1 dir2
). - Remove an empty directory with
rmdir
.
Day 4: Viewing and Manipulating Files
- Use
cat
to create a file with some text (cat > file1.txt
). - View the contents of
file1.txt
usingcat
,less
, andmore
. - Copy
file1.txt
to a new filefile2.txt
(cp file1.txt file2.txt
). - Rename
file2.txt
tofile3.txt
(mv file2.txt file3.txt
). - Delete
file3.txt
withrm
.
Day 5: File Permissions
- Create a file
permission_test.txt
. - Check its permissions with
ls -l
. - Change its permissions to make it read-only (
chmod 444 permission_test.txt
). - Try editing the file to see the effect of permissions.
Week 2: Intermediate Commands and System Navigation
Day 6: Searching and Finding Files
- Use
find
to locate all.txt
files in the current directory. - Try
locate
to find a file by name (e.g.,locate bash
). - Use
grep
to search for the word “Linux” in a file.
Day 7: Managing Processes
- View running processes using
ps
andtop
. - Open multiple terminal sessions, run
sleep 1000
, and manage them withjobs
. - Terminate one of the running processes using
kill
.
Day 8: File Compression and Archiving
- Create an archive of the
my_test
directory usingtar
(tar -cvf my_test.tar my_test
). - Compress the archive with
gzip
(gzip my_test.tar
). - Uncompress it using
gunzip
.
Day 9: Networking Commands
- Use
ping google.com
to test internet connectivity. - Download a file using
curl
orwget
. - Check active network connections with
netstat
orss
.
Day 10: Disk Usage and Space Management
- Check your disk usage with
df -h
. - List the sizes of files in the current directory using
du -sh *
. - Mount a USB drive and check its mount point with
mount
.
Week 3: Advanced Commands and Scripting Basics
Day 11: Text Processing
- Create a text file with multiple lines and practice:
- View the first 5 lines (
head -n 5
). - View the last 3 lines (
tail -n 3
). - Extract specific columns using
cut
.
- View the first 5 lines (
- Use
awk
to print the first column of a file. - Practice replacing text in a file using
sed
.
Day 12: User and Group Management
- Check your user information with
whoami
andid
. - Create a new user using
sudo adduser testuser
. - Add a new group and assign the user to it.
Day 13: Package Management
- Update your package list (
sudo apt update
orsudo yum check-update
). - Install a sample package (e.g.,
sudo apt install tree
). - Remove the package (
sudo apt remove tree
).
Day 14: Introduction to Shell Scripting
- Write a basic script:
#!/bin/bash echo "Hello, World!"
- Execute it (
chmod +x script.sh && ./script.sh
). - Create a script with a loop to print numbers 1 to 5.
Week 4: System Administration and Best Practices
Day 15: System Monitoring
- Check your system uptime with
uptime
. - View system logs with
dmesg | less
. - Use
free
to check memory usage.
Day 16: Scheduling Tasks
- Create a cron job to display “Hello” every minute.
crontab -e * * * * * echo "Hello" >> ~/cron_test.log
- Verify the job is running by checking the log file.
Day 17: Logs and Troubleshooting
- Locate system logs in
/var/log
(e.g.,ls /var/log
). - Use
tail -f /var/log/syslog
to monitor logs in real time.
Day 18: Permissions and Security
- Create an SSH key pair (
ssh-keygen
) and practice connecting to a remote machine. - Configure and enable a firewall using
ufw
.
Day 19: Version Control
- Initialize a Git repository:
git init echo "My first file" > file1.txt git add file1.txt git commit -m "Initial commit"
- Create a new branch and merge it into the main branch.
Day 20: Review and Practical Exercises
- Solve these challenges:
- Find all
.log
files in the/var/log
directory. - Write a script to back up a directory.
- Compress a file and upload it to a remote server using
scp
.
- Find all
- Share your completed exercises with a mentor or peer for review.
This syllabus ensures hands-on practice while covering all the essentials.
Here's a breakdown with example scripts and deeper explanations for each section of the syllabus:
Week 1: Introduction to Unix/Linux and Basic Commands
Day 3: Basic File and Directory Management
- Script Example:
#!/bin/bash echo "Creating directories..." mkdir -p my_test/dir1 echo "Creating files..." touch my_test/dir1/file1.txt my_test/dir1/file2.txt echo "Listing directory contents..." ls -R my_test
Day 4: Viewing and Manipulating Files
Deeper Explanation:
cat
displays file contents. Use>
,>>
to write/append:cat > file1.txt Hello, Unix/Linux! # Type your content Ctrl+D # Save and exit
less
/more
display files one screen at a time.
Script Example:
#!/bin/bash echo "Creating a sample file..." echo -e "Line1\nLine2\nLine3" > sample.txt echo "Displaying the file:" cat sample.txt
Week 2: Intermediate Commands and System Navigation
Day 6: Searching and Finding Files
- Script Example:
#!/bin/bash echo "Searching for .txt files in the current directory..." find . -type f -name "*.txt" echo "Searching for the word 'Hello' in sample.txt..." grep "Hello" sample.txt
Day 7: Managing Processes
Deeper Explanation:
- Use
ps aux
to view processes. - Kill a process by ID (
kill <PID>
). jobs
,bg
,fg
manage background/foreground tasks.
- Use
Example:
# Run a long process in the background sleep 1000 & echo "Background process ID: $!" jobs
Day 9: Networking Commands
- Deeper Explanation:
ping
checks connectivity.curl
fetches data from a URL.curl -O https://example.com/sample.txt # Download file
Week 3: Advanced Commands and Scripting Basics
Day 11: Text Processing
- Script Example:
#!/bin/bash echo -e "Name,Age\nAlice,30\nBob,25" > data.csv echo "Extracting the first column using cut:" cut -d, -f1 data.csv echo "Sorting data:" sort data.csv echo "Counting lines:" wc -l data.csv
Day 14: Introduction to Shell Scripting
Deeper Explanation:
- Start scripts with
#!/bin/bash
. - Use variables:
name="Linux Learner" echo "Hello, $name!"
- Start scripts with
Script Example:
#!/bin/bash for i in {1..5}; do echo "Iteration $i" done
Week 4: System Administration and Best Practices
Day 16: Scheduling Tasks
- Deeper Explanation:
crontab -e
edits cron jobs. Format:* * * * * command_to_run
- Example: Add a cron job to back up files daily:
0 0 * * * tar -czf backup.tar.gz /path/to/files
Day 19: Version Control
- Script Example:
#!/bin/bash echo "Initializing a Git repository..." git init echo "Creating a new file..." echo "My first Git file" > file1.txt git add file1.txt git commit -m "Initial commit" echo "Repository setup complete."
Hands-On Challenges
Here are practical exercises combining multiple concepts:
File Backup Script:
#!/bin/bash SRC="/path/to/source" DEST="/path/to/backup" DATE=$(date +%Y%m%d) BACKUP_FILE="backup_$DATE.tar.gz" echo "Backing up $SRC to $DEST/$BACKUP_FILE..." tar -czf "$DEST/$BACKUP_FILE" "$SRC" echo "Backup complete!"
Monitoring and Logging Script:
#!/bin/bash LOG_FILE="system_usage.log" echo "Logging system usage to $LOG_FILE..." echo "Timestamp: $(date)" >> $LOG_FILE echo "Disk Usage:" >> $LOG_FILE df -h >> $LOG_FILE echo "Memory Usage:" >> $LOG_FILE free -h >> $LOG_FILE echo "----------------------" >> $LOG_FILE
Find and Archive Files Script:
#!/bin/bash DIR="/path/to/search" ARCHIVE_NAME="archive.tar.gz" echo "Finding .log files in $DIR..." find "$DIR" -type f -name "*.log" -exec tar -czf "$ARCHIVE_NAME" {} + echo "Archived files into $ARCHIVE_NAME"