Updating /etc/hosts on OS X
Sometimes you need to have a static IP address configured to a specific domain name on OS X. For instance, locally testing a web server is a great reason to do this. Doing so is fairly easy to setup, but does take a bit of command line work.
First, edit /etc/hosts with your favorite text editor.
the default looks something like this:
# Host Database
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
Edit the file, add in the IP address under the 255.255.255.255 address, then put in the hostname with spaces over under “localhost.”
Then you have to reload the hosts file.
OS X 10.4 type:
sudo niload -v -m hosts . < /etc/hosts
on OS X 10.5 and 10.6
Then simply ping the new domain name and check that is resolves to the correct IP address. (assuming the other computer is setup to respond correctly)
How To: Force Safari to Download PDF Files
I hate having my Internet Browser display PDF files when I click on them. I much prefer them to be downloaded. Here are two commands that changes this default behavior.
in terminal (as Admin or Root user) type:
defaults write com.apple.Safari
WebKitOmitPDFSupport -bool YES
Essentially you’re removing PDF Support from Safari so that it doesn’t know what to do with the files. Safari simply downloads the file to the /User/Downloads directory instead.
Keep in mind that updating Safari or Adobe Acrobat may change the PDF handling behavior back to the default. Yes, it is also possible to right click on a PDF and use “Download Linked File,” but this process is more automated.
How To: Update Locate database
Here is the command used to update the Locate Database in OS X.
Linux: Printer Commands
Using the Printconf command (Printer Configuration)
Install printer: printconf
To see printers: lpstat -p
After configuring printers, export printer settings to another machine:
printconf-tui –Xexport > printers.ppd
Copy file to new computer then import:
printconf-tui –Ximport < printers.pdd
After setting up printers restart cups.
service cups restart
How to: fix invalid /LABEL=xxx
After getting invalid /LABEL=xxx
Boot into single user mode:
Type in Root password
type: “mount -w -o remount /dev/device”
type: “vi /etc/fstab” remove or comment out (# in front) offending line
type “:wq!” (quit VI)