ls

ls

Post by Joseph Coutu » Fri, 07 Jun 1996 04:00:00



When doing an 'ls' on a directory other than the 'pwd', how would one
suppress the subdirectories string that is generated before the
filename? I would like a list of the files only, I know which
directory to files are in.  

 
 
 

ls

Post by Kurt J Lan » Fri, 07 Jun 1996 04:00:00



>When doing an 'ls' on a directory other than the 'pwd', how would one
>suppress the subdirectories string that is generated before the
>filename? I would like a list of the files only, I know which
>directory to files are in.  

Bourne shell:

        ( cd dir ; ls )

Ie, do it in a subshell. Other shells, idunno. Hope this
helps.
--
--


 
 
 

ls

Post by John Hobso » Fri, 07 Jun 1996 04:00:00



> When doing an 'ls' on a directory other than the 'pwd', how would one
> suppress the subdirectories string that is generated before the
> filename? I would like a list of the files only, I know which
> directory to files are in.

RTFM basename(1)

--
John Hobson                      |The Mahatma Gandhi was once asked, "Mr
Unix Support Group               |Gandhi, what do you think of Western
Commonwealth Edison, Chicago, IL |Civilization?" He replied, "I think

 
 
 

ls

Post by Bill Marc » Fri, 07 Jun 1996 04:00:00




>When doing an 'ls' on a directory other than the 'pwd', how would one
>suppress the subdirectories string that is generated before the
>filename? I would like a list of the files only, I know which
>directory to files are in.  

(cd /foo/bar; ls)

Because the commands are in parentheses, they run in a subshell and the
"cd" won't affect your current shell.
--

On 22 July, 1996, at 6:00 pm GMT, everyone in the world    
just START HUMMING.  Those who don't know will freak.      

 
 
 

ls

Post by krol » Sat, 08 Jun 1996 04:00:00



> When doing an 'ls' on a directory other than the 'pwd', how would one
> suppress the subdirectories string that is generated before the
> filename? I would like a list of the files only, I know which
> directory to files are in.

I don't know if you can do this just using ls, but

ls -1 | awk -F\/ '{print $NF}'

(note its ls - "one" not ls - "el") should do the trick.