Vigtige systemværktøjer: BleachBit og inxi

FrugalMan
Antal: 1181
Tilmeldt:
18-12-2007
User is offline
Vigtige systemværktøjer: BleachBit og inxi

De fleste kender dem nok. Virkelige gode værktøjer.

BleachBit

https://www.linuxlinks.com/essential-system-tools-...

inxi
https://www.linuxlinks.com/essential-system-tools-...

Angående inxni, så har jeg skrevet en lile vejledning om hvordan det bruges
http://bluemarlin.dk/doku.php?id=inxi

"Man kan modstå alt undtagen fristelser" - Oscar Wilde
Frit Software


osjensen
osjensen's picture
Antal: 1325
Tilmeldt:
14-01-2007
User is offline
Med lidt zenity indpakning,

inxi er et glimrende værktøj.
Med lidt yad indpakning, kan inxi se sådan ud -

https://encrypted-tbn0.gstatic.com/images?q=tbn:AN...


frogmaster
frogmaster's picture
Antal: 3709
Tilmeldt:
20-05-2010
User is offline
inxi -Fxz giver et fint

inxi -Fxz giver et fint overblik over hardwaren.
Er der brug for en mere detaljeret, så klarer sudo lshw opgaven.

Der er mange andre værktøjer, hver med deres detaljeringsniveau (kører maskinen x11/xorg eller wayland, hvilken DRI osv). Dette script er tilpasset Ubuntu 18.04 og derivater:

#! /bin/bash
# When executed from the main menu, the path is: ~/progs/system-status/./run
# unset any variable which system may be using

# clear the screen
clear

unset tecreset os architecture kernelrelease internalip externalip nameserver loadaverage

while getopts iv name
do
        case $name in
          i)iopt=1;;
          v)vopt=1;;
          *)echo "Invalid arg";;
        esac
done

if [[ ! -z $iopt ]]
    then
    {
    wd=$(pwd)
    basename "$(test -L "$0" && readlink "$0" || echo "$0")" > /tmp/scriptname
    scriptname=$(echo -e -n $wd/ && cat /tmp/scriptname)
    su -c "cp $scriptname /usr/bin/monitor" root && echo "Congratulations! Script Installed, now run monitor Command" || echo "Installation failed"
    }
fi

if [[ ! -z $vopt ]]
    then
    {
    echo -e "Apache 2.0 License"
    }
fi

