The Nexus One, and Android in general, is missing a few basic unix utilities, but we can imitate them with short shell scripts.
whereis:
#! /system/bin/shThe whereis command is used to locate executables. This script will go through every directory in your path and try to list the executable you specify as an argument. If it doesn't find it, the errors go to /dev/null so you only see output if it is found.
echo $PATH | tr ':' '\n' | while read line; do ls "${line}/${1}" 2>/dev/null; done
Examples:
# whereis grep
/system/xbin/grep
# whereis sh
/system/bin/sh
/system/xbin/sh
#
locate:
#! /system/bin/shThe locate command is a bit like the find command, except faster. When it is ran in update mode, it searches through the system and compiles a database of all files, so when asked to locate a certain string, it is able to do so almost instantly by searching it's database. This uses the find command to list all files and put them in my fake locate database at /sdcard/stuff/files, but it could use any file or location you want.
grep -i "$1" /sdcard/stuff/files
Examples:
# locate ncurses
/system/lib/libncurses.so
# locate livewallpaper
/cache/dalvik-cache/system@app@LiveWallpapers.apk@classes.dex
/cache/dalvik-cache/system@app@LiveWallpapersPicker.apk@classes.dex
/system/app/LiveWallpapersPicker.apk
/system/app/LiveWallpapers.apk
/data/data/com.estrongs.android.pop/app_.apps/s.system.app.LiveWallpapers.apk
/data/data/com.estrongs.android.pop/app_.apps/s.system.app.LiveWallpapersPicker.apk
#
locate-update:
#! /system/bin/shThis updates the locate database. Like the normal locate command, it has to be ran once before the locate script will work or else the database will be empty and it won't locate anything.
find / -print > /sdcard/stuff/files