beyond ls

When you start learning unix then the ls command is probably one of the first ones you come accross. It lists files. You need that. Allot. It is pretty easy to overlook that there is much more to files these days then the information that the ls command will provide you with. For OS X you have these additional commands that you can try:

stat -x FILENAME
This is a standard unix command. Helpful if you are looking for modification or access times or simply need to know which inode a file is starting on.

/Developer/Tools/GetFileInfo FILENAME
The default filesystem for OS X is HFS+. This can store extended attributes with your file, and if you have the free developer option insalled then you can use this to read the extended attributes. /Developer/Tools might be worth a casual ls as it contains a couple of other interesting tools

ls -ls FILENAME/rsrc
HFS+ allows files to have a so called ‘resource fork’. By adding /rsrc after the file name you can use the ls and even the cp command on these parts of the file.

With OS X 10.4 apple introduced a searchable file content meta database. The spotlight icon sits prominently in the uppper right corner of the screen. But also in a command line you can access the information via mdls and a couple of other tools.

All these commands have a man page in case you need to know some details of how they work.

Leave a Reply

You must be logged in to post a comment.