HP Visualize J5000 HP Workstations - Graphics Administration Guide For Red Hat - Page 8

Pathnames, Using \, Using find

Page 8 highlights

Chapter 1 Pathnames This chapter contains information on locating files that reside at some location in the file system. Using "whereis" Using "find" HP X Window System OpenGL® Using "whereis" There are two main methods of finding files, assuming you know the name of the file you're looking for. The first method is to use the Bash-shell commands whereis or which, which tell you where commands reside (if you're using the Korn shell, you can use the system command whence): $ whereis mknod /etc/mknod The above approach, while satisfactory in many cases, has two limitations: First, the current Linux version of whereis features a fixed directory search path. It will only locate commands residing in this path. The command which searches the current PATH variable for executable binaries. All of these commands can only find things if you tell them where to look. They are still valuable, though: you may not remember which, of the dozens of directories that may be in your PATH variable, is where a particular command resides. Also, if you have two commands of the same name in two different directories, whereis, which, and whence will tell you which one will be found first, and thus executed. Secondly, whereis, which, and whence only find executable files; that is, commands (both compiled programs and shell scripts). If you want to find a file that is not executable an include file, for instance, whereis and whence will not find it, even if the include file's directory is in your PATH. To find non-executable files, you can use find, which is discussed below. Using "find" The find command will find any file in your file system, executable or not. For example, to locate the include file we couldn't locate above, you could say: $ find / -name '' where is the name of the file you're looking for. In the above example, the "/" is the root directory, and everything is under that, so, assuming you specified the correct file name, and it is somewhere in the file system, the above command is guaranteed to find what you're looking for, though it make take a while. You can shorten the search time by giving a subdirectory here, if you know it; for example, "find /opt ...". Also, you can specify just a partial filename; find will locate all files containing a Graphics Administration Guide For Red Hat Linux 6.2

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73

Chapter 1 Pathnames
This chapter contains information on locating files that reside at some location in the file
system.
Using "
whereis
"
Using "
find
"
HP X Window System
OpenGLĀ®
Using "
whereis
"
There are two main methods of finding files, assuming you know the name of the file
you're looking for. The first method is to use the Bash-shell commands whereis or which,
which tell you where commands reside (if you're using the Korn shell, you can use the
system command whence):
$ whereis mknod
/etc/mknod
The above approach, while satisfactory in many cases, has two limitations:
First, the current Linux version of
whereis
features a fixed directory search path. It will
only locate commands residing in this path. The command which searches the current
PATH variable for executable binaries. All of these commands can only find things if
you tell them where to look. They are still valuable, though: you may not remember
which, of the dozens of directories that may be in your PATH variable, is where a
particular command resides. Also, if you have two commands of the same name in two
different directories,
whereis
,
which
, and
whence
will tell you which one will be found
first, and thus executed.
Secondly,
whereis
,
which
, and
whence
only find executable files; that is, commands (both
compiled programs and shell scripts). If you want to find a file that is not executable an
include file, for instance,
whereis
and
whence
will not find it, even if the include file's
directory is in your PATH. To find non-executable files, you can use find, which is
discussed below.
Using "find"
The find command will find any file in your file system, executable or not. For example,
to locate the include file we couldn't locate above, you could say:
$ find / -name '
<file_name>
'
where
<file_name>
is the name of the file you're looking for. In the above example, the
"/" is the root directory, and everything is under that, so, assuming you specified the
correct file name, and it is somewhere in the file system, the above command is
guaranteed to find what you're looking for, though it make take a while. You can shorten
the search time by giving a subdirectory here, if you know it; for example, "find /opt ...".
Also, you can specify just a partial filename; find will locate all files containing a
Graphics Administration Guide For Red Hat Linux 6.2