Question

While trying to use the find / command to find a vi file using redirection I end up getting every file listed on the unix server. I use 2> to dump the unwanted files in to an find.error file. I'm trying to use 1> to create a file of what I had searched for and a file for the Errors.

Using:

find / find.ls vi 2> find.error

Will display the searched content in the shell and dump the error's in to the find.error.

However if I were to use:

find / 1> find.lst vi 2> find.err

It creates a file that dumps everything from the unix sever in to file.lst and the error in the find.error file.

What I'm looking for should look like this and be created as the find.lst file

/tmp/work/vi

/var/lib/dpkg/alternatives/vi

/usr/share/locale/vi

/usr/share/vim/vim73/lang/vi

/usr/bin/vi

/etc/alternatives/vi

In the end I'm trying to create two separate files.

Thanks

Was it helpful?

Solution

It is not clear what you are trying to do, but it appears that you are just using find incorrectly. I think you want:

find / -name vi > find.lst 2> find.err

You might want to consider using locate instead of find. Scanning the entire filesystem by running find on the root directory can take a significant amount of time.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top