<?xml version='1.0'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:atom="http://www.w3.org/2005/Atom" >
<channel>
	<title><![CDATA[BOL: Get the Linux system information !]]></title>
	<link>https://bioinformaticsonline.com/snippets/view/43413/get-the-linux-system-information?</link>
	<atom:link href="https://bioinformaticsonline.com/snippets/view/43413/get-the-linux-system-information?" rel="self" type="application/rss+xml" />
	<description><![CDATA[]]></description>
	
	<item>
	<guid isPermaLink="true">https://bioinformaticsonline.com/snippets/view/43413/get-the-linux-system-information</guid>
	<pubDate>Thu, 30 Sep 2021 06:37:45 -0500</pubDate>
	<link>https://bioinformaticsonline.com/snippets/view/43413/get-the-linux-system-information</link>
	<title><![CDATA[Get the Linux system information !]]></title>
	<description><![CDATA[<code>#!/bin/bash

# while-menu-dialog: a menu driven system information program

DIALOG_CANCEL=1
DIALOG_ESC=255
HEIGHT=0
WIDTH=0

display_result() {
  dialog --title &quot;$1&quot; \
    --no-collapse \
    --msgbox &quot;$result&quot; 0 0
}

while true; do
  exec 3&gt;&amp;1
  selection=$(dialog \
    --backtitle &quot;System Information&quot; \
    --title &quot;Menu&quot; \
    --clear \
    --cancel-label &quot;Exit&quot; \
    --menu &quot;Please select:&quot; $HEIGHT $WIDTH 4 \
    &quot;1&quot; &quot;Display System Information&quot; \
    &quot;2&quot; &quot;Display Disk Space&quot; \
    &quot;3&quot; &quot;Display Home Space Utilization&quot; \
    2&gt;&amp;1 1&gt;&amp;3)
  exit_status=$?
  exec 3&gt;&amp;-
  case $exit_status in
    $DIALOG_CANCEL)
      clear
      echo &quot;Program terminated.&quot;
      exit
      ;;
    $DIALOG_ESC)
      clear
      echo &quot;Program aborted.&quot; &gt;&amp;2
      exit 1
      ;;
  esac
  case $selection in
    1 )
      result=$(echo &quot;Hostname: $HOSTNAME&quot;; uptime)
      display_result &quot;System Information&quot;
      ;;
    2 )
      result=$(df -h)
      display_result &quot;Disk Space&quot;
      ;;
    3 )
      if [[ $(id -u) -eq 0 ]]; then
        result=$(du -sh /home/* 2&gt; /dev/null)
        display_result &quot;Home Space Utilization (All Users)&quot;
      else
        result=$(du -sh $HOME 2&gt; /dev/null)
        display_result &quot;Home Space Utilization ($USER)&quot;
      fi
      ;;
  esac
done</code>]]></description>
	<dc:creator>Surabhi Chaudhary</dc:creator>
</item>

</channel>
</rss>