143082Scael.\" Copyright (c) 1980, 1990 The Regents of the University of California. 243082Scael.\" All rights reserved. 319086Smckusick.\" 443082Scael.\" %sccs.include.redist.man% 519086Smckusick.\" 6*50067Sbostic.\" @(#)cd.1 6.5 (Berkeley) 06/17/91 743082Scael.\" 843082Scael.Dd 943082Scael.Dt CD 1 1043082Scael.Os BSD 4 1143082Scael.Sh NAME 1243082Scael.Nm cd 1343082Scael.Nd change working directory 1443082Scael.Sh SYNOPSIS 1543082Scael.Nm cd 1643082Scael.Ar directory 1743082Scael.Sh DESCRIPTION 1850065Sbostic.Ar Directory 1950065Sbosticis an absolute or relative pathname which becomes the new working 2050065Sbosticdirectory. 2150065SbosticThe interpretation of a relative pathname by cd depends on the CDPATH 2250065Sbosticenvironment variable (see below). 2343082Scael.Sh ENVIRONMENT 2450065SbosticThe following environment variables affect the execution of cd: 2543082Scael.Pp 26*50067Sbostic.Bl -tag -width indent 27*50067Sbostic.It Ev CDPATH 2843082ScaelIf the 2943082Scael.Ar directory 3050065Sbosticoperand does not begin with a slash (/) character, and the first 3143082Scaelcomponent is not dot (.) or dot-dot (..), 3243082Scael.Nm cd 3350065Sbosticsearches for the directory relative to each directory named in the 3443082Scael.Ev CDPATH 3543082Scaelvariable, in the order listed. 3650065SbosticThe new working directory is set to the first matching directory found. 3750065SbosticAn empty string in place of a directory pathname represents the current 3850065Sbosticdirectory. 39*50067SbosticIf the new working directory was derived from 40*50067Sbostic.Ev CDPATH , 41*50067Sbosticit will be printed to the standard output. 42*50067Sbostic.It Ev HOME 43*50067SbosticIf 44*50067Sbostic.Nm cd 45*50067Sbosticis invoked without arguments and the 46*50067Sbostic.Ev HOME 47*50067Sbosticenvironment variable exists and contains a directory name, that directory 48*50067Sbosticbecomes the new working directory. 49*50067Sbostic.El 50*50067Sbostic.Pp 5143082ScaelSee 5243082Scael.Xr csh 1 53*50067Sbosticfor more information on environment variables. 5443082Scael.Tp 5543082Scael.Pp 5643082ScaelThe 5743082Scael.Nm cd 5843082Scaelutility exits 0 on success, and >0 if an error occurs. 5943082Scael.Sh SEE ALSO 6043082Scael.Xr csh 1 , 6150065Sbostic.Xr pwd 1 , 6243082Scael.Xr sh 1 , 6343082Scael.Xr chdir 2 6443082Scael.Sh STANDARDS 6543082ScaelThe 6643082Scael.Nm cd 6743082Scaelfunction is expected to be POSIX 1003.2 compatible. 68