If Not True Then False

Show Linux Version, Distribution (Distro), System Information - Comment Page: 1

This is quick guide howto show Linux version, howto show Linux distributin (distro) info, howto show Linux System information, kernel version and kernel information on command line. Show Linux Version Linux version information can be checked using the following commands: cat /proc/version Another way to check Linux Version information is following: dmesg | grep "Linux version" Example...
Categories:
Tagged with:

3 Comments

Leave a Comment

Your email address will not be published. Required fields are marked *

Input your comment.
help

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Input your name.

linuxadmin

Hi all..

i have a script with me… I just want to be open hearted as Linux…

save the following script as mysystemconfig.sh

then do the following command
chmod 777 mysystemconfig.sh

then execute it
sh mysystemconfig.sh

#=================== You will get almost everything here================

#!/bin/bash

#
# System configuration
# (All most complete information)
# @uther : linuxeverywhere@gmail.com
#

userId=`id -g`

if [ $userId == 0 ]; then

clear
echo “”
echo ” System configuration”
echo ” ====================”

#System-Info———————[
host_name=`hostname`
date_n_time=`date ‘+%m/%d/%y %H:%M:%S’`
#System-Info———————]

#os-details———————-[
os_installed=`cat /etc/issue | head -1`
os_name=`uname -a`
hw_platform=`uname -i`
if [ $hw_platform == “i386″ ]; then
hw_platform=”32bit”
fi
if [ $hw_platform == “x86_64″ ]; then
hw_platform=”64bit”
fi
#os-details———————-]

#users—————————[
no_of_users=`who | wc -l`
users=`users | awk ‘{ while(++i&1 | awk ‘{print $2}’ | head -2 | tail -1`” MB”
RAM_total_used=`free -m 2>&1 | awk ‘{print $3}’ | head -2 | tail -1`” MB”
if [ $userId == 0 ]; then
countRams=`dmidecode –type 17 | grep “Size” | grep “MB” | wc -l`
RamSize=`echo \`dmidecode –type 17 | grep “Size” | grep “MB” |awk ‘{print $2}’\` | tr ” ” “,”`” MB [$countRams RAM(s)]”
else
RamSize=`free -m | grep “Mem:” | awk ‘{print $2 “”}’`”MB (Please login as root to get accurate information)”
fi
#RAM Info————————]

#HDD Info————————[
if [ $userId == 0 ]; then
No_of_HDDs=`fdisk -l 2>&1 | grep Disk | grep -v “identifier” | grep -v “valid partition” | awk ‘{print $3}’ | wc -l`
countHDD=`fdisk -l 2>&1 | grep Disk | grep -v “identifier” | grep -v “valid partition” | awk ‘{print $3}’ | wc -m`
countHDD=`echo $[ $countHDD – 1 ]`
HDD=`fdisk -l 2>&1 | grep “Disk” | grep -v “identifier” | grep -v “valid partition” | awk ‘{print $3 “”}’ | tr “\n” “,”| cut -c1-$countHDD`” GB [$No_of_HDDs HDD(s)]”
else
HDD=”not configured -deepak”
fi
#HDD Info————————]

#Tomcat-Status——————-[
tomcat_count=`ps -ef | grep catalina | grep -v “grep catalina” | grep -v “catalina.out”| wc -l`
psid=`ps -ef | grep catalina | grep -v “grep catalina” | grep -v “catalina.out” | awk ‘{print $2}’ | head -1`
if [ $tomcat_count = 1 ]
then
tomcat_status=”Running. ( pid “`ps ax –width=1000 | grep “[o]rg.apache.catalina.startup.Bootstrap start” | awk ‘{printf $1 ” “}’`”)”
KBusedbyTomcat=`pmap $psid 2>&1 | tail -1 | awk ‘{print $2}’ | cut -dK -f1`
elif [ $tomcat_count -gt 1 ]
then
tomcat_status=”Not Running (There may be an error. Pid “`ps ax –width=1000 | grep “[o]rg.apache.catalina.startup.Bootstrap start” |awk ‘{printf $1 ” “}’`”)”
else
tomcat_status=”Not Running”
KBusedbyTomcat=”0″
fi
#Tomcat-Status——————-]

#Postgres-Status——————-[
postgres_count=`ps -ef | grep postgres | grep -v “grep postgres” | wc -l`
if [ $postgres_count -gt 0 ]; then
postgres_status=”Running. ( pid “`ps ax –width=1000 | grep “postgres” | grep -v “grep postgres” | awk ‘{printf $1 ” “}’`”)”
else
postgres_status=”Not Running”
fi
#Postgres-Status——————-]

echo “”
echo ” Computer Name : $host_name”
echo ” Operating System (Name) : $os_installed”
echo ” Operating System (Description) : $os_name”
echo ” OS Hardware platform : $hw_platform”
echo ” System Date & Time : $date_n_time”
echo ” IP address(es) given : $ip_address”
echo ” CPU :$cpu [$no_of_cpu cpu(s)]”
echo ” RAM installed : $RamSize”
echo ” RAM available : $RAM_total_available”
echo ” RAM used : $RAM_total_used”
echo ” Hard disk(s) : $HDD”
echo ” Users logged in : $users (in $no_of_users places)”

echo “”
echo ” Tomcat status : $tomcat_status”
echo ” Memory used by Tomcat : $KBusedbyTomcat KB”
echo ” Postgres status : $postgres_status”
echo “”

else
echo “”
echo “!!! Please Login as root !!!”
echo “”
echo “Please enter the password:”
su
fi

#==========================End===============================

reply Reply
QBall

When I run that script, I get:

james@localhost Documents]$ sh mysystemconfig.sh
mysystemconfig.sh: line 43: syntax error near unexpected token `(‘
mysystemconfig.sh: line 43: `RamSize=`echo \`dmidecode –type 17 | grep “Size” | grep “MB” |awk ‘{print $2}’\` | tr ” ” “,”`” MB [$countRams RAM(s)]”’

I am running PCLinuxOS KDE 2012-02 (32-bit) in a VM Workstation environment.

reply Reply