From time to time I need to change some configurations or I need a command that I used a long time ago. Because I don’t execute these commands all time I forget them very soon. That’s why I’ll post them here.
Show hidden files in Finder
By default Finder doesn’t show hidden files and there’s no way to change it in the preferences. You have to execute this in your shell:
defaults write com.apple.finder AppleShowAllFiles TRUE # show hidden files
killall Finder # restart Finder
(Un) Installing program packages (.mpkg | .pkg)
Sometimes I want to know first what files are going to be installed. With pax I can take a look at the file list. To be sure to have completely uninstalled an application you can check it by using lsbom.
pax -z -f <Package.pkg/Contents/archive.pax.gz> # List files that will be installed in the system
lsbom <Package.pkg/Contens/archive.bom> # List all files that should be removed to uninstall the package
MySQL
I had trouble with phpMyAdmin loading a dump file. I found out that it’s a common problem that it get stuck on a Mac machine. So I had to do it in the shell by using the following line. Further details about the command can be found on the man page.
mysql --user=user_name --password=your_password db_name < dump_file.sql
Re-indexing folders or volumes
If you need to re-index folders or volumes you can do this with mdutil. Sometimes the index is damaged and therefore you have to delete .Spotlight-V100 first. You need the required root permission so sudo is prefixed.
sudo rm -r /Volumes/<Volumename>/.Spotlight-V100
sudo mdutil -E /Volumes/<Volumename>
Get CPU information of your machine
sysctl -a | grep -i "dep.cpu"
I used this command to find out if my cpu supports vtx. And it does
Printing
For multiple page printing I use mpage and psbind (a smarter psnup).
mpage -2f -Pokiprinter textfile
mpage -2f -Pokiprinter textfile.ps
okiprinter is the name of my Oki printer
To print a header and page numbers genscript is useful.
Generating a GUID
A GUID (Global Unique ID), also known as UUID (Universally Unique ID), can be generated by uuidgen which should be installed by default by your Linux or Mac OS.
uuidgen
A unique ID is created using your MAC address amongst others. It looks like 8AF8EEEC-3472-48B0-A74B-B2B3820EA6FE.