Mac OS X Hints

Today's Best Tech Deals

Picked by Macworld's Editors

Top Deals On Great Products

Picked by Techconnect's Editors

1 2 3 4 Page 3
Page 3 of 4

Check It Out: Extend Safari’s History

Safari’s History menu lets you easily revisit sites you’ve seen recently. The key word here is recently —by default, Safari stores the last 100 sites visited within the last seven days. But if you’d like to keep a longer history, you can. With Terminal, it’s easy. Quit Safari and launch Terminal (/Applications/Utilities). Type this command:

defaults write com.apple.Safari WebKitHistoryItemLimit 9999
.

Press return. Then type this command and press return:

defaults write com.apple.Safari WebKitHistoryAgeInDaysLimit 365
.

The first line tells Safari to remember 9,999 items; the second tells it to remember things for up to a year. That’s it. Now you’ll find that your history file just keeps growing and growing and growing.

One caveat is that large history files can really slow Safari down. To set a different time period, just change the

365
in the second line to a smaller number of days you’d like to record in your history, and reduce the number of items to a level that suits your browsing habits. For instance, 30 sites a day for 90 days would be 2,700 entries.

Unix Tip of the Month: Make Terminal Output More Humane

There are three very handy Unix commands for looking at the stuff on your drive. If you delve into Terminal (/Applications/Utilities) at all, you’re probably familiar with

ls
, which lists the contents of a folder. But you may not be aware of
df
, which reports on total disk-space utilization, and
du
, which shows disk usage at the folder level.

Though each of these tools is useful in its own right, they don’t necessarily present the output in the most user-friendly format. Consider the

du
command. If you run
du /usr/local
, the output will include something like this:

25056 ./php/bin
80 ./php/doc/libiconv
80 ./php/doc

The first number shows the size of each folder, stated in the arcane measurement system of file system block usage. While that may be useful for the ultrageek, it doesn’t give you a real sense of folder size.

Enter the

-h
option. This flag, which you can add to
du
,
df
, and
ls
, is the human-readable flag. For example, if you changed the previous example to
du -h /usr/local
, you’d get output that included the following:

12M ./php/bin
40K ./php/doc/libiconv
40K ./php/doc

It’s now much clearer that the bin folder takes up 12M, or 12MB, of your hard drive. The abbreviations you’re likely to see, in addition to

M
(for megabytes), are
K
(kilobytes),
B
(bytes), and
G
(gigabytes).

As you play with the human-readable option, you’ll probably find that

ls -lh
is a much more useful version of
ls -l
(the
-l
in both commands gets you long output, which includes file-size information). If you’d like to make it easier to use the command often, create a new alias for it. This sets up a shortcut that types the modified command for you. To do this, put a .bash_profile file in your Home folder by typing
pico ~/.bash_profile
. (If the file already exists, this command will just edit it.) Then add this line:
alias lsh="ls -lh"
.

When you’re done, press control-X, and then press Y to indicate that you want to save the changes. Finally, press return to save the file.

The next time you open a Terminal window, you’ll be able to type just

lsh
to run the human-readable version of the command. The command
lsh ~/Documents
, for instance, will show your Documents folder in its full human-readable form.

[ Senior Editor Rob Griffiths is the author of Mac OS X Power Hound, Panther Edition (O’Reilly, 2004), and runs the Mac OS X Hints Web site. ]

1 2 3 4 Page 3
Page 3 of 4
  
Shop Tech Products at Amazon