For Those who does not know, the OS X Terminal is a powerful way to interact with the computer. you can nearly perform all kinds of operations using text commands there are many resources you can learn from like: Taming the Terminal by Josh Johnson. Here I’m listing some useful and handy commands that can be used regularly or to tweak your system.

Show Hidden Files

defaults write com.apple.finder AppleShowAllFiles -bool TRUE killall Finder

Enable Text Selection in Quick View

defaults write com.apple.finder QLEnableTextSelection -bool TRUE killall Finder

Remove Duplicate “Open With…” Entries

/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user

Disable Adobe Create Cloud launch on startup

launchctl unload -w /Library/LaunchAgents/com.adobe.AdobeCreativeCloud.plist

Ditto
ditto is a great tool to copy files/folders and create and extract archives

ditto [source] [destination]

Copy Folder:

ditto -V /Projects/Testing /Projects/Old/Testing

Copy without metadata:

ditto -V --norsrc /Projects/Testing /Projects/Old/Testing

Remove Dot Files from External Hard Drives

sudo dot_clean find ._.* -delete find .DS_Store* -delete

Change File Text Encoding

iconv -f input_encoding -t output_encoding input_file >> output_file
iconv -f windows-1256 -t utf-8 somefile.txt >> newfile.txt

Start HTTP Server in a folder

python -m SimpleHTTPServer 8000

Get your external IP

curl ipecho.net/plain; echo

Scutil

scutil can be used to manage system configuration parameters, also it can be used to manage VPN connections like follow:

Get Connected VPN Connections

scutil --nc list | grep connected

Connect to VPN Connection

scutil --nc start [ConnectionName]

Connection credentials can be set optionally

scutil --nc start [ConnectionName] --user [UserName] --password [Password] --secret [PreSharedKey]

Disconnect VPN Connection

scutil --nc stop [ConnectionName]
Categories: Tips

Leave a Reply

Your email address will not be published. Required fields are marked *