ls...without ls?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers ls...without ls?
# 1  
Old 11-22-2009
ls...without ls?

is their any way to retrieve the directory listing with cat?, i'm telneted into my home router flashed with dd-wrt and the very basic command ls isn't their, i have cd, cat, and several other basics but no ls=-( is this possible, if so much help is appreciated, i've googled for the answer in both the dd-wrt forums and google itself to no avail
# 2  
Old 11-22-2009
try echo *
# 3  
Old 11-22-2009
Try just
Code:
find

# 4  
Old 11-22-2009
To print 1 entry per line:
Code:
for i in *; do echo $i; done

Hidden files/dirs too:
Code:
for i in .* *; do echo $i; done

to put a slash behind directories
Code:
for i in *; do if [ -d $i ]; then i="$i/"; fi ; echo $i; done

# 5  
Old 11-22-2009
thanks all, this is exactly what i needed, thanks for the help=-)

edit: sorry to keep asking, but is their any way to retireve file permissions through echo as well?
# 6  
Old 11-22-2009
if you want to see ls output without executing ls ... and permissions also.,

try stat.

stat -c '%A %n' *

Code:
$ stat -c '%A %n' *
drwx------ atop.d
drwx------ keyring-BqEeA5
drwx------ orbit-gdm
drwx------ orbit-sathiya
drwx------ pulse-PKdhtXMmr18n
drwx------ pulse-TOfOFmY3lXDd
srwxr-xr-x scim-bridge-0.3.0.socket-1000@localhost:0.0
srw------- scim-helper-manager-socket-sathiya
srw------- scim-panel-socket:0-sathiya
srw------- scim-socket-frontend-sathiya
drwx------ seahorse-5rUoxr
drwx------ ssh-ewfznM1773
-rw-r--r-- test
-rw-r--r-- test-etc-cron
drwx------ virtual-sathiya.JiIscg

If you want more informations, such as user id, group id, time of last modification, use appropriate format sequence in stat: stat(1): file/file system status - Linux man page
# 7  
Old 11-23-2009
unfortuantly stat is not among the list of commands i have to use
 
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question