Shell Script


New Member
I need to create a variable script that uses the "find" utility to search the home directory for files. Example; (./ data) The search also needs to be case-insensitive. The results should look like what is in the attachment.



Well-Known Member
This looks like a homework assignment.

"find" will .. ummm... find files.

find / -name

The "/" is where the search starts from, so if you know the file is somewhere under /home, you could do something like...

find /home -name

the -name flag tells it to match the name exactly.
If you use -iname instead, it becomes case insensitive.

There are other flags such as how many directories deep you want to search,
Do you want to list symbolic links or not?

There are flags for newer files, so that if it finds the same file name more than once
it will show you which is the newest.
You can find files, symbolic links, directories, even sockets.

Most of this can be found out by reading the man pages.

man find



Well-Known Member
name of file will be

well i guess the common element is /home/user/

so start from home
cd ~
echo $(pwd)
ls -l | find -type f

//along those lines geany is quite good for playing with code and running !
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Members online

Latest posts