if [[ $# -eq 0 ]]
    then
    {

    # Define Variable tecreset
    LGREEN='\033[32m'
    GREEN='\033[32;1m'
    YELLOW='\033[33;1m'
    LYELLOW='\033[33m'
    RED='\033[31;1m'
    BLUE='\033[34m'
    BBLUE='\033[34;1m'
    BBG='\033[40m'
    GRAY='\033[1;30m'
    LGRAY='\033[37m'
    WHITE='\033[97m'
    BWHITE='\033[97;1m'
    ITALIC='\033[3m'
    WFBG='\033[48;5;17;1m' # bold font - dark blue background, using 256 color background sequence
    DEFAULT='\033[39m'
    STD='\033[0m'
    tecreset=$(tput sgr0)

    # Define functions (force to use Enter key)
    PAUSE_ENTER(){
        read -s -p "" fackEnterKey
    }

    # Display gradients, using 256 color background sequence
    GRADIENT(){
        for i in {17..20} {20..17} ; do echo -en "\033[1;37;48;5;${i}m             " ; done ; echo
    }

    # Begin script
    echo -e $YELLOW"Analyzing computer ..." $STD
echo

echo -e $YELLOW"Checking for installed preconditions ..."$STD

    # Checking and installing inxi
    if ! [ -x "$(command -v inxi)" ]; then
        echo -e $YELLOW"inxi$RED is needed for checking some hardware but is not installed."
        echo -e "Press $YELLOW[Enter]$RED to install inxi ..."$STD
            PAUSE_ENTER
        sudo apt-get update && sudo apt-get install inxi  
else
echo -e $GREEN"OK$STD inxi is installed"    
    fi

    # Checking and installing smartctrl (smartmontools)
    if ! [ -x "$(command -v smartctl)" ]; then
        echo -e $YELLOW"Smartmontools$RED is needed for checking SSD or HDD rotation rate but is not installed."
        echo -e "Press $YELLOW[Enter]$RED to install Smartmontools ..."$STD
            PAUSE_ENTER
        sudo apt-get update && sudo apt-get install smartmontools       
    else
        echo -e $GREEN"OK$STD Smartmontools is installed." 
    fi

    # Checking and installing netstat
    if ! [ -x "$(command -v netstat)" ]; then
        echo -e $YELLOW"netstat$RED is needed for checking network interfaces but is not installed."
        echo -e "Press $YELLOW[Enter]$RED to install netstat ..."$STD
            PAUSE_ENTER
        sudo apt-get update && sudo apt-get install netstat 
else
echo -e $GREEN"OK$STD netstat is installed"     
    fi

    # Check hardware detailed  
echo -e $WHITE
    sudo lshw # -C display
    echo -e ${BBG}
    echo
    echo -e $YELLOW"Checking graphic card:"$STD$BBG
    echo -e $BBLUE$ITALIC"You may wish to check under graphics below ..."$STD$BBG$WHITE
echo
    lsmod | grep radeon
    lsmod | grep amd
    echo
    echo -e $YELLOW"Checking if Xorg x11 is in usage or Wayland."$STD$BBG$WHITE
    echo -e $BBLUE "  " $XDG_SESSION_TYPE
xdpyinfo | grep DRI
    echo
echo -e $YELLOW"Check if Xorg.0.log exist"$STD$BBG$WHITE
    cat /var/log/Xorg.0.log | grep autoconfigured
    echo -e $STD
    echo

    # Hardware less detailed
    inxi -Fxz

    # Check network interfaces
    echo -e $BBG
    echo -e
    echo -e $YELLOW"Checking network interfaces:" $tecreset$BBG
    echo -e $BBG $BBLUE
    netstat -ie

    # Check if connected to Internet or not
    ping -c 1 google.com &> /dev/null && echo -e $YELLOW"Internet     :$GREEN Connected" || echo -e $YELLOW"Internet     :$RED Disconnected"

    # Check hostname
    echo -e $YELLOW"Hostname     :"    $WHITE$HOSTNAME

    # Check Internal IP
    internalip=$(hostname -I)
    echo -e $YELLOW"Internal IP  :"    $WHITE$internalip

    # Check External IP
    externalip=$(curl -s ipecho.net/plain;echo)
    echo -e $YELLOW"External IP  :"    $WHITE$externalip

    # Check DNS
    nameservers=$(cat /etc/resolv.conf | sed '1 d' | awk '{print $2}')
    echo -e $YELLOW"Name Servers :"$BLUE$nameservers

    # This only work on Ubuntu 16.04 and 18.04. Please uncomment according to Your need.
    router=$(nmcli dev show | grep DNS | sed 's/\s\s*/\t/g' | cut -f 2)
    echo -e $YELLOW"Routers DNS  :"   $GREEN$router

    # This only work om Ubuntu 14.04. Please uncomment according to Your need.
    # router=$(nmcli dev list | grep DNS | sed 's/\s\s*/\t/g' | cut -f 2)
    # echo -e $YELLOW"Router DNS   :" $GREEN $router

    # Ubuntu 18.04 only
echo
echo -e $BLUE$ITALIC"Name Servers internal third symlink replace operation 127.0.0.53 Ubuntu 18.04 only"$STD$BBG$WHITE
    dig @127.0.0.53 google.com

    # Ubuntu 16.04 only
    #echo -e ${STD}${BBG}${WHITE}
#dig google.com
    #echo -e ${STD}${BBG}${LYELLOW}"You may wish to deactivate local Name Servers within ${BWHITE}'/etc/NetworkManager/NetworkManager.conf'${STD}${BBG}${LYELLOW}"
    #echo -e "by comment ${BWHITE}'# dns=dnsmasq'${STD}${BBG}${LYELLOW}, to use the DNS from the main router and restart the service: "
    #echo -e "${BWHITE}sudo service network-manager restart${STD}${BBG}"

    echo -e $BBLUE
    netstat -r
    tput sgr0
    echo -e $tecreset

    # Check Logged In Users
    echo
    who>/tmp/who
    echo -e $YELLOW"Logged In users :" $tecreset && cat /tmp/who

    # Check System Uptime
    tecuptime=$(uptime | awk '{print $3,$4}' | cut -f1 -d,)
    echo -e $YELLOW"System Uptime Days/(HH:MM) :" $tecreset$tecuptime

    # Check Load Average
    loadaverage=$(top -n 1 -b | grep "load average:" | awk '{print $10 $11 $12}')
    echo -e $YELLOW"Load Average               :" $tecreset$loadaverage && echo "(the average system load per user calculated over a period of time of 1, 5 and 15 minutes)"
    echo

    # Check OS Type
    os=$(uname -o)
    echo -e $YELLOW"Operating System Type :"$tecreset $os
    echo

    # Check date and time for OS installation
    echo -e $YELLOW'Install date:'$tecreset && sudo dumpe2fs /dev/sda1 | grep 'Filesystem created'
    echo

    # Check OS Release Version and Name
    cat /etc/os-release | grep 'NAME\|VERSION' | grep -v 'VERSION_ID' | grep -v 'PRETTY_NAME' > /tmp/osrelease
    echo -n -e $YELLOW"OS Name               :" $tecreset  && cat /tmp/osrelease | grep -v "VERSION" | cut -f2 -d\"
    echo -n -e $YELLOW"OS Version            :" $tecreset && cat /tmp/osrelease | grep -v "NAME" | cut -f2 -d\"

    # Check Architecture
    architecture=$(uname -m)
    echo -e $YELLOW"Architecture          :"$tecreset$architecture
    echo

    # Check Kernel Memory Space
    echo -e $RED"Kernel Memory Space :" $tecreset
    dmesg | grep Memory
    echo

    # Check Kernel Release
    kernelrelease=$(uname -r)
    echo -e $RED"Kernel Release      :" $tecreset$kernelrelease
    echo

    # Check RAM and SWAP Usages
    free -h | grep -v + > /tmp/ramcache
    echo -e $YELLOW"Ram Usages  :" $tecreset
    cat /tmp/ramcache | grep -v "Swap"
    echo -e $YELLOW"Swap Usages :" $tecreset
    cat /tmp/ramcache | grep -v "Mem"
    echo

    # Check Disk Type, Usages and mounted volumes
    df -h| grep 'Filesystem\|/dev/sda*' > /tmp/diskusage
    echo -e $YELLOW"Disk type, usages and mounted volumes :" $tecreset

    tput setaf 2
    tput bold
    # Check disk rotation rate or Solid State Disk
    sudo smartctl -a /dev/sda | grep 'Rotation Rate'
    tput sgr0
    echo -e $BBLUE
    cat /tmp/diskusage
    lsblk
    echo -e $STD

    # Unset Variables
    unset tecreset os architecture kernelrelease internalip externalip nameserver loadaverage

    # Remove Temporary Files
    rm /tmp/osrelease /tmp/who /tmp/ramcache /tmp/diskusage
    }
fi
shift $(($OPTIND -1))

# Check Disk usage with ncdu and install if it isn't
if ! [ -x "$(command -v ncdu)" ]; then
    echo -e $YELLOW"ncdu$RED is used to analyze disk space but is not installed."
    echo -e "Press$YELLOW [Enter]$RED key to install and run ncdu."
    echo -e "From within ncdu, press$YELLOW [q]$RED to quit and$YELLOW [?]$GREEN to select options."$STD
        PAUSE_ENTER
        sudo apt install ncdu
    cd /
    ncdu
    echo
else
    echo -e $GREEN"Press$YELLOW [Enter]$GREEN key to run ncdu."
    echo -e "From within ncdu, press$YELLOW [q]$RED to quit and$YELLOW [?]$GREEN to select options"$STD
        PAUSE_ENTER
    cd /
    ncdu
    echo
fi


FrugalMan
FrugalMan's picture
Antal: 1181
Tilmeldt:
18-12-2007
User is offline
Er der brug for en mere

#2: Er der brug for en mere detaljeret, så klarer sudo lshw opgaven.

Ja den glemte jeg http://bluemarlin.dk/doku.php?id=lshw

"Man kan modstå alt undtagen fristelser" - Oscar Wilde
Frit Software