A comprehensive and well-structured collection of 30 Bash scripts for system task automation, user management, file manipulation, network utilities, remote provisioning, and more. This repository contains useful tools for system administrators, DevOps developers, and Linux enthusiasts working in Linux/Unix environments.
Total Scripts: 30 | Lines of Code: ~1,800–2,400 | Complexity: Basic to Advanced
Note
Modular Documentation: To facilitate navigation and maintenance, each directory in this repository features its own dedicated README.md file, where you will find usage details, command options, and specific examples.
- Features
- Requirements
- Installation
- Script Structure and Categories
- Dependencies
- Patterns and Special Features
- Security Notes
- Usage Examples
- Repository Structure
- License
- 🔐 User Management - System user creation, deletion, and management.
- 📁 File Management - Compression, concatenation, copying, recursive deletion, and searching.
- 🌐 Network Configuration - Management of network interfaces and static IPs.
- 📊 System Monitoring - Disk usage and log analysis.
- 🧮 Educational Algorithms - Fibonacci, master-slave patterns with POSIX communication.
- 🔓 Security Tools - Parallelized dictionary-based password crackers.
- 🔄 Advanced Automation - Interactive menus and file change detection.
- ✅ Robustness - Exhaustive parameter validation, POSIX signal handling, and error handling.
- 💾 Backup & Compression - Password-protected ZIP compression and format conversion.
- 📚 Educational Code - 12 scripts specifically designed for learning Bash.
- Operating System: Linux/Unix (Debian, Ubuntu, CentOS, Fedora, etc.).
- Shell: Bash 4.0 or higher (
bash --versionto check). - Permissions: Regular user for most scripts;
sudo/rootaccess required for:- User creation and deletion.
- Network interface configuration.
- APT package updates.
- Remote server provisioning.
- USB forensic scanning and image mounting.
- Additional Tools (depending on the script):
zip/unzipfor ZIP compression.convert(ImageMagick) for file conversion.python3orpythonfor password crackers.opensslfor password generation.sshpassfor remote server provisioning scripts.ddrescue,clamav,yara, and related forensic tools for USB scanning.- POSIX queue support (
/dev/mqueue) for master-slave scripts (recent kernel).
- Clone this repository:
git clone https://github.com/Esperilla/Bash-Scripting.git
cd Bash-Scripting- Grant execution permissions:
# To a specific script
chmod +x "User_Management/userAdd.sh"
# To all scripts recursively
find . -name "*.sh" -exec chmod +x {} \;
# Or more simply
chmod +x **/*.sh- (Optional) Add the directory to your PATH for global access:
export PATH=$PATH:$(pwd)
# Or add it permanently to your ~/.bashrc
echo "export PATH=\$PATH:$(pwd)" >> ~/.bashrc
source ~/.bashrcTo view installation details, specific usage, and examples for each script, please navigate to the README.md file inside the corresponding folder:
userAdd.sh- Create new users with an automatically generated random password.userDeleter.sh- Safely delete system users and their home directories.userDate.sh- Copy files while appending the current date to the filename and including current user information.
configNetwork/configNetwork.sh- Configure static IPs on network interfaces from a CSV file.percentUse_Disk.sh- Retrieve and analyze disk usage percentages with threshold alerts.updater.sh- Interactive menu for APT package management.cracker/cracker.sh- Dictionary-based password cracker using basic parallelism.cracker/improveCracker.sh- Robust and professional version of the cracker featuring advanced validations.server/confServer.sh- Provision users on multiple remote servers through SSH.server/confServer_v2.sh- Improved server provisioning script with validation and reporting.usbMalware_Scan/usbMalware_Scan.sh- Forensic USB malware analysis and reporting.usbMalware_Scan/usbMalware_Scan_V2.sh- Modular USB forensics scanner with config, logs, and richer reports.
date.sh- Usage examples of variables and date commands.validations.sh- Basic validation of input parameters.fibonacci.sh- Recursive algorithm to calculate the n-th Fibonacci number.count.sh- Count occurrences of a string across multiple files.lastParameter.sh- Retrieve the last positional parameter received by the script.dateFile.sh- Automated file creation with timestamps.attack.sh- Detect files modified within a specific timeframe.logsUse.sh- System monitoring featuring POSIX signal handling.dircontMaster-Slave/- Master-Slave concurrency pattern using POSIX IPC message queues.masterSlave/- Simpler master-slave example using POSIX signals for coordination.
zipCompressor.sh- Recursive ZIP compression with password protection and automated naming.mergeFiles.sh- Merge the contents of two files into a third one.copyMove.sh- Copy or move files and directories with safety validations.recursiveEraser.sh- Recursively delete.txtfiles within a given directory.converter.sh- Automated image conversion using ImageMagick.filesList.sh- Search and list files that match multiple criteria.
| Tool | Scripts Using It | Version | Installation |
|---|---|---|---|
bash |
All | 4.0+ | Usually pre-installed |
openssl |
userAdd.sh | Any | apt install openssl |
zip/unzip |
zipCompressor.sh | Any | apt install zip unzip |
convert |
converter.sh | Any | apt install imagemagick |
python3 |
improveCracker.sh | 3.x | apt install python3 |
python |
cracker.sh | 2.7+ | Usually pre-installed |
git |
Cloning the repository | Any | apt install git |
# Check bash version
bash --version
# Check python version
python3 --version
# Check zip availability
which zip
# Check convert (ImageMagick) version
convert --version
# Install required packages on Ubuntu/Debian
sudo apt update && sudo apt install -y zip unzip imagemagick openssl python3Scripts: Didactic/dircontMaster-Slave/
Implements inter-process communication via POSIX queues (/dev/mqueue/) for parallel processing:
- The master creates jobs and waits for results
- Slaves process tasks in parallel and report back results
- Efficient synchronization without relying on temporary files
bash dircontMaster.sh /dir1 /dir2 /dir3Scripts: Artifacts/cracker/cracker*.sh
Divides tasks among available CPU cores:
# Automatically detects CPUs and splits the workload
nproc # Shows the number of CPUsScript: Didactic/logsUse.sh
Responds to system signals:
SIGUSR1- Pauses/disables monitoringSIGUSR2- Resumes/reactivates monitoringSIGTERM/SIGINT- Cleans up and terminates gracefully
# Run in the background
bash logsUse.sh 10 60 &
# Send signals
kill -USR1 $PID # Pause
kill -USR2 $PID # ResumeScript: Artifacts/updater.sh
Menu-driven user interface leveraging select:
1) Update_Repositories
2) Update_Packages
3) Install_Package
4) Exit
Ejemplo: Artifacts/cracker/improveCracker.sh
- Type checking using regular expressions (regex)
- File existence validation
- Command availability checks
- Step-by-step error handling
| Script | Risk | Recommendation |
|---|---|---|
userAdd.sh |
Generates passwords that MUST be saved | Store them in a secure secrets manager |
userDeleter.sh |
Permanently deletes data | Double-check the username before executing |
configNetwork.sh |
Modifies critical system configuration | Validate the confIP.txt file before use |
cracker*.sh |
Strictly for educational/authorized use | Run only on your own systems or with explicit permission |
logsUse.sh |
Can suspend system services | Test in a non-production environment |
✅ Recommended:
- Use
sudoinstead of running directly as the root user. - Take a backup before executing any deletion scripts.
- Review configuration files carefully before use.
- Run scripts with
-hto view the available help menu. - Validate file permissions (
chmod 644for configuration files).
❌ Avoid:
- Running unfamiliar scripts as root without reviewing their source code.
- Reusing simple or automatically generated passwords across systems.
- Modifying network configurations in production environments without a backup plan.
# Create a user
sudo bash "User_Management/userAdd.sh"
# Follow the interactive promptscd "File_Management"
bash zipCompressor.sh -p -v ~/Documents backup_docs.zip
# You will be securely prompted for a password (without echo)cd Artifacts
# Check usage on /home
bash percentUse_Disk.sh /home
# Expected output if usage is over 80%:
# WARNING! Disk usage is high
# /home: 82%cd "File_Management"
bash filesList.sh /home/user "project bash"
# Finds files containing ALL specified words in their namecd Didactic
# Files modified within the last 300 seconds
bash attack.sh /home 300Bash-Scripting/
├── README.md # This file (general guide)
│
├── User_Management/
│ ├── README.md # User management details
│ ├── userAdd.sh # Create users with a random password
│ ├── userDeleter.sh # Safely delete system users
│ └── userDate.sh # Copy files with user/date timestamp
│
├── Artifacts/
│ ├── README.md # Artifacts and tools details
│ ├── configNetwork/ # Static IP configuration
│ │ ├── configNetwork.sh # Configure static IPs
│ │ └── confIP.txt # Configuration file (example)
│ ├── percentUse_Disk.sh # Disk usage monitoring with alerts
│ ├── updater.sh # Interactive menu for package manager
│ ├── cracker/ # Security tools
│ │ ├── cracker.sh # Basic dictionary cracker
│ │ ├── improveCracker.sh # Robust professional cracker
│ │ └── generalList.txt # Dictionary for testing
│ ├── server/ # Remote provisioning scripts
│ │ ├── confServer.sh # Provision users on multiple servers
│ │ ├── confServer_v2.sh # Provisioning with validation and reporting
│ │ └── servers.conf # Sample server list
│ └── usbMalware_Scan/ # USB forensics scripts
│ ├── usbMalware_Scan.sh # Original forensic scanner
│ ├── usbMalware_Scan_V2.sh # Improved forensic scanner
│ ├── usb_Scan.conf # Configuration file
│ └── USB_SCAN_V2_README.md # Extended documentation
│
├── Didactic/ # Scripts for learning Bash
│ ├── README.md # Educational scripts details
│ ├── date.sh # Date variables usage
│ ├── validations.sh # Parameter validation
│ ├── fibonacci.sh # Recursive algorithm
│ ├── count.sh # File processing
│ ├── lastParameter.sh # Positional parameters
│ ├── dateFile.sh # File creation with timestamps
│ ├── attack.sh # File modification detection
│ ├── logsUse.sh # POSIX signal handling
│ ├── dircontMaster-Slave/ # Master-slave pattern with POSIX IPC
│ │ ├── dircontMaster.sh # Coordinator master process
│ │ └── slave.sh # Worker slave process
│ └── masterSlave/ # Master-slave pattern with POSIX signals
│ ├── master.sh # Coordinator master process
│ └── slave.sh # Worker slave process
│
├── File_Management/
│ ├── README.md # File management details
│ ├── zipCompressor.sh # Password-protected ZIP compression
│ ├── mergeFiles.sh # Merge multiple files
│ ├── copyMove.sh # Copy or move with safety validations
│ ├── recursiveEraser.sh # Recursively delete .txt files
│ ├── converter.sh # Convert image formats (ImageMagick)
│ └── filesList.sh # Search files by multiple criteria
Total: 30 bash scripts | ~1,800–2,400 lines of code | Complexity: Basic to Advanced
| Metric | Value |
|---|---|
| Total scripts | 30 |
| Scripts requiring root | 4 |
| Educational scripts | 12 |
| Average lines of code | ~50–100 |
| Most complex script | usbMalware_Scan_V2.sh / improveCracker.sh |
| Simplest script | date.sh |
| Implemented patterns | 5 (master-slave, parallelism, signals, menus, validations) |
- Official Bash Manual
- ShellCheck - Syntax checker
- POSIX Signals
- Linux File Systems
This project is licensed under the MIT License. Feel free to use it for learning and personal projects.
Last update: July 2026
Maintainer: @Esperilla