Useful OSX command line tools for listing system information.
Credit to: http://www.infoworld.com/d/applications/top-20-os-x-command-line-secrets-power-users-202466?page=0,2
create filetree alias
$ alias filetree="ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/'"
$ filetree
Sample results:
|-----kilroy
|-------Library
|---------Application Support
|-----------AddressBook
|-------------Images
|---------------CachedMacDotComPhotos
|---Full of Stars.app
Find using spotlight
locate <stuff>
Reveal open TCP and UDP ports and what is using them
lsof -i | grep ESTABLISHED
Networksetup: Retrieve or set network configuration values
$ networksetup -getdnsservers ethernet
It might display:
68.238.64.12
68.238.128.12
8.8.8.8
4.2.2.1
And to turn Wi-Fi on or off:
$ networksetup -setairportpower airport on
$ networksetup -setairportpower airport off
To open a document in an application other than the one for file type: $ open -a bbedit junko.txt
compare files
$ opendiff Contract1.rtf Contract2.rtf
quick look
qlmanage -p filename
- scutil: Set the computer host name
$ sudo scutil --set ComputerName "newname"
$ sudo scutil --set LocalHostName "newname"
$ sudo scutil --set HostName "newname"
sysctl: Get CPU information and other internal secrets
$ sysctl -n machdep.cpu.brand_string
Textutil: Convert between various text file formats
To convert a Word document into HTML:
$ textutil -convert html MyWordFile -output /tmp/webfile.html
To display textutil's interpretation of a document's file format:
$ textutil -info MyWordFile
It might display:
Type: Word format
Size: 45568 bytes
Length: 4354 characters
Title:
Author: Mel Beckman
Last Editor: Mel Beckman
Subject:
Keywords:
Created: 2012-07-08 09:11:00 -0700
Last Modified: 2012-09-13 11:52:00 -0700
Contents: Q. I have a question about wri...