Hi there.
I need to list all the sh extension files, from a particular user, that exists on a computer. How can I do it?
Thanks for reading.
Hi there.
I need to list all the sh extension files, from a particular user, that exists on a computer. How can I do it?
Thanks for reading.
Check the -user option in the man page of find.
Hi Franklin52.
Actually I do this:
find / -user user_name | grep "*.sh"
It works but it only search into directories that resides under the path of the script and I want to do it all over the HD. Any idea?
Thanks for reading.
find / really should search all over the disk. can you give an example of a file it's not finding? A directory in its path might really be a symlink to somewhere else. Or you might simply not have permissions to search those directories.
Sorry but I could not answer before. I have solved the problem but I still have a doubt. The next first code give me all the scripts of my computer but also give me some files that ends with ".bsh". Why I get this files if I'm only searching for ".sh$" files?
find / -user user_name 2> /dev/null | grep ".sh$"
Thanks for reading.
Hi.
Because in a regular expression a dot matches anything. Escape the dot
find / -user user_name 2> /dev/null | grep "\.sh$"
Is it not better to do something like:
find / -name "*.sh" -user user_name 2> /dev/null
Yes, I use the second code but about the first code, I have solved the problem escaping the dot. The problem was that I have proved to scape the dot, before your answer, but not using quotes. Using quotes like this "\.sh$", it works.
Many thanks.