There are a few very useful UNIX commands available on the Apple Macintosh. Mountain Lion is what I am using in Virtualbox and I am having a look at some very useful shell commands and tips.
The iostat command. This shows statistics of disk Input/Output.
Homers-iMac:Documents homer$ iostat disk0 disk1 cpu load average KB/t tps MB/s KB/t tps MB/s us sy id 1m 5m 15m 50.87 26 1.29 6.00 0 0.00 6 12 82 0.54 0.77 0.46 |
The mount command. This lists the mounted devices on your Macintosh system.
Homers-iMac:Documents homer$ mount /dev/disk0s2 on / (hfs, local, journaled) devfs on /dev (devfs, local, nobrowse) /dev/disk0s1 on /Volumes/Stuff (hfs, local, journaled) map -hosts on /net (autofs, nosuid, automounted, nobrowse) map auto_home on /home (autofs, automounted, nobrowse) /dev/disk1s2 on /Volumes/HackBoot (hfs, local, nodev, nosuid, read-only, noowners) |
Print out a list of all environment variables.
Homers-iMac:Documents homer$ env TERM_PROGRAM=Apple_Terminal TERM=xterm-256color SHELL=/bin/bash TMPDIR=/var/folders/vz/_w250wmn4513bd3tlt2f6y000000gn/T/ Apple_PubSub_Socket_Render=/tmp/launch-FHLN1N/Render TERM_PROGRAM_VERSION=309 TERM_SESSION_ID=EF27B59E-FD6E-451E-81E1-C4053136C62B USER=homer COMMAND_MODE=unix2003 SSH_AUTH_SOCK=/tmp/launch-GTtfht/Listeners __CF_USER_TEXT_ENCODING=0x1F5:0:0 Apple_Ubiquity_Message=/tmp/launch-QfcR8j/Apple_Ubiquity_Message PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin PWD=/Users/homer/Documents LANG=en_AU.UTF-8 SHLVL=1 HOME=/Users/homer LOGNAME=homer SECURITYSESSIONID=186a4 _=/usr/bin/env OLDPWD=/Users/homer |
See a listing of all commands in the .bash_history file weeding out all duplicates.
Homers-iMac:~ homer$ uniq .bash_history uname -a dscl arp -a tree echo $0 echo $1 echo $1 hello sudo shutdown -h now sudo -s -lah /var/db/dslocal/nodes/Default/users/ sudo ls -lah /var/db/dslocal/nodes/Default/users/ netstat clear cls clear who am i whoami uname -a sudo dscl cls clear ps ax cd / ls cd System/ ls cd Library/ ls cd .. ls cd /System/Library/Displays/Overrides/ ls ioreg -lw0 | grep IODisplayPrefsKey mc sudo shutdown -h now arp -a sudo shutdown -h now |
The uniq command may be used on its own without the need for cat. That is another lesson I have learned. You should stop the overuse of cat. This article explains this very well.