Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
a7273dc
refactor(structure): reorganize root scripts into scripts/ directory
ashishsinghbora Sep 24, 2026
0220d2f
feat(system): add system-health check utility
ashishsinghbora Sep 24, 2026
661bd76
feat(system): add kernel-info module and inspection
ashishsinghbora Sep 24, 2026
34483e3
feat(system): add boot-info startup analysis
ashishsinghbora Sep 24, 2026
1e3f774
feat(system): add failed-services monitor
ashishsinghbora Sep 24, 2026
b0d8f44
feat(storage): add find-large-files utility
ashishsinghbora Sep 24, 2026
b15da2f
feat(storage): add directory-size space calculator
ashishsinghbora Sep 24, 2026
f36fe39
feat(storage): add inode-usage monitor and alerts
ashishsinghbora Sep 24, 2026
dc67db5
feat(storage): add mount-info filesystem inspector
ashishsinghbora Sep 24, 2026
18cee10
feat(storage): add filesystem-info block inspector
ashishsinghbora Sep 24, 2026
4573a79
feat(storage): add disk-health SMART diagnostics
ashishsinghbora Sep 24, 2026
3444bbc
feat(network): add ping-test and latency checker
ashishsinghbora Sep 24, 2026
2a25a02
feat(network): add dns-test lookup tool
ashishsinghbora Sep 24, 2026
1f02e86
feat(network): add port-check TCP connection test
ashishsinghbora Sep 24, 2026
b9b6a3f
feat(network): add route-info kernel routing table viewer
ashishsinghbora Sep 24, 2026
12c8013
feat(network): add internet-test WAN connectivity tool
ashishsinghbora Sep 24, 2026
febba46
feat(network): add listening-ports socket audit
ashishsinghbora Sep 24, 2026
d33b6c6
feat(network): add network-diagnostics end-to-end suite
ashishsinghbora Sep 24, 2026
516565b
feat(process): add process-info top resource inspector
ashishsinghbora Sep 24, 2026
38a0ac2
feat(process): add kill-process safe termination tool
ashishsinghbora Sep 24, 2026
8b55789
feat(packages): add install-package with confirmation
ashishsinghbora Sep 24, 2026
6c431b5
feat(packages): add remove-package with safety checks
ashishsinghbora Sep 24, 2026
586e3fe
feat(packages): add search-package tool
ashishsinghbora Sep 24, 2026
ebd2076
feat(packages): add package-info inspector
ashishsinghbora Sep 24, 2026
4496956
feat(packages): add package-manager-info detection tool
ashishsinghbora Sep 24, 2026
125c604
feat(hardware): add cpu-info and hardware-summary
ashishsinghbora Sep 24, 2026
618d26b
feat(hardware): add gpu-info graphics detection
ashishsinghbora Sep 24, 2026
70b4f6c
feat(hardware): add memory-info RAM analyzer
ashishsinghbora Sep 24, 2026
4c57111
feat(hardware): add usb-devices and pci-devices listing tools
ashishsinghbora Sep 24, 2026
65c4275
feat(hardware): add battery-info power supply monitor
ashishsinghbora Sep 24, 2026
6d36b95
feat(ssh): add ssh-key-setup and ssh-config-check
ashishsinghbora Sep 24, 2026
6968ef5
feat(ssh): add ssh-host-info and read-only ssh-hardening-check
ashishsinghbora Sep 24, 2026
636c727
feat(developer): add dev-environment-info, git-info, and docker-info
ashishsinghbora Sep 24, 2026
f6fe44e
feat(developer): add python-info, node-info, and command-exists
ashishsinghbora Sep 24, 2026
a3498ce
feat(maintenance): add backup and universal extract tools
ashishsinghbora Sep 24, 2026
2e6418f
feat(maintenance): add file-organizer and log-inspect tools
ashishsinghbora Sep 24, 2026
1b15d30
feat(cli): add interactive bin/linux-toolbox dashboard
ashishsinghbora Sep 24, 2026
f7158ca
test: add automated test harness and CI workflow
ashishsinghbora Sep 24, 2026
3617dd4
docs: add comprehensive README, CONTRIBUTING, LICENSE, and SECURITY
ashishsinghbora Sep 24, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/shellcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Lint and Test

on:
push:
branches: [ main, 'feat/**' ]
pull_request:
branches: [ main ]

jobs:
shellcheck:
name: ShellCheck and Validation
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y shellcheck

- name: Run test suite
run: |
bash tests/test_all.sh
33 changes: 33 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Contributing to LinuxScripts

Thank you for your interest in improving LinuxScripts!

## Principles & Guidelines

