PDA

View Full Version : 3 ways of listing files and directories, any more?



dragos240
July 8th, 2009, 01:11 AM
Hi, I noticed that you can list all the files and directories, 3 ways:

ls
dir
echo *

any more?

andrewc6l
July 8th, 2009, 05:57 AM
find . -maxdepth 1

Trail
July 8th, 2009, 07:54 AM
locate $(pwd), i guess. I don't have locate installed atm to test.

dragos240
July 8th, 2009, 11:29 PM
locate $(pwd), i guess. I don't have locate installed atm to test.
That locates all the files inside the current directory :o

adrianx
July 8th, 2009, 11:31 PM
tree

Trail
July 9th, 2009, 04:59 PM
That locates all the files inside the current directory :o

Ah, you don't want subdirectories...



locate $(pwd) | egrep ^$(pwd) | cut -d'/' -f$(expr 1 + $(echo $PWD/ | tr -cd '/' | wc -c)) | sed /^$/d | sort | uniq


:P

Doesn't work for / though.