Terminal Commands

A collection of my favorite terminal commands

Turn Airport Card Off / On
sudo ifconfig en1 down
sudo ifconfig en1 up

ChFlags – Hide Files
chflags hidden ~/path to file/*
Exanple – chflags hidden ~/Desktop/secret.txt/*

Dock Dividers – Adds dividers to the dock
defaults write com.apple.dock persistent-apps -array-add ‘{tile-data={}; tile-type=”spacer-tile”;}’
Then restart the dock with killall Dock
Divider will appear on far right of dock next to the crosswalk. Drag as you would an application into desired position.

Kill Command
kill PID or killall
Example – Assuming we are using Firefox with a PID of 7764
kill 7764 or killall Firefox
Adding -9 makes it a none ignorable kill (kill -9 PID or killall -9 Firefox)

Last Command – Show last 20 users logged into machine
last -20
Number maybe changed

Open Command
open -a Name Of App
open -a Name/With/Spaces
Type open at the command prompt to see more options


Private Browsing
– Fixed In Snow Leopard
Apple describes Safari’s “Private Browsing” feature as follows:

When you browse the web, Safari stores information about the websites you visit including the content and any user names, passwords, and credit card numbers you enter. Other people who use your computer can view that information. If you don’t want this information stored, use Private Browsing…. If you neglected to turn on Private Browsing before you browsed, choose Safari > Reset Safari.

This seems to imply that using Private Browsing, as well as Reset Safari, will not leave any record on your computer of the sites you have visited. This is not true, however. In Terminal, type this command:

dscacheutil -cachedump -entries Host

This will list all entries cached by Leopard (including the date and time of last access), even when Private Browsing is enabled. Even using Reset Safari will not clear these entries. To manually clear these entries, use the following command in Terminal:

dscacheutil -flushcache

The cache is also cleared once you log out of your Leopard account. While logged in, however, any other account on the system (even Guest users) can execute the above command to view sites you have visited.
[robg adds: We covered flushing the cache in 10.5 in this hint, but the fact that Safari leaves trails even in Private Browsing mode made me feel this was worth sharing. Other browsers may have similar issues in their private browsing modes, but I haven't tested them.]
Private Browsing Via Macfixit

Wget – For downloading files over slow or intermittent connections
GNU Wget is a free software package for retrieving files using HTTP, HTTPS and FTP, the most widely-used Internet protocols. If the server drops the connection wget will query the server to restart sending information without starting the download from the beginning, in other words if your download is 80% done it will start from there.

To use it, download it, and follow to installation instructions.
Mac OSX Andrews Den
Windows Addictive Code

To use wget without to much hassle , fire up Terminal and type wget locationofdownload
Example wget
http://mozilla-mirror.3347.voxcdn.com/pub/mozilla.org/firefox/releases/3.5.5/mac/en-US/Firefox%203.5.5.dmg Image of wget downloading Firefox

Desktop icon clutter really gets to me, but it’s hard to avoid since a lot of apps download things to the Desktop by default. It’s easy to hide the Mac hard drive icons, but what about all the other stuff that gets dumped to your desktop? Well that’s easy to hide too actually, following these instructions:

Clean up the Desktop by Hiding Desktop Icons
Launch Terminal and type the following:
defaults write com.apple.finder CreateDesktop -bool false

After hitting enter, you’ll want to kill the Finder so that it relaunches and the changes take effect:
killall Finder

All of the files will still exist, but they’re now discretely hidden in your home folder’s “Desktop” directory rather than cluttering up your actual desktop.

To show the Desktop icons again, open the Mac Terminal and type the following:
defaults write com.apple.finder CreateDesktop -bool true

Again, kill the Finder and your icons will show on the desktop as usual.
Clean up the Desktop by Hiding Desktop Icons via OSXDaily


More Terminal Commands @ Other Sites

Mactipsandtricks 50 Terminal Commands


About these ads


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.