Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I would like an output similar to ls -1d, but I don't want to check if each file exists. I would prefer to just list the files. I could use echo, but echo only puts a space between files.

How can I put a return between the files/parameters?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

for loop.

for f in *
do
  echo "$f"
done
share|improve this answer
    
For those who care, all on one line is for f in *; do echo "$f"; done –  George Bailey Apr 5 '11 at 13:57

As far as I understand from your question, you can use find

find /opt -maxdepth 1

For printing file names only

find /opt -maxdepth 1 -type f

For printing directory names only

find /opt -maxdepth 1 -type d
share|improve this answer
    
+1 You are probably right. Good information. –  George Bailey Apr 5 '11 at 14:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.