1. **Standards:**
- Every script must start with `#!/usr/bin/env bash` and `set -euo pipefail`.
- Implement a `--help` / `-h` flag describing usage, options, and dependencies.
- Quote all variables properly and handle filenames containing spaces safely.
- Minimize external dependencies; prefer core POSIX / standard Linux utilities.
- Gracefully detect dependencies using `command -v`.

2. **Safety First:**
- Default to read-only or dry-run modes where practical.
- Destructive operations (process termination, package removal, cache clearing) must require explicit user confirmation or flags.
- Never run unvalidated `rm -rf` commands.
- SSH audits and checks must remain strictly read-only.

3. **Testing:**
- Verify syntax: `bash -n <script>`
- Verify ShellCheck: `shellcheck <script>`
- Ensure the script has executable permissions (`chmod +x <script>`).
- Run the automated test suite before opening a pull request:
```bash
bash tests/test_all.sh
```

## Submitting Pull Requests

- Keep commits focused, descriptive, and atomic.
- Include an explanation of the change and the testing performed.
- Ensure all tests pass with 0 errors.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 Ashish Singh Bora

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
284 changes: 178 additions & 106 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,122 +1,194 @@
LinuxScripts
# LinuxScripts

Small, practical scripts for Linux.
A clean, reliable, beginner-friendly Linux utility toolkit designed for systems administrators, developers, and power users.

The goal of this repository is simple: collect useful Linux scripts that automate repetitive tasks without adding unnecessary complexity.
> Small scripts. Useful results. Zero unnecessary bloat.

«Small scripts. Useful results. No unnecessary bloat.»
---

What's Inside
## Overview

scripts/
├── system-info.sh
├── disk-usage.sh
├── update-system.sh
├── cleanup-cache.sh
└── network-info.sh
**LinuxScripts** is a modular collection of well-tested, standalone Bash utilities organized into logical categories. Each script adheres to strict engineering and safety standards:
- Starts with `#!/usr/bin/env bash` and enforces `set -euo pipefail`.
- Supports `--help` / `-h` with consistent documentation.
- Prioritizes read-only inspection; destructive operations require explicit user confirmation or flags.
- Relies on standard Linux userland utilities with graceful dependency detection.
- Includes an interactive terminal dashboard (`bin/linux-toolbox`) to run any tool easily.

Current Scripts
---

Script| Purpose
"system-info.sh"| Display basic system information
"disk-usage.sh"| Display filesystem disk usage
"update-system.sh"| Update the system using the detected package manager
"cleanup-cache.sh"| Perform conservative temporary-file cleanup
"network-info.sh"| Display network interfaces, routes and DNS information
## Directory Structure

Installation
```text
LinuxScripts/
├── bin/
│ └── linux-toolbox # Interactive menu front-end
├── scripts/
│ ├── system/ # Host, health, kernel, boot, and service inspectors
│ ├── storage/ # Disk usage, large files, inodes, mounts, filesystems, SMART
│ ├── network/ # Network info, ping, DNS, ports, routes, diagnostics
│ ├── process/ # Process inspection and safe termination
│ ├── packages/ # Cross-distro package queries and maintenance
│ ├── hardware/ # CPU, GPU, memory, USB, PCI, and battery inspection
│ ├── ssh/ # SSH keys, config validation, host keys, and hardening checks
│ ├── developer/ # Dev tools, Git, Docker, Python, Node, command checks
│ └── maintenance/ # Safe cleanup, backups, archive extraction, file organizer, logs
├── tests/
│ ├── test_all.sh # Automated validation and linting test harness
│ └── fixtures/ # Test fixtures
├── .github/
│ └── workflows/
│ └── shellcheck.yml # CI validation workflow
├── CONTRIBUTING.md # Contribution guide
├── LICENSE # MIT License
└── SECURITY.md # Security reporting policy
```

Clone the repository:
---

git clone https://github.com/ashishsinghbora/LinuxScripts.git
cd LinuxScripts

Make the scripts executable:

