User Name
Password
AppleNova Forums » Genius Bar »

Directory tree printout


Register Members List Calendar Search FAQ Posting Guidelines
Directory tree printout
Thread Tools
MSFT
Member
 
Join Date: Aug 2006
Location: USA
 
2008-01-12, 14:08

Hello!

I was wondering if there's a Terminal equivalent of Windows' cmd > dir command. In addition, I was wondering if it was possible to print the results of the directory to a .txt file.
  quote
chucker
 
Join Date: May 2004
Location: near Bremen, Germany
Send a message via ICQ to chucker Send a message via AIM to chucker Send a message via MSN to chucker Send a message via Yahoo to chucker Send a message via Skype™ to chucker 
2008-01-12, 14:13

Quote:
Originally Posted by MSFT View Post
Hello!

I was wondering if there's a Terminal equivalent of Windows' cmd > dir command.
ls

ls -l for a long list

ls -R for recursive

ls -t for sorting by time
or ls -S by size
or ls -Sr for size, reverse

etc.

Try 'man help' for a whole lot of info to swallow. As another example, ls -G colorizes the output.

Quote:
In addition, I was wondering if it was possible to print the results of the directory to a .txt file.
Sure, just append > filename, just like in DOS.

E.g., (cd ~; ls -lR > foo.txt) creates a file foo.txt in your home directory with all subdirectories.
  quote
MSFT
Member
 
Join Date: Aug 2006
Location: USA
 
2008-01-12, 14:44

Hooray! Many thanks for your help!
  quote
Yonzie
Mac Mini Maniac
 
Join Date: Sep 2005
 
2008-01-12, 18:54

a related command that may be interesting to you is du, short for Disk Usage.
Example output:
Code:
Ran-chan:~ yonzie$ du -sch * 75G Desktop 30M Documents 372K Downloads 1,3G Library 0B Movies 6,8G Music 11G Pictures 0B Public 40K Sites 20K hetland.html 4,0K index.php 94G total
Get more information in the manual by typing "man du".
  quote
Posting Rules Navigation
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Post Reply

Forum Jump
Thread Tools
Similar Threads
Thread Thread Starter Forum Replies Last Post
Viewing file list on a directory with an index page... PKIDelirium Programmer's Nook 3 2006-12-12 11:23
The perfect Christmas tree for the larger living room Dorian Gray AppleOutsider 5 2006-12-03 18:08
Python -- Directory content differences Wickers Programmer's Nook 12 2006-03-19 13:32
Darwine Requirements doublem9876 Third-Party Products 2 2006-02-26 10:58
How Can You Reconstruct the File Directory After Disk Utility? SilverGoat Genius Bar 0 2005-03-06 08:27


« Previous Thread | Next Thread »

All times are GMT -5. The time now is 08:09.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004 - 2024, AppleNova