tips

Copy files and directories recursively with tar

Copying a directory tree and its contents to another filesystem using


cp -pR directory /newplace

doesn't always do the job.

Using tar instead will preserve ownership, permissions, and timestamps. This neat trick allows using tar to perform a recursive copy without creating an intermediate tar file and overcoming all cp shortcomings.

To copy all of the files and subdirectories in the current working directory to the directory /target, use:


tar cf - * | ( cd /target; tar xfp -)

How to Download & Save Flash Animation Files (SWF) in Firefox

There's a good chance that the animation or cartoon game you want to download was created using Flash. Use these tips for downloading Flash files from the Internet to your hard drive. You save all Flash animations from web pages, including Flash websites, Flash game, Flash Animations, Flash Tutorials, Flash Movie Trailers, Flash Advertisements, or what ever Flash files you find in the web.

If you wish to save flash files embedded in webpages to your hard-drive for offline viewing, here is how:

How to empty a MySQL database from the shell (drop all tables)

Let’s say you need to drop all tables in a mysql database. How do you do that?

MySQL has DROP TABLE and DROP DATABASE but there is no command to drop all tables or truncate the database.

These are some ways to do it:

Change the default screenshot format

In the Terminal type

defaults write com.apple.screencapture type image_format
#  image_format can be jpg, pdf ,etc
killall SystemUIServer
# to implement the new screenshot format

List of open files on a volume

in

A Useful and Interesting Terminal Command

System Message: WARNING/2 (<stdin>, line 2)

Title underline too short.

A Useful and Interesting Terminal Command
================================

lsof and fstat

lsof and fstat list open files. This can be very handy for overcoming the "Cannot eject disk X because it is in use" error.

Try:

fstat | grep volumeName

to get the list of files open on that volume.

How to use your PowerBook G4, MacBook Pro or MacBook with the display closed

If you use an external display or projector with any MacBook Pro or PowerBook G4 and a USB mouse or keyboard, you can close the display and still use the computer. Here's how.

  1. Make sure the computer is plugged in to an outlet using the AC power adapter.
  2. Connect a USB keyboard and mouse to your computer.
  3. Connect the Apple video (VGA or DVI) adapter that came with your computer to the appropriate port on the external display or projector and turn the display or projector on.

OS X boot keys

Startup Keystroke Description

Command-S Boot into Single User Mode

Command-V Boot using "Verbose" mode (shows all kernel and startup console messages)

X Reset startup disk selection and boot into Mac OS X Server

Shift Boot into "Safe Boot" mode, which runs Disk First Aid. A reboot will be required afterward.

Option Boot into Open Firmware to select a boot device

Command-Option-Shift-Delete Bypass internal harddrive on boot

T Boot into Firewire target disk mode

Quick OS X (and Emacs) Keystroke Reference

Emacs keystrokes supported by all OS X applications that use native text widgets.

Syndicate content