34

General Computer information

Posted in System by whiteside 2955 days ago

Displays General information about the machine

  • computer name
  • current login user
  • memory of the machine
  • processor type
  • product name "Mac OS X"
  • product version "10.6.4
  • Buildversion
  • lan ip address
  • wireless ip address

Not that tidy code wise but works! any comments welcome

echo "Workstation Name: " `scutil --get ComputerName;`
echo "UserName: " `whoami`
echo "Memory: " `sw_vers | awk -F':t' '{print $2}' | paste -d ' ' - - -; 
sysctl -n hw.memsize | awk '{print $0/1073741824" GB RAM"}';` 
echo "Architecture: " `sysctl -n machdep.cpu.brand_string;` 
sw_vers
echo "LAN IP Address: " `ifconfig en0 | grep "inet" | grep -v 127.0.0.1 | grep -v inet6 | awk '{print $2}'`
echo "Wireless IP Address: " `ifconfig en1 | grep "inet" | grep -v 127.0.0.1 | grep -v inet6 | awk '{print $2}'`

Comments

User Avatar
Bouffski 2935 days ago
Thanx for this!

Cheers
User Avatar
sunglassesmichael 2816 days ago
Can you tell me why my IP is showing up as a LAN IP when I am connected to a Wireless network and no wireless IP is showing?
User Avatar
alexwasserman 2666 days ago
@sunglassesmichael - he's assuming your two network devices are ethernet first, then wireless.

If you switch en0 and en1 in the ifconfig lines above you'll sort them out.

Log in to comment or register here.