List all files with full path of the file in Unix Environment


There are several commands out there that will help you list the contents of a directory, such as;

ls -l

There are also recursive options that you can apply that will give you the subdirectory listings and it’s contents such as:

ls -R
ls -Rf
ls -Rl

and so on. However, these options not only list the file name and sometimes only a partial path, but they also include file or directory rights as well as time stamps.

If all you seek is a listing of the contents of a folder and its subdirectories as well as the file name without all that other good stuff then try the following command.

find / -print.

This command will give you a listing of all your computer files, output right on your terminal.

What if we only want to list the contents of a particular directory. Then type the following:

find /home/user/directory_to_be_search -print

If you want to save the results to a text file, then simply add “> textfile.txt” to the end of your command.

For example:

find /home/user/directory_to_be_search > /home/user/documents/directory_listing.txt

this will output my results to a text file in my documents folder named directory_listing.txt that will contain the list of all documents and their paths found in /home/user/directory.

Any questions or comments, please post.

Leave a comment

Filed under Sharing Stuff

Comment on this

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s