chmod +x scripts/*.sh

Run a script:

./scripts/system-info.sh

Requirements

The scripts are primarily written for Linux systems using standard command-line utilities.

Some scripts may require:

- "sudo"
- "iproute2"
- "util-linux"
- A supported package manager

Design Goals

LinuxScripts follows a few simple principles:

- Keep scripts small.
- Prefer standard Linux utilities.
- Avoid unnecessary dependencies.
- Fail clearly when something goes wrong.
- Avoid destructive operations by default.
- Make scripts easy to read and modify.
- Support multiple Linux distributions where practical.

Safety
## Supported Distributions & Package Managers

Always read a script before running it, especially when it uses "sudo" or modifies your system.
The toolkit automatically detects and adapts to the following distributions and package managers:
- **Arch Linux** (`pacman`)
- **Debian / Ubuntu / Linux Mint** (`apt`)
- **Fedora / RHEL / AlmaLinux / Rocky** (`dnf`)
- **openSUSE** (`zypper`)

These scripts are provided as-is. Use them at your own risk.
If an optional command is missing on a specific platform, scripts fail gracefully with clear installation hints instead of crashing.

Contributing
---

Useful improvements and new scripts are welcome.
## Installation & Quick Start

When adding a script:
Clone the repository and set executable permissions:

1. Keep it focused on one task.
2. Avoid unnecessary dependencies.
3. Handle errors properly.
4. Document how to use it.
5. Test it on a real Linux system.
6. Explain distribution-specific behavior when applicable.

Roadmap

Phase 1 — Basic Utilities

- [x] System information
- [x] Disk usage
- [x] System update helper
- [x] Basic cleanup
- [x] Network information

Phase 2 — Productivity

- [ ] Backup helper
- [ ] File organizer
- [ ] Find large files
- [ ] Process viewer
- [ ] Port checker
- [ ] Service status helper

Phase 3 — Administration

- [ ] SSH setup helper
- [ ] User audit
- [ ] Service management
- [ ] Log inspection
- [ ] System health check
- [ ] Storage health check

Phase 4 — Advanced

- [ ] Network diagnostics
- [ ] Linux troubleshooting toolkit
- [ ] Hardware information
- [ ] Server maintenance utilities
- [ ] Interactive CLI menu

License

MIT License.
```bash
git clone https://github.com/ashishsinghbora/LinuxScripts.git
cd LinuxScripts
chmod +x bin/linux-toolbox scripts/*/*.sh
```

### Launch Interactive Toolbox

```bash
./bin/linux-toolbox
```

### Run Any Script Directly

Every script is standalone and can be executed directly from anywhere:

```bash
# Check overall system health
./scripts/system/system-health.sh

# Find top 10 largest files in /var/log
./scripts/storage/find-large-files.sh -n 10 -d /var/log

# Run full network diagnostics
./scripts/network/network-diagnostics.sh

# Audit SSH daemon security settings (read-only)
./scripts/ssh/ssh-hardening-check.sh

