An open API service indexing awesome lists of open source software.

https://github.com/miladev95/shell-scripts

Small and useful shell scripts
https://github.com/miladev95/shell-scripts

bash bash-script shell shell-script

Last synced: 2 months ago
JSON representation

Small and useful shell scripts

Awesome Lists containing this project

README

          

# My Useful Shell Scripts

A collection of useful bash scripts for various system tasks, file operations, and utilities.

## Table of Contents
- [Color Display](#color-display)
- [File Extractor](#file-extractor)
- [Number Converters](#number-converters)
- [Persian Plate Finder](#persian-plate-finder)
- [Weather Report](#weather-report)
- [File Renamer](#file-renamer)
- [Abbreviation Lookup](#abbreviation-lookup)
- [System Information](#system-information)
- [Network Information Collector](#network-information-collector)
- [Input Validation](#input-validation)

---

## Color Display
Display colorful text animations in the terminal.

**Location:** `color.sh`

**Usage:**
```bash
./color.sh
```

**Description:** Displays the word "LOVE" in different colors with a 1-second delay between each color.

---

## File Extractor
Extract various compressed file formats with a single command.

**Location:** `extractor/extractor.sh`

**Usage:**
```bash
./extractor/extractor.sh
```

**Examples:**
```bash
./extractor/extractor.sh mar-tools-linux32.zip
./extractor/extractor.sh archive.tar.gz
./extractor/extractor.sh data.7z
```

**Supported formats:** tar, tar.gz, tar.bz2, tar.xz, zip, rar, 7z, gz, bz2, dmg, pax, and more.

---

## Number Converters
Convert numbers between different numeral systems.

**Location:** `converters/`

### Binary to Decimal
**Usage:**
```bash
./converters/binary2decimal.sh
# Enter a binary number when prompted
```

**Example:**
```bash
./converters/binary2decimal.sh
Enter a number:
1010
10
```

### Decimal to Binary
**Usage:**
```bash
./converters/decimal2binary.sh [number2] [number3] ...
```

**Example:**
```bash
./converters/decimal2binary.sh 10 25 100
```

### Decimal to Hexadecimal
**Usage:**
```bash
./converters/dec2hex.sh
```

**Example:**
```bash
./converters/dec2hex.sh 255
0xff
```

### Hexadecimal to Decimal
**Usage:**
```bash
./converters/hextodec.sh
```

**Example:**
```bash
./converters/hextodec.sh 0xff
255
```

---

## Persian Plate Finder
Find Iranian car plate information by plate number and letter.

**Location:** `plate-finder/plate-finder.sh`

**Usage:**
```bash
./plate-finder/plate-finder.sh [letter]
./plate-finder/plate-finder.sh -h # For help
```

**Examples:**
```bash
./plate-finder/plate-finder.sh 78 ن
./plate-finder/plate-finder.sh 61 ج
./plate-finder/plate-finder.sh 78 # Search by number only
```

**Note:** Requires `plate.txt` file in the same directory.

---

## Weather Report
Get weather information for any location using wttr.in service.

**Location:** `weather/weather.sh`

**Usage:**
```bash
./weather/weather.sh # Default location
./weather/weather.sh -l # Specific location
./weather/weather.sh --location # Specific location
./weather/weather.sh -h # Help
```

**Examples:**
```bash
./weather/weather.sh --location tehran
./weather/weather.sh -l london
./weather/weather.sh -l "new york"
```

---

## File Renamer
Rename all files and directories in the current directory by adding a prefix or replacing text.

**Location:** `renamer/renamer.sh`

**Usage:**
```bash
./renamer/renamer.sh # Add prefix to all files
./renamer/renamer.sh # Replace text in filenames
./renamer/renamer.sh -h # Help
```

**Examples:**
```bash
./renamer/renamer.sh python_ # Add "python_" prefix to all files
./renamer/renamer.sh test_ prod_ # Replace "test_" with "prod_" in all filenames
```

**Warning:** Use with caution! Always backup your files before running this script.

---

## Abbreviation Lookup
Look up computer science abbreviations and their meanings.

**Location:** `abbreviation/abbreviation.sh`

**Usage:**
```bash
./abbreviation/abbreviation.sh
```

**Examples:**
```bash
./abbreviation/abbreviation.sh csrf
./abbreviation/abbreviation.sh www
./abbreviation/abbreviation.sh api
```

**Note:** Requires `abbreviation.txt` file with abbreviation definitions in the same directory.

---

## System Information
Get detailed system information through interactive menus.

**Location:** `sys-info/`

### Menu-Driven System Info
**Usage:**
```bash
./sys-info/menu-driven-sys-info.sh
```

**Features:**
- Display system information (hostname, uptime)
- Display disk space usage
- Display home directory space utilization
- Interactive menu interface

### Hardware Machine Info
**Usage:**
```bash
./sys-info/hardware-machine.sh
```

**Features:**
- Check desktop processor
- Verify system kernel
- List installed software
- Check OS version
- Verify desktop memory
- Check serial number
- Verify system IP
- Interactive menu interface

---

## Network Information Collector
Collect comprehensive network configuration and save to a file.

**Location:** `networkinfo/collectnetworkinfo.sh`

**Usage:**
```bash
sudo ./networkinfo/collectnetworkinfo.sh
```

**Description:** Collects detailed network information including:
- Network interfaces configuration
- Routing tables
- Firewall rules
- DNS configuration
- Network driver information

**Output:** Creates a file named `network.[date].info.txt` with all collected information.

**Note:** Requires root privileges to run.

---

## Input Validation
Validate user input to ensure it contains only alphanumeric characters.

**Location:** `validations/number-letter-validation.sh`

**Usage:**
```bash
./validations/number-letter-validation.sh
# Enter input when prompted
```

**Description:** Validates that input consists only of letters (a-z, A-Z) and numbers (0-9).

---

## Requirements

Most scripts require:
- Bash shell (version 4.0+)
- Standard Unix utilities (sed, awk, cut, etc.)

Some scripts may require additional tools:
- `curl` - for weather.sh
- `7z` - for extracting .rar and .7z files
- Root access - for network information collector

## Installation

1. Clone or download this repository
2. Make scripts executable:
```bash
chmod +x **/*.sh
chmod +x color.sh
```

3. Run any script using the instructions above

## Contributing

Feel free to contribute by adding new scripts or improving existing ones!

## License

Free to use and modify.