English pages are provided only to compare translations to original pages,
better looking pages can be browsed
at the Linux man-pages official site.
Linux Programmer's Manual (2)
chdir, fchdir - change working directory
int chdir(const char *path);
int fchdir(int fd);
Feature Test Macro Requirements for glibc (see
_BSD_SOURCE || _XOPEN_SOURCE >= 500 ||
_XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
|| /* Since glibc 2.12: */ _POSIX_C_SOURCE >= 200809L
changes the current working directory of the calling process to the
directory specified in
is identical to
the only difference is that the directory is given as an
open file descriptor.
On success, zero is returned.
On error, -1 is returned, and
is set appropriately.
Depending on the filesystem, other errors can be returned.
general errors for
are listed below:
Search permission is denied for one of the components of
points outside your accessible address space.
An I/O error occurred.
Too many symbolic links were encountered in resolving
is too long.
The file does not exist.
Insufficient kernel memory was available.
A component of
is not a directory.
The general errors for
are listed below:
Search permission was denied on the directory open on
is not a valid file descriptor.
SVr4, 4.4BSD, POSIX.1-2001.
The current working directory is the starting point for interpreting
relative pathnames (those not starting with '/').
A child process created via
inherits its parent's current working directory.
The current working directory is left unchanged by
This page is part of release 3.66 of the Linux
A description of the project,
information about reporting bugs,
and the latest version of this page,
can be found at
- RETURN VALUE
- CONFORMING TO
- SEE ALSO
This document was created by
using the manual pages.
Time: 21:42:57 GMT, July 12, 2014