lsmac -- Resource fork-savvy version of ls



Sveinbjorn Thordarson has released a new, free, open source, "Mac compatible" version of ls called lsmac. Here's what he had to say about it:
I've made a command line unix program similar to ls but with a Mac twist. It's called lsmac (48K download), and it sports the following features:

* Lists the files within a directory
* Can display file size in human-readable format (i.e. 1.2MB instead of 12759024 bytes)
* Displays the size of all the file's forks, including the heritage resource fork, not just the data fork like ls!
* Displays file and creator types
* Displays the Finder flags that are set

Apple supplies command line utilities with the Developer Tools that share some of this functionality, but they operate on a file-by-file basis. lsmac is free, open-source GPL'd software.
lsmac can be installed using a shell script installer or via source compile. (The shell script install automatically installs the man page, which otherwise needs to copied in place by hand. The shell script installs lsmac in /usr/bin by default, but it's easy to change the default to /usr/local/bin or /opt, if desired.

Here is an output sample:
% lsmac
-C----  8BPS 8BIM    201 KB  2002NewYear.psd
------  JPEG 8BIM     21 KB  2003newyear.jpg
------  TIFF ogle      7 KB  999 mark.tiff
------  JPEG 8BIM    211 KB  bday_big.jpg
-C----  8BPS 8BIM    1.7 MB  birthday2.psd
-C----  JPEG GKON    119 KB  calendar.jpg
------                47 KB  calendar.tiff
------    4 items      -     Classic Scripts/
------  ???? ????      3 KB  config.php
------    2 items      -     docs/
------  ???? ????     18 KB  english.php
------  TEXT R*ch      1 KB  example of posting code
------                11 KB  FAQ text.txt
------  XLS8 XCEL     12 KB  forum activity.xls
------  XLS8 XCEL     19 KB  forum stats.xls
Here are some of the flags available:
# -s Display file size in human-readable format (i.e. 1.2MB or 327KB)
# -b Display file size in bytes (i.e. 12977128 bytes)
# -o Omit folders when listing directory contents
# -a Display all files, including files with the . prefix.
# -p Display full file paths instead of file names
# -l When listing file size, use physical size instead of logical size.
Download it here:
tp:// (outdated link removed)
Last edited by a moderator:

Shop Amazon

Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.