I am trying to put the result of a find command to a text file on a unix bash shell
Using:
find ~/* -name "*.txt" -print > list_of_txt_files.list
However the list_of_txt_files.list stays empty and I have to kill the find to have it return the command prompt. I do have many txt files in my home directory
Alternatively How do I save the result of a find command to a text file from the commandline. I thought that this should work
The first thing I would do is use single quotes (some shells will expand the wildcards, though I don’t think
bashdoes, at least by default), and the first argument tofindis a directory, not a list of files:Beyond that, it may just be taking a long time, though I can’t imagine anyone having that many text files (you say you have a lot but it would have to be pretty massive to slow down
find). Try it first without the redirection and see what it outputs: