The syntax is different as well. With find, you had to specify what directory to search in, whereas locate automatically chose the root directory. And you had to specify a search by name using the -name option. You could also have searched for files using many other criteria, such as modification date or owner. To have find search for files whose names match XF86Config, you’d have to use a wildcard:
Like most of the command line tools, find accepts wildcards as arguments.
In general, find is a more powerful utility, and locate is faster for everyday quick searches. The full range of possible searches would take a long time to explain; for more details , type info find, which will bring up the very thorough info pages on find and locate.
Debian comes with a utility that can guess at the contents of a file for you. Although it is not 100% accurate, you can use the following command to explore your system:
/bin/cp: ELF 32-bit LSB executable, Intel 386, version 1 / / / / Skipping the technical parts, this is an executable file for Intel machines.
The preceding command gives this response:
/etc/init.d/boot: Bourne shell script text / / / / meaning that this is a text file containing a Bourne shell script.
Instead of moving files around by hand, you can use a _file manager_. If you move a lot of files around, a file manager can make your work more efficient. There are text-based file managers, such as GNU Midnight Commander (mc), and a number of file managers for the X Window system (for example gmc for the X Window version of GNU Midnight Commander).
Describing each of these is outside the scope of this book, but you may want to try them out if the command line doesn’t meet your needs.
Text files are prevelant on a GNU/Linux system. They hold everything from documentation to configuration files. Fortunately, it’s easy to work with them.
A _text file_ is simply a normal file that happens to contain human-readable text. There’s nothing special about it otherwise. The other kind of file, a binary file, is meant to be interpreted by the computer.
You can view either kind of file with the less file pager if you have it installed (install it if you haven’t, it’s quite useful). Type less /etc/profile to view a sample text file. Notice that you can read /the characters even if their meaning is obscure. Type less /bin/ls to view a binary file. As you can see, the ls program is not meant to be read by humans.