Useful Macintosh OSX terminal commands to get information about your iMac.

Posted: May 6, 2014. At: 2:37 PM. This was 3 years ago. Post ID: 7242

The mount command shows information about your mounted partitions on your machine.

iMac305:~ admin$ mount
/dev/disk0s2 on / (hfs, local, journaled)
devfs on /dev (devfs, local, nobrowse)
map -hosts on /net (autofs, nosuid, automounted, nobrowse)
map auto_home on /home (autofs, automounted, nobrowse)
map -fstab on /Network/Servers (autofs, automounted, nobrowse)
/dev/disk0s3 on /Volumes/Scratch (hfs, local, journaled)

Use the w command to get information about logged in users.

iMac305:~ admin$ w
13:57  up  1:34, 2 users, load averages: 0.22 0.51 0.71
USER     TTY      FROM              LOGIN@  IDLE WHAT
admin    console  -                12:23    1:33 -
admin    s000     -                12:32       - w

The UNIX finger -lmps command may be used on a Mountain Lion OSX machine to get information about your user.

iMac305:~ admin$ finger -lmps
Login: admin          			Name: Admin
Directory: /Users/admin             	Shell: /bin/bash
On since Tue  6 May 12:23 (EST) on console, idle 1:34 (messages off)
On since Tue  6 May 12:32 (EST) on ttys000
No Mail.

Here is an alternative command to get brief information about your user.

iMac305:~ admin$ who am i
admin    ttys000  May  6 12:32

This command: ps x will list all running processes.

iMac305:~ admin$ ps x
  PID   TT  STAT      TIME COMMAND
  304   ??  Ss     0:00.15 /sbin/launchd
  308   ??  S      0:00.19 /usr/sbin/distnoted agent
  313   ??  S      0:00.29 /usr/libexec/UserEventAgent -l Aqua
  317   ??  S      0:00.14 /System/Library/CoreServices/talagent
  318   ??  S      0:01.29 /System/Library/CoreServices/Dock.app/Contents/MacOS/Dock
  319   ??  S      0:00.66 /System/Library/CoreServices/SystemUIServer.app/Contents/MacOS/SystemUIServer
  320   ??  S      0:03.36 /System/Library/CoreServices/Finder.app/Contents/MacOS/Finder
  324   ??  S      0:00.62 /System/Library/Frameworks/ApplicationServices.framework/Frameworks/ATS.framework/Support/fontd
  327   ??  Ss     0:00.13 com.apple.dock.extra
  328   ??  S      0:00.01 /usr/sbin/pboard
  331   ??  SN     0:00.01 /usr/libexec/warmd_agent
  336   ??  S      0:00.21 /System/Library/PrivateFrameworks/IMCore.framework/imagent.app/Contents/MacOS/imagent
  341   ??  S      0:00.14 /Library/Application Support/Symantec/SymQuickMenu/SymQuickMenu.app/Contents/MacOS/SymQuickMenu
  346   ??  S      0:00.06 /Library/Application Support/Symantec/AntiVirus/SAVDiskMountNotify.app/Contents/MacOS/SAVDiskMountNotify -psn_0_61455
  347   ??  S      0:00.05 /Library/Application Support/Symantec/AntiVirus/ScanNotification.app/Contents/MacOS/ScanNotification -psn_0_69649
  348   ??  S      0:00.05 /Library/Application Support/Norton Solutions Support/Scheduler/SymSecondaryLaunch.app/Contents/MacOS/SymSecondaryLaunch -psn_0_73746
  351   ??  S      0:00.05 /Applications/iTunes.app/Contents/MacOS/iTunesHelper.app/Contents/MacOS/iTunesHelper -psn_0_81940
  352   ??  S      0:00.97 /Applications/Utilities/Adobe Application Manager/UWA/AAM Updates Notifier.app/Contents/MacOS/AAM Updates Notifier -psn_0_86037
  581   ??  R      0:03.20 /Applications/Utilities/Terminal.app/Contents/MacOS/Terminal -psn_0_122910
  669   ??  S      0:28.45 /Applications/Firefox.app/Contents/MacOS/firefox -psn_0_188462
  693   ??  SN     0:00.12 /System/Library/Frameworks/CoreServices.framework/Frameworks/Metadata.framework/Versions/A/Support/mdworker -s mdworker -c MDSImporterWorker -m com.apple.mdworker.pool.0
  695   ??  S      0:00.01 /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CFNetwork.framework/Versions/A/Support/cookied
  700   ??  S      0:04.40 /System/Library/CoreServices/UserNotificationCenter.app/Contents/MacOS/UserNotificationCenter
  584 s000  Ss     0:00.02 login -pf admin
  585 s000  R      0:00.02 -bash
  721 s000  R+     0:00.00 ps x

And this is how to show the amount of remaining disk space on your iMac machine. Use the df -Hla command.

iMac305:~ admin$ df -Hla
Filesystem     Size   Used  Avail Capacity  Mounted on
/dev/disk0s2   300G   140G   159G    47%    /
/dev/disk0s3   700G   630M   699G     1%    /Volumes/Scratch

Here is a one-liner that will only print the IP address of your iMac machine.

iMac305:~ admin$ ifconfig | grep "inet " | cut -d' ' -f2 | awk 'FNR == 2 {print}'
172.18.31.60

That is a very useful command for a systems administrator.

2 responses to “Useful Macintosh OSX terminal commands to get information about your iMac.

Leave a Reply