Skip to content

andreak3779/awk_linux_scripts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 

Repository files navigation

awk_linux_scripts

Bash Linux Zorin OS 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

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:

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:

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:

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:

    mkdir -p ~/scripts
    cd ~/scripts
    # Copy files here or git clone
  2. Make scripts executable:

    chmod +x ~/scripts/*.sh
  3. Add directory to PATH (choose one method):

    Option A: Bash (for ~/.bashrc)

    echo 'export PATH=~/scripts:$PATH' >> ~/.bashrc
    source ~/.bashrc

    Option B: Bash Profile (for ~/.bash_profile)

    echo 'export PATH=~/scripts:$PATH' >> ~/.bash_profile
    source ~/.bash_profile

    Option C: System-wide (requires sudo)

    for f in "$HOME"/scripts/*.sh; do
      sudo ln -s "$f" "/usr/local/bin/$(basename "$f" .sh)"
    done
  4. Verify installation:

    sudo showhardware.sh

Usage

Run scripts from any terminal window:

# Show hardware information (requires sudo)
sudo showhardware.sh

# Update the system (requires sudo)
sudo checkforupdates.sh

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.sh
  • Add the directory to PATH (see Installation section)

lshw or dmidecode commands not found:

  • Install required packages: sudo apt install lshw dmidecode

checkforupdates.sh 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:

rm ~/scripts/showhardware.sh ~/scripts/checkforupdates.sh

Remove from PATH (if using ~/.bashrc or ~/.bash_profile):

# 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, an AI-powered code assistant. Improvements include error handling, security checks, better formatting, and additional functionality.

About

My handy linux scripts

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages