1

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?

700 Software
  • 2,163
  • 9
  • 47
  • 77

2 Answers2

2

for loop.

for f in *
do
  echo "$f"
done
Ignacio Vazquez-Abrams
  • 45,019
  • 5
  • 78
  • 84
1

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
Suku
  • 2,006
  • 13
  • 15