For a very simple HTTP server, execute this in the directory you would like to serve. The default port is 8000. So http://<ip address>:8000/ will get you to there.
python -m SimpleHTTPServer
By default OS X logs all of the download you have made since the installation of the operating system. From what I have seen this isn't cleaned with off the shelf privacy cleaners. Could be a valuable tool to those doing OS X forensics. You can view this download database with:
sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 'select LSQuarantineDataURLString from LSQuarantineEvent'
To delete this database:
sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 'delete from LSQuarantineEvent'
There is a really nice "hidden" setting in both Lion and Mountain Lion which allows for changing the look of the stack list menu. Apple really should make this the default:
defaults write com.apple.dock use-new-list-stack -bool YES; killall Dock
Show full path in Finder
defaults write com.apple.finder _FXShowPosixPathInTitle -bool YES; killall Finder
Clear DNS cache in OS X 10.10
Keeps the display from sleeping. Maintains this state until caffeinate is terminated. OS X Mountain Lion only.
You might noticed that OS X occasionally shows duplicate application entries when doing a file "open with" in finder. This can be easily fixed by running the command:
LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain user;killall Finder;
echo "Open With has been rebuilt, Finder will relaunch"
I have found the following nettop commands useful in my troubleshooting of IPv6 connections
nettop -n -m route
It is possible to get quite a speed boost out of Mail.app by stripping all the bloat out of its Envelope index. Since mail.app uses sqlite we can use the vacuum command. The below command works in OS X Lion:
sqlite3 ~/Library/Mail/V2/MailData/Envelope\ Index vacuum;
To monitor file writes and reads to and from the disk. The activity will be recorded in the output.txt file. Use control-C to quit.
sudo fs_usage -e -w > ~/output.txt
To Create a DMG from a folder:
hdiutil create name.dmg -srcfolder ~/Desktop/FolderName
To restart the OS X dock:
Restart Dock or killall Dock
You may notice if you use network shares that OS X leaves .DSShare files on the network shares. While these aren’t visable to OS X users, if you have other users accessing the same share they will see these files in every directory. Since these files simply save the appearance of the folder in OS X, disabling it shouldn’t have any adverse effect:
defaults write com.apple.desktopservices DSDontWriteNetworkStores true
In order to eject a stuck CD/DVD you can use the below command. Sometimes the CD remains in the tray but a desktop icon is no longer visable. This command line eject command will eject the CD.
drutil tray eject
drutil tray open
To reset a login password, start OS X with command+S which will start the system in single user mode. Then type:
fsck -fy mount -uw / launchctl load \
dscl . -passwd /Users/UserName newpassword
To convert a DMG file to an ISO File:
hdiutil convert /path/to/filename.dmg -format UDTO -o /path/to/savefile.iso
List open TCP/UDP ports:
netstat -lnp TCP
netstat -lnp UDP
lsof -i -P
List contents of DMG/PKG files:
lsbom .pkg/Contents/Archive.com> |more