New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

Start a Discussion

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

lsmac -- Resource fork-savvy version of ls

Post Reply New Thread Subscribe

Thread Tools
Posts: n/a

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:
QUOTE Thanks

Post Reply New Thread Subscribe

« Colored ls | Getting started on developing for OSX. »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

All times are GMT -4. The time now is 10:18 AM.

Powered by vBulletin
Copyright ©2000 - 2015, Jelsoft Enterprises Ltd.

Welcome to

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!

(4 digit year)

Already a member?