This could be done from the command line using:
tree -d / > textfile.txt 2> /dev/null
while logged into that account. This would provide a long-form directory listing recursively, write the output to textfile.txt
and the errors to the blackhole that is /dev/null
. If you want to keep the errors remove the 2>
redirect. If done from the root account, you can add sudo -u <username>
to the beginning of the command to perform the task as another user. If it needs to be a script you could either just drop the command into a shell script, or if you only need to do this yourself and want ease of access, you could make an alias with the command.
Edit: Now that you've added that you're on RHEL, I know of two different ways of handling this. If you don't need to actually draw the tree structure but just want a recursive listing of directories, you can switch tree -d
for find / -type d -ls
or, were you to have installation priveleges, run yum install tree
.