Operating System - HP-UX
1833514 Members
8134 Online
110061 Solutions
New Discussion

Re: How to do an ls and show the path

 
SOLVED
Go to solution
Carme Torca
Super Advisor

How to do an ls and show the path

Hi,

I would like to list all the directories and files of one dir.
Is there any instruccion to make it?

For exemple:

/tmp
/tmp/dir1
/tmp/dir1/file1
/tmp/dir2
/tmp/dir2/file1
/tmp/dir3
/tmp/file1
/tmp/file4

Thanks a lot of,
Carmen.
Users are not too bad ;-)
10 REPLIES 10
James R. Ferguson
Acclaimed Contributor
Solution

Re: How to do an ls and show the path

Hi Carmen:

One way:

# find /tmp

Regards!

...JRF...
James R. Ferguson
Acclaimed Contributor

Re: How to do an ls and show the path

Hi (again):

Of course, if you want to include more of the attributes, do:

# find /tmp -exec ls -ld {} \+

Regards!

...JRF...
Adam Winebaugh
Regular Advisor

Re: How to do an ls and show the path

Carme,
You can break it down even more say by size with:
find /opt -mount -mtime -1 -type f -ls -ld| awk '{ print $7 " " $11 }' | sort -n | tail -20


Many variables to manage and change though dependant on what you need.
Adam Winebaugh
Regular Advisor

Re: How to do an ls and show the path

My apologies I wrote the wrong command down. Here is what I meant! Sorry about that

find /tmp -type f -size +1000000c -exec ls -ld {} \; | sort -rn | more

Or you can switch sizes or names or whatever you want basically.
Adam Winebaugh
Regular Advisor

Re: How to do an ls and show the path

OR sorry to keep posting here, this is another way:

find /tmp -type f â xdev -size +1000000c -exec ls -ld {} \; | sort -rn | more


Ok I will leave you all alone now. Good Luck.
Sajjad Sahir
Honored Contributor

Re: How to do an ls and show the path


dear carme

see find command

man find


thanks and regards

sajjad
Bill Hassell
Honored Contributor

Re: How to do an ls and show the path

The simplest way is:

ls -R -1 /tmp

The ls man page is quite large with all the extra options.


Bill Hassell, sysadmin
john D_3
Frequent Advisor

Re: How to do an ls and show the path

ls -R *[1-4]*
john D_3
Frequent Advisor

Re: How to do an ls and show the path

ls -R /tmp/*[1-4]*
CharlesC
Advisor

Re: How to do an ls and show the path

I think "ls *" should do the trick already.
What if...