HP Visualize J5000 hp workstations - hp-ux 10.20 graphics administration guide - Page 10

Pathnames, Using “whence”, Using

Page 10 highlights

Chapter 1: Pathnames This chapter contains information on locating files that reside at some location in the file system. Using "whence" 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 Korn-shell command whence, which tells you where commands reside (if you're not using the Korn shell, you can use the system command whereis): $ whence mknod /etc/mknod The above approach, while satisfactory in many cases, has two limitations: • First, the directory in which the command resides must be one of the entries in the PATH variable; if it is not, it won't be found. So in a sense, whence and whereis 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, whence and whereis will tell you which one will be found first, and thus executed. • Secondly, both whence and whereis 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, whence and whereis will not find it, even if the include file's directory is in your PATH. To find non-executable files, you can use find, 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 might 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 specified substring in their names. The find command has many other options for refining a search; see the reference page for details. Page 10 Graphics Administration Guide for HP-UX 10.20

  • 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
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171

Chapter 1: Pathnames
This chapter contains information on locating files that reside at some location in the file system.
Using
“whence”
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 Korn-shell command whence, which tells you where commands reside (if
you're not using the Korn shell, you can use the system command whereis):
$ whence mknod
/etc/mknod
The above approach, while satisfactory in many cases, has two limitations:
First, the directory in which the command resides must be one of the entries in the PATH
variable; if it is not, it won't be found. So in a sense, whence and whereis 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, whence
and whereis will tell you which one will be found first, and thus executed.
Secondly, both
whence
and
whereis
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, whence and whereis will not find it, even if the include file's directory is in your PATH.
To find non-executable files, you can use find, 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 might 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 specified substring in their names. The find command has many other options for refining a search; see
the reference page for details.
Graphics Administration Guide for HP-UX 10.20
Page 10