# current dir
ls -alh >> list.txt
# recursive
ls -R -alh >> list.txt
As a tree:
# recursive by default
tree >> list.txt
# recursive
tree -d >> list.txt
Sample output:
tree
.
├── a.txt
├── bash.sh
├── p2shell.py
└── test
└── a.txt
1 directory, 4 files