find . -maxdepth 1
how to omit ./ current directory prefix from the output?
Also is there any way to ls the output separated by newlines AND containing only file/dir name field(e.g. no file attributes), like this
file1.txt
dir1
file2.txt
dir2
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use
ls -1to get the output you want fromls. From thels(1)man page:The
-1format is also the default when the output oflsisn’t a terminal.To strip the
./fromfind, I’d just do: