In addition to getting and setting, Python's os module offers several similar functions for system-level commands. All are available on Unix derivatives. Those available on Windows are marked below.
- chdir(path): Change the current working directory
- chroot(path): Change the root directory of the current process.
- ctermid(): Returns the filename of the control terminal for the current process as a string.
- fchdir(fd): Changes the current working directory to fd, a file descriptor to an opened directory.
- putenv(varname, value): Set the environment variable varname to string value. Changes here affect subprocesses started with os.system(), popen() or fork() and execv(). (available on Unix and Windows) NB: On some platforms (e.g., FreeBSD, Mac OS X), setting environ may cause memory leaks. Check your system's documentation for putenv(). When putenv() is supported, assignments to items in os.environ are automatically translated into corresponding calls to putenv(). Note, however, that calls to putenv() do not update os.environ, so it is actually preferable to assign to items of os.environ.
- strerror(code): Return the error message corresponding to the error code in code. (Available on Unix and Windows)
- umask(mask): Set the current numeric umask and returns the previous umask. (Available on Unix and Windows)
- uname(): Return a tuple of 5 strings containing information identifying the current operating system: sysname, nodename, release, version, machine. Some systems truncate the nodename to 8 characters or to the leading component; a better way to get the hostname is socket.gethostname() or even socket.gethostbyaddr(socket.gethostname()). This is available only on recent flavors of Unix.
- unsetenv(varname): Unsets the environment variable named varname.