# Organize loose files in a directory safely (dry-run first)
./scripts/maintenance/file-organizer.sh --dry-run
```

---

## Script Reference Table

| Category | Script | Description | Safety Mode |
|---|---|---|---|
| **System** | `system-info.sh` | OS, kernel, arch, uptime, CPU, memory, and root disk summary | Read-only |
| | `system-health.sh` | Quick CPU, RAM, disk, load average, and service triage | Read-only |
| | `kernel-info.sh` | Kernel version, architecture, and loaded modules | Read-only |
| | `boot-info.sh` | Boot performance and startup times via `systemd-analyze` | Read-only |
| | `failed-services.sh` | Lists systemd units currently in a failed state | Read-only |
| **Storage** | `disk-usage.sh` | Human-readable mounted filesystem utilization | Read-only |
| | `find-large-files.sh` | Locates largest files in specified directories | Read-only |
| | `directory-size.sh` | Calculates directory disk space usage | Read-only |
| | `inode-usage.sh` | Inspects inode allocation and flags >90% exhaustion | Read-only |
| | `mount-info.sh` | Details mounted filesystems and options via `findmnt` | Read-only |
| | `filesystem-info.sh` | Inspects filesystem types, UUIDs, and block devices | Read-only |
| | `disk-health.sh` | SMART health assessment using `smartctl` | Read-only |
| **Network** | `network-info.sh` | IP addresses, interfaces, default gateway, and DNS | Read-only |
| | `ping-test.sh` | ICMP latency and packet loss verification | Read-only |
| | `dns-test.sh` | DNS resolution check via `dig` or `nslookup` | Read-only |
| | `port-check.sh` | TCP port connectivity test against target hosts | Read-only |
| | `route-info.sh` | Displays kernel IP routing tables | Read-only |
| | `internet-test.sh` | Tests WAN internet connectivity | Read-only |
| | `listening-ports.sh` | Lists open listening TCP/UDP ports via `ss` / `netstat` | Read-only |
| | `network-diagnostics.sh`| End-to-end connectivity, DNS, ping, and gateway diagnostics | Read-only |
| **Process** | `process-info.sh` | Top CPU and RAM consuming processes | Read-only |
| | `kill-process.sh` | Safe process termination with prompt and custom signals | Confirmation required |
| **Packages** | `update-system.sh` | Multi-distro package database and package updates | Dry-run available (`-n`) |
| | `install-package.sh` | Installs packages across supported package managers | Prompts before install |
| | `remove-package.sh` | Safely removes packages across supported package managers | Prompts before removal |
| | `search-package.sh` | Queries package repositories for keywords | Read-only |
| | `package-info.sh` | Inspects package details and version metadata | Read-only |
| | `package-manager-info.sh`| Identifies active system package manager and version | Read-only |
| **Hardware** | `hardware-summary.sh`| Aggregates CPU, GPU, memory, disk, and USB information | Read-only |
| | `cpu-info.sh` | CPU model, architecture, cores, sockets, and flags | Read-only |
| | `gpu-info.sh` | PCI graphics adapters and OpenGL renderers | Read-only |
| | `memory-info.sh` | Detailed RAM usage and `/proc/meminfo` metrics | Read-only |
| | `usb-devices.sh` | Enumerates attached USB devices via `lsusb` or sysfs | Read-only |
| | `pci-devices.sh` | Lists all detected PCI devices via `lspci` | Read-only |
| | `battery-info.sh` | Power supply and battery capacity/status | Read-only |
| **SSH** | `ssh-key-setup.sh` | Secure Ed25519/RSA key generator with overwrite protection | Confirmation required |
| | `ssh-config-check.sh` | Validates client SSH configuration (`~/.ssh/config`) | Read-only |
| | `ssh-host-info.sh` | Queries remote host fingerprints via `ssh-keyscan` | Read-only |
| | `ssh-hardening-check.sh`| Security audit of `sshd_config` against best practices | Read-only (never edits) |
| **Developer**| `dev-environment-info.sh`| Overview of installed compilers, runtimes, and tools | Read-only |
| | `git-info.sh` | Git version, global user config, and repo working tree | Read-only |
| | `docker-info.sh` | Docker daemon status, containers, and images | Read-only |
| | `python-info.sh` | Python 3 version, virtual environment, and pip packages | Read-only |
| | `node-info.sh` | Node.js, npm, and global package modules | Read-only |
| | `command-exists.sh` | Verifies binary availability across `$PATH` | Read-only |
| **Maintenance**| `cleanup-cache.sh` | Cleans user caches and logs safely | Confirmation required |
| | `backup.sh` | Creates compressed `.tar.gz` archives of directories | Safe write |
| | `extract.sh` | Universal archive unpacker (`tar`, `zip`, `gz`, `bz2`, `xz`, `7z`) | Safe write |
| | `file-organizer.sh` | Categorizes loose files by extension | Dry-run available (`-n`) |
| | `log-inspect.sh` | Inspects and filters system and application logs | Read-only |

---

## Safety Philosophy

- **Zero Hidden Actions:** Every script clearly describes what it does before taking action.
- **Read-Only by Default:** All diagnostics, audits, and hardware/system inspectors never alter files or configs.
- **Protection for Destructive Steps:** Operations that delete caches or terminate processes (`kill-process.sh`, `cleanup-cache.sh`, `remove-package.sh`) require interactive confirmation unless explicit override flags are supplied.
- **SSH Hardening is Advisory:** `ssh-hardening-check.sh` will **never** alter or overwrite `sshd_config`. It only highlights recommendations.
- **Safe Path Handling:** All scripts use proper quoting (`"$variable"`) to avoid space-splitting and injection bugs.

---

## Testing & Quality Assurance

The repository includes an automated validation test suite in `tests/test_all.sh`.

Run the test suite locally:

```bash
bash tests/test_all.sh
```

What the test suite checks:
1. **Syntax:** Executes `bash -n` on every script.
2. **Linting:** Runs `shellcheck` when installed.
3. **Permissions:** Confirms executable bits are set.
4. **Help Flag:** Verifies that every script responds to `-h` or `--help` and exits with status `0`.

---

## Limitations

- **Systemd vs Non-Systemd:** Scripts like `boot-info.sh` and `failed-services.sh` rely on `systemd`. On runit, openrc, or SysVinit systems, these will report that systemd is unavailable.
- **Root Permissions:** Read-only inspection commands run without elevated privileges. Commands requiring root privileges (e.g., package installation, SMART tests via `smartctl`) will prompt for `sudo` only when strictly required.

---

## License

This project is licensed under the [MIT License](LICENSE).
17 changes: 17 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Security Policy

## Supported Versions

| Version | Supported |
| ------- | ------------------ |
| main | :white_check_mark: |

## Reporting a Vulnerability

If you discover a security vulnerability within any script or configuration in this repository:

1. **Do not** report security vulnerabilities via public GitHub issues.
2. Please report findings responsibly via GitHub Security Advisories on the repository or directly to the repository maintainer.
3. Include details of the vulnerability, affected scripts, and a proof of concept or reproduction steps.

All security issues will be promptly investigated and addressed.
Loading
Loading