Print this page
13507 some man pages need update following 13405
6308 some man pages are obsolete after moving to ksh builtins
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/man/man1/cd.1.man.txt
+++ new/usr/src/man/man1/cd.1.man.txt
1 1 CD(1) User Commands CD(1)
↓ open down ↓ |
1 lines elided |
↑ open up ↑ |
2 2
3 3
4 4
5 5 NAME
6 6 cd, chdir, pushd, popd, dirs - change working directory
7 7
8 8 SYNOPSIS
9 9 /usr/bin/cd [directory]
10 10
11 11
12 - sh
13 - cd [argument]
14 -
15 -
16 - chdir [argument]
17 -
18 -
19 12 csh
20 13 cd [dir]
21 14
22 15
23 16 chdir [dir]
24 17
25 18
26 19 pushd [+n | dir]
27 20
28 21
29 22 popd [+n]
30 23
31 24
32 25 dirs [-l]
33 26
34 27
35 - ksh, ksh93
28 + ksh93
36 29 cd [-L] [-P] [arg]
37 30
38 31
39 32 cd old new
40 33
41 34
42 35 DESCRIPTION
43 36 /usr/bin/cd
44 37 The /usr/bin/cd utility changes the current directory in the context of
45 38 the cd utility only. This is in contrast to the version built into the
46 39 shell. /usr/bin/cd has no effect on the invoking process but can be
47 40 used to determine whether or not a given directory can be set as the
48 41 current directory.
49 42
50 - sh
51 - The Bourne shell built-in cd changes the current directory to argument.
52 - The shell parameter HOME is the default argument. The shell parameter
53 - CDPATH defines the search path for the directory containing argument.
54 - Alternative directory names are separated by a colon (:). The default
55 - path is <null> (specifying the current directory). The current
56 - directory is specified by a null path name, which can appear
57 - immediately after the equal sign or between the colon delimiters
58 - anywhere else in the path list. If argument begins with `/', `.', or
59 - `..', the search path is not used. Otherwise, each directory in the
60 - path is searched for argument. cd must have execute (search) permission
61 - in argument. Because a new process is created to execute each command,
62 - cd would be ineffective if it were written as a normal command;
63 - therefore, it is recognized by and is internal to the shell. (See
64 - pwd(1), sh(1), and chdir(2)).
65 -
66 -
67 - chdir is just another way to call cd.
68 -
69 43 csh
70 44 If dir is not specified, the C shell built-in cd uses the value of
71 45 shell parameter HOME as the new working directory. If dir specifies a
72 46 complete path starting with `/', `.', or `..', dir becomes the new
73 47 working directory. If neither case applies, cd tries to find the
74 48 designated directory relative to one of the paths specified by the
75 49 CDPATH shell variable. CDPATH has the same syntax as, and similar
76 50 semantics to, the PATH shell variable. cd must have execute (search)
77 51 permission in dir. Because a new process is created to execute each
78 52 command, cd would be ineffective if it were written as a normal
79 53 command; therefore, it is recognized by and is internal to the C-shell.
80 54 (See pwd(1), sh(1), and chdir(2)).
81 55
82 56
83 57 chdir changes the shell's working directory to directory dir. If no
84 58 argument is given, change to the home directory of the user. If dir is
85 59 a relative pathname not found in the current directory, check for it in
86 60 those directories listed in the cdpath variable. If dir is the name of
87 61 a shell variable whose value starts with a /, change to the directory
88 62 named by that value.
89 63
90 64
91 65 pushd pushes a directory onto the directory stack. With no arguments,
92 66 exchange the top two elements.
93 67
94 68 +n
95 69 Rotate the n'th entry to the top of the stack and cd to it.
96 70
97 71
98 72 dir
99 73 Push the current working directory onto the stack and change to
100 74 dir.
101 75
102 76
103 77
104 78 popd pops the directory stack and cd to the new top directory. The
105 79 elements of the directory stack are numbered from 0 starting at the
106 80 top.
↓ open down ↓ |
28 lines elided |
↑ open up ↑ |
107 81
108 82 +n
109 83 Discard the n'th entry in the stack.
110 84
111 85
112 86
113 87 dirs prints the directory stack, most recent to the left; the first
114 88 directory shown is the current directory. With the -l argument, produce
115 89 an unabbreviated printout; use of the ~ notation is suppressed.
116 90
117 - ksh, ksh93
91 + ksh93
118 92 The Korn shell built-in cd command can be in either of two forms. In
119 93 the first form it changes the current directory to arg. If arg is - the
120 94 directory is changed to the previous directory. The shell variable HOME
121 95 is the default arg. The environment variable PWD is set to the current
122 96 directory. If the PWD is changed, the OLDPWD environment variable shall
123 97 also be changed to the value of the old working directory, that is, the
124 98 current working directory immediately prior to the call to change
125 99 directory (cd). The shell variable CDPATH defines the search path for
126 100 the directory containing arg. Alternative directory names are separated
127 101 by a colon (:). The default path is null (specifying the current
128 102 directory). The current directory is specified by a null path name,
129 103 which can appear immediately after the equal sign or between the colon
130 104 delimiters anywhere else in the path list. If arg begins with a `/',
131 105 `.', or `..', then the search path is not used. Otherwise, each
132 106 directory in the path is searched for arg. If unsuccessful, cd attempts
133 107 to change directories to the pathname formed by the concatenation of
134 108 the value of PWD, a slash character, and arg.
135 109
136 110 -L
137 111 Handles the operation dot-dot (..) logically. Symbolic link
138 112 components are not resolved before dot-dot components are
139 113 processed.
140 114
141 115
142 116 -P
143 117 Handles the operand dot-dot physically. Symbolic link components
144 118 are resolved before dot-dot components are processed.
145 119
146 120
147 121
148 122 If both -L and -P options are specified, the last option to be invoked
149 123 is used and the other is ignored. If neither -L nor -P is specified,
150 124 the operand is handled dot-dot logically.
↓ open down ↓ |
23 lines elided |
↑ open up ↑ |
151 125
152 126
153 127 The second form of cd substitutes the string new for the string old in
154 128 the current directory name, PWD and tries to change to this new
155 129 directory.
156 130
157 131
158 132 The cd command cannot be executed by rksh. Because a new process is
159 133 created to execute each command, cd would be ineffective if it were
160 134 written as a normal command; therefore, it is recognized by and is
161 - internal to the Korn shell. (See pwd(1), sh(1), and chdir(2)).
135 + internal to the Korn shell. (See pwd(1), ksh93(1), and chdir(2)).
162 136
163 137 OPERANDS
164 138 The following operands are supported:
165 139
166 140 directory
167 141 An absolute or relative pathname of the directory that
168 142 becomes the new working directory. The interpretation of a
169 143 relative pathname by cd depends on the CDPATH environment
170 144 variable.
171 145
172 146
173 147 OUTPUT
174 148 If a non-empty directory name from CDPATH is used, an absolute pathname
175 149 of the new working directory is written to the standard output as
176 150 follows:
177 151
178 152
179 153 "%s\n", <new directory>
180 154
181 155
182 156 Otherwise, there is no output.
183 157
184 158 ENVIRONMENT VARIABLES
185 159 See environ(5) for descriptions of the following environment variables
186 160 that affect the execution of cd: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES,
187 161 and NLSPATH.
188 162
189 163 CDPATH
190 164 A colon-separated list of pathnames that refer to
191 165 directories. If the directory operand does not begin with a
192 166 slash ( / ) character, and the first component is not dot or
193 167 dot-dot, cd searches for directory relative to each directory
194 168 named in the CDPATH variable, in the order listed. The new
195 169 working directory sets to the first matching directory found.
196 170 An empty string in place of a directory pathname represents
197 171 the current directory. If CDPATH is not set, it is treated as
198 172 if it were an empty string.
199 173
200 174
201 175 HOME
202 176 The name of the home directory, used when no directory
203 177 operand is specified.
204 178
205 179
206 180 OLDPWD
207 181 A pathname of the previous working directory, used by cd-.
208 182
209 183
210 184 PWD
211 185 A pathname of the current working directory, set by cd after
212 186 it has changed to that directory.
213 187
214 188
215 189 EXIT STATUS
216 190 The following exit values are returned by cd:
217 191
218 192 0
↓ open down ↓ |
47 lines elided |
↑ open up ↑ |
219 193 The directory was successfully changed.
220 194
221 195
222 196 >0
223 197 An error occurred.
224 198
225 199
226 200 ATTRIBUTES
227 201 See attributes(5) for descriptions of the following attributes:
228 202
229 - csh, ksh, sh
203 + csh
230 204
231 -
232 -
233 205 +--------------------+-------------------+
234 206 | ATTRIBUTE TYPE | ATTRIBUTE VALUE |
235 207 +--------------------+-------------------+
236 208 |Interface Stability | Committed |
237 209 +--------------------+-------------------+
238 210 |Standard | See standards(5). |
239 211 +--------------------+-------------------+
240 212
241 213 ksh93
242 214
243 -
244 -
245 215 +--------------------+-----------------+
246 216 | ATTRIBUTE TYPE | ATTRIBUTE VALUE |
247 217 +--------------------+-----------------+
248 218 |Interface Stability | Uncommitted |
249 219 +--------------------+-----------------+
250 220
251 221 SEE ALSO
252 - csh(1), ksh(1), ksh93(1), pwd(1), sh(1), chdir(2), attributes(5),
253 - environ(5), standards(5)
222 + csh(1), ksh93(1), pwd(1), chdir(2), attributes(5), environ(5),
223 + standards(5)
254 224
255 225
256 226
257 - April 8, 2008 CD(1)
227 + February 9, 2021 CD(1)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX