What is the equivalent to locate command in KornShell?
I am using KornShell (ksh) and I need to know what开发者_JAVA技巧 is the command to search a file in the system?
I have used locate in bash looking for a similar one.
Kindly help.
You can use "find" command to search for a particular file in the system. There are various option to search by name,size,time,etc You can refer to man find for more help.
E.g. find . -name abc will search abc file in the current directory and subdirectories
locate
is not a bash-internal command, it is an external program. Provided that /usr/bin/locate
is installed and in your $PATH
environment variable, it should work just the same in ksh
.
Try
which cmdName
and/or
whence cmdName
where of course, you replace cmdName with the command you are searching for.
which1 will searchs the $PATH variable, while
whence` (if available on your system) searchs $PATH, aliases and functions.
I hope this helps.
P.S. as you appear to be a new user, if you get an answer that helps you please remember to use the check mark to accept the answer, and/or give it a + (or -) as a useful answer.
old post but imho still important:
locate
is not the same as find
. locate
keeps a database of filenames, in which it searches for the files. It is therefore faster but less up-to-date than find
, which browses the actual directories on the fly.
精彩评论