-
Notifications
You must be signed in to change notification settings - Fork 0
Update shell configuration instructions in README #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
ace6fec
Update shell configuration instructions in README
andreak3779 f01326c
Enhance README and scripts: Revamp documentation with detailed descri…
andreak3779 d819356
Merge branch 'Updated-scripts-and-readme-2026-Feb'
andreak3779 70b6130
Update README.md
andreak3779 8882d43
Update checkforupdates.sh
andreak3779 b695e2b
Update README.md
andreak3779 0bc7401
Update checkforupdates.sh
andreak3779 0007111
Initial plan
Copilot d19dc46
Update README.md
andreak3779 e1603e0
Remove trailing whitespace after apt update on line 13
Copilot db2e22a
Merge pull request #13 from andreak3779/copilot/sub-pr-8-one-more-time
andreak3779 8098fff
Update checkforupdates.sh
andreak3779 daf0796
Update showhardware.sh
andreak3779 53248c7
Update README.md
andreak3779 6397cee
Update README.md
andreak3779 c599eba
Update README.md
andreak3779 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,40 +1,193 @@ | ||
| # awk_linux_scripts | ||
| ## My handy linux scripts | ||
| I wrote them to make it easier for me to update my linux (zorin OS) machine from the terminal. | ||
|
|
||
| ### Scripts: | ||
| - **showhardware.sh**: Displays detailed hardware information, including: | ||
| - System information | ||
| - Hardware details (bus info) | ||
| - BIOS and system enclosure information | ||
| - CPU information | ||
| - Memory usage | ||
| - **checkforupdates.sh**: Updates the system by: | ||
| - Running `apt update` and `apt upgrade` to update and upgrade packages | ||
| - Cleaning up unused packages with `apt autoclean` and `apt autoremove` | ||
| - Refreshing Snap packages (if Snap is installed) | ||
| - Upgrading Flatpak packages (if Flatpak is installed) | ||
|
|
||
| ### Setup: | ||
| 1) Extract files from the zip file. | ||
| 2) Open a terminal. | ||
| 3) Create a directory for the scripts: | ||
|
|
||
| [](https://www.gnu.org/software/bash/) | ||
| [](https://www.linux.org/) | ||
| [](https://zorinos.com/) | ||
| [](LICENSE) | ||
|
|
||
| Handy Linux maintenance scripts to make system administration easier from the terminal. Originally written for Zorin OS and other Debian-based distributions. | ||
|
|
||
| ## Table of Contents | ||
| - [Overview](#overview) | ||
| - [Prerequisites](#prerequisites) | ||
| - [Scripts](#scripts) | ||
| - [Installation](#installation) | ||
| - [Usage](#usage) | ||
| - [Troubleshooting](#troubleshooting) | ||
| - [Uninstallation](#uninstallation) | ||
|
|
||
| ## Overview | ||
|
|
||
| This collection provides convenient terminal tools for: | ||
| - Quick access to detailed hardware information | ||
| - Automated system updates and cleanup | ||
|
|
||
| ## Compatibility | ||
|
|
||
| These scripts are designed for **Ubuntu-based Linux distributions**, including: | ||
| - **Ubuntu** (20.04 LTS and later) | ||
| - **Zorin OS** | ||
| - **Linux Mint** | ||
| - **Elementary OS** | ||
| - **Pop!_OS** | ||
| - Any other Debian/Ubuntu-based distribution using `apt` package manager | ||
|
|
||
| The scripts use `apt` for package management, so they are **not compatible** with distributions using `dnf` (Fedora, RHEL) or `pacman` (Arch). | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| These scripts require the following packages to be installed: | ||
|
|
||
| ```bash | ||
| sudo apt install lshw dmidecode | ||
| ``` | ||
|
|
||
| ## Scripts | ||
|
|
||
| ### `showhardware.sh` | ||
|
|
||
| Displays comprehensive hardware and system information in one command. | ||
|
|
||
| **Displays:** | ||
| - System information (kernel version, OS, architecture) | ||
| - Hardware bus information | ||
| - BIOS and system enclosure details | ||
| - CPU information (cores, cache, frequency) | ||
| - Memory usage and availability | ||
| - Disk usage information | ||
| - Network interface information | ||
|
|
||
| **Features:** | ||
| - Error handling: stops on first error | ||
| - Privilege verification: ensures it's run with sudo | ||
| - Clean formatted output with visual section separators | ||
|
|
||
| **Usage:** | ||
| ```bash | ||
| sudo showhardware.sh | ||
| ``` | ||
|
|
||
| > **Note:** The script must be run with `sudo` and will verify privileges before proceeding. | ||
|
|
||
| ### `checkforupdates.sh` | ||
|
|
||
| Automated system update and maintenance script. Performs package updates, cleanup, and refreshes Snap/Flatpak packages if installed. | ||
|
|
||
| **Performs:** | ||
| - Package list updates (`apt update`) | ||
| - System upgrades (`apt upgrade`) | ||
| - Unused package cleanup (`apt autoclean` and `apt autoremove`) | ||
| - Snap package refresh (if installed) | ||
| - Flatpak package upgrade (if installed) | ||
|
|
||
| **Features:** | ||
| - Error handling: stops on first error | ||
| - Privilege verification: ensures it's run with sudo | ||
| - Detailed status messages | ||
| - Automated dependency cleanup (may override some APT safety checks; review changes carefully before proceeding) | ||
|
|
||
| **Usage:** | ||
| ```bash | ||
| sudo checkforupdates.sh | ||
| ``` | ||
|
|
||
| > **Note:** The script must be run with `sudo` and will verify privileges before proceeding. | ||
|
|
||
| ## Installation | ||
|
|
||
| 1. Clone or extract files into a directory: | ||
| ```bash | ||
| mkdir -p ~/scripts | ||
| cd ~/scripts | ||
| # Copy files here or git clone | ||
| ``` | ||
| 4) Move the extracted files into `~/scripts`: | ||
|
|
||
| 2. Make scripts executable: | ||
| ```bash | ||
| mv /path/to/extracted/files/* ~/scripts | ||
| chmod +x ~/scripts/*.sh | ||
| ``` | ||
| 5) Make the scripts executable: | ||
|
|
||
| 3. Add directory to PATH (choose one method): | ||
|
|
||
| **Option A: Bash (for ~/.bashrc)** | ||
| ```bash | ||
| chmod og+x ~/scripts/*.sh | ||
| echo 'export PATH=~/scripts:$PATH' >> ~/.bashrc | ||
| source ~/.bashrc | ||
| ``` | ||
| 6) Add the scripts directory to your PATH: | ||
|
|
||
| **Option B: Bash Profile (for ~/.bash_profile)** | ||
| ```bash | ||
| echo 'export PATH=~/scripts:$PATH' >> ~/.bash_profile | ||
| source ~/.bash_profile | ||
| ``` | ||
|
andreak3779 marked this conversation as resolved.
andreak3779 marked this conversation as resolved.
|
||
| 7) Reload your shell configuration: | ||
|
|
||
| **Option C: System-wide (requires sudo)** | ||
| ```bash | ||
| source ~/.bash_profile | ||
| for f in "$HOME"/scripts/*.sh; do | ||
| sudo ln -s "$f" "/usr/local/bin/$(basename "$f" .sh)" | ||
| done | ||
| ``` | ||
|
|
||
| 4. Verify installation: | ||
| ```bash | ||
| sudo showhardware | ||
| ``` | ||
|
|
||
| ## Usage | ||
|
|
||
| Run scripts from any terminal window: | ||
|
|
||
| ```bash | ||
| # Show hardware information (requires sudo) | ||
| sudo showhardware | ||
|
|
||
| # Update the system (requires sudo) | ||
| sudo checkforupdates | ||
| ``` | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| **Scripts not found after installation:** | ||
| - Verify PATH was updated: `echo $PATH | grep scripts` | ||
| - Restart terminal for changes to take effect | ||
| - Try opening a new terminal window | ||
|
|
||
| **"Permission denied" errors:** | ||
| - Ensure scripts are executable: `chmod +x ~/scripts/*.sh` | ||
| - For system-wide installation, you need sudo | ||
|
|
||
| **"sudo: command not found":** | ||
| - Verify script is in a directory in your PATH: `which showhardware` | ||
| - Add the directory to PATH (see Installation section) | ||
|
|
||
| **`lshw` or `dmidecode` commands not found:** | ||
| - Install required packages: `sudo apt install lshw dmidecode` | ||
|
|
||
| **`checkforupdates` exits early:** | ||
| - The script uses error handling and stops on first error | ||
| - Check the output for which command failed | ||
| - Review system logs if needed: `journalctl -xe` | ||
|
|
||
| ## Uninstallation | ||
|
|
||
| Remove installed scripts: | ||
|
|
||
| ```bash | ||
| rm ~/scripts/showhardware.sh ~/scripts/checkforupdates.sh | ||
| ``` | ||
|
|
||
| If symlinked to `/usr/local/bin/`: | ||
| ```bash | ||
| sudo rm /usr/local/bin/showhardware /usr/local/bin/checkforupdates | ||
| ``` | ||
|
|
||
| Remove from PATH (if using ~/.bashrc or ~/.bash_profile): | ||
| ```bash | ||
| # Edit ~/.bashrc or ~/.bash_profile and remove the PATH line | ||
| sudo vi ~/.bashrc | ||
| # Find and delete: export PATH=~/scripts:$PATH | ||
| ``` | ||
|
|
||
| ## Credits | ||
|
|
||
| These scripts were enhanced with assistance from [GitHub Copilot](https://github.com/features/copilot), an AI-powered code assistant. Improvements include error handling, security checks, better formatting, and additional functionality. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,23 +1,38 @@ | ||
| #!/usr/bin/bash | ||
| sudo apt update | ||
| sudo apt upgrade --assume-yes | ||
| sudo apt autoclean | ||
| sudo apt autoremove | ||
| set -e | ||
|
andreak3779 marked this conversation as resolved.
|
||
|
|
||
| # Check if running with sudo privileges | ||
| if [[ $EUID -ne 0 ]]; then | ||
| echo "This script must be run with sudo privileges." | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "=== System Update Started ===" | ||
|
|
||
| echo "Updating package lists..." | ||
| apt update | ||
|
|
||
| echo "Upgrading packages..." | ||
| apt upgrade -y | ||
|
|
||
| echo "Cleaning apt cache..." | ||
| apt autoclean --yes | ||
| apt autoremove --yes | ||
|
|
||
| # Check for Snap | ||
| if command -v snap &> /dev/null; then | ||
| echo "Snap Refresh" | ||
| sudo snap refresh | ||
| echo "Refreshing Snap packages..." | ||
| snap refresh --stable | ||
| else | ||
|
andreak3779 marked this conversation as resolved.
|
||
| echo "Snap is not installed." | ||
| fi | ||
|
|
||
| # Check for Flatpak | ||
| if command -v flatpak &> /dev/null; then | ||
| echo "FlatPak Refresh" | ||
| sudo flatpak upgrade | ||
| echo "Refreshing Flatpak packages..." | ||
| flatpak upgrade --assumeyes | ||
| else | ||
| echo "Flatpak is not installed." | ||
| fi | ||
|
|
||
| exit | ||
| echo "=== System Update Completed Successfully ===" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,20 +1,33 @@ | ||
| #!/usr/bin/bash | ||
| set -e | ||
|
|
||
| echo "System Information:" | ||
| # Check if running with sudo privileges (required for lshw and dmidecode) | ||
| if [[ $EUID -ne 0 ]]; then | ||
| echo "This script must be run with sudo privileges." | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Section separators for better readability | ||
| HEADER="\n====================" | ||
| FOOTER="====================\n" | ||
|
andreak3779 marked this conversation as resolved.
|
||
|
|
||
| printf "$HEADER System Information $FOOTER" | ||
| uname -a | ||
|
andreak3779 marked this conversation as resolved.
|
||
| echo | ||
|
|
||
| echo "Hardware Details:" | ||
| sudo lshw -businfo | ||
| echo | ||
| printf "$HEADER Hardware Details $FOOTER" | ||
| lshw -businfo | ||
|
|
||
| echo "BIOS and System Enclosure Information:" | ||
| sudo dmidecode --type 0,1,3 | ||
| echo | ||
| printf "$HEADER BIOS and System Enclosure Information $FOOTER" | ||
| dmidecode --type 0,1,3 | ||
|
|
||
| echo "CPU Information:" | ||
| printf "$HEADER CPU Information $FOOTER" | ||
| lscpu | ||
| echo | ||
|
|
||
| echo "Memory Information:" | ||
| printf "$HEADER Memory Information $FOOTER" | ||
| free -h | ||
|
|
||
| printf "$HEADER Disk Usage $FOOTER" | ||
| df -h / | ||
|
|
||
| printf "$HEADER Network Interfaces $FOOTER" | ||
| ip -br addr | ||
|
andreak3779 marked this conversation as resolved.
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.