i need to make a script that queries relevant system information from the /proc file system, the uname command, the output of dmesg, and possibly other sources on the system. the script should collect this information in variables, format it, then store it in a text file.
i need a shell script
Collapse
X
-
Ok, so what do you have so far? Have you decided what shell you are using? Are you familiar with the different ways of getting that information?Originally posted by thisissini need to make a script that queries relevant system information from the /proc file system, the uname command, the output of dmesg, and possibly other sources on the system. the script should collect this information in variables, format it, then store it in a text file. -
#!/bin/bash
#
#
#
name=$(uname -s)
version=$(uname -v)
hardware=$(unam e -m)
release=$(uname -r)
mem=$(free -omt)
disk=$(df -lh)
hname=$(uname -n)
cpu=$(cat /proc/cpuinfo | grep 'cpu MHz' | sed 's/cpu MHz//')
cpumodel=$(cat /proc/cpuinfo | grep 'model name' | sed 's/model name//')
who=$(whoami)
lwho=$(logname)
uptime=$(uptime |sed 's/,.*$//')
#
#
echo "informatio n about your PC"
echo "OS Type : $name"
echo "Hostname : $hname"
echo "Currently logged in as : $who"
echo "CPU Model $cpumodel"
echo "CPU Speed $cpu MHz"
echo "Kernel Version : $version"
echo "Kernel Release : $release"
echo "System Uptime :$uptime"
echo
echo "Hard Disk"
echo "$disk"
echo
echo "System Memory info"
echo "$mem"
echo
echo "/proc file system info"
procinfo=$(/usr/bin/procinfo)
echo "$procinfo"
echo
dmesg > /tmp/dmesg.out
cat /tmp/dmesg.outComment
-
Oh cool, ok. Check this out. Looks like you can use the standard redirects in the script just as you would on the command line.Originally posted by thisissinwell at first when i read that scenario i was mindblow on where to start. but then looked at a couple sample scripts and went to town... all i need to do now is export all that information into a txt file.Comment
Comment