# Functions
Chdir changes the current working directory to the named directory.
Chmod changes the mode of the named file to mode.
Chown changes the numeric uid and gid of the named file.
Chtimes changes the access and modification times of the named file, similar to the Unix utime() or utimes() functions.
Clearenv deletes all environment variables.
CopyFS copies the file system fsys into the directory dir, creating dir if necessary.
Create creates or truncates the named file.
CreateTemp creates a new temporary file in the directory dir, opens the file for reading and writing, and returns the resulting file.
DirFS returns a file system (an fs.FS) for the tree of files rooted at the directory dir.
Environ returns a copy of strings representing the environment, in the form "key=value".
Executable returns the path name for the executable that started the current process.
Exit causes the current program to exit with the given status code.
Expand replaces ${var} or $var in the string based on the mapping function.
ExpandEnv replaces ${var} or $var in the string according to the values of the current environment variables.
FindProcess looks for a running process by its pid.
Getegid returns the numeric effective group id of the caller.
Getenv retrieves the value of the environment variable named by the key.
Geteuid returns the numeric effective user id of the caller.
Getgid returns the numeric group id of the caller.
Getgroups returns a list of the numeric ids of groups that the caller belongs to.
Getpagesize returns the underlying system's memory page size.
Getpid returns the process id of the caller.
Getppid returns the process id of the caller's parent.
Getuid returns the numeric user id of the caller.
Getwd returns an absolute path name corresponding to the current directory.
Hostname returns the host name reported by the kernel.
IsExist returns a boolean indicating whether its argument is known to report that a file or directory already exists.
IsNotExist returns a boolean indicating whether its argument is known to report that a file or directory does not exist.
IsPathSeparator reports whether c is a directory separator character.
IsPermission returns a boolean indicating whether its argument is known to report that permission is denied.
IsTimeout returns a boolean indicating whether its argument is known to report that a timeout occurred.
Lchown changes the numeric uid and gid of the named file.
Link creates newname as a hard link to the oldname file.
LookupEnv retrieves the value of the environment variable named by the key.
Lstat returns a [FileInfo] describing the named file.
Mkdir creates a new directory with the specified name and permission bits (before umask).
MkdirAll creates a directory named path, along with any necessary parents, and returns nil, or else returns an error.
MkdirTemp creates a new temporary directory in the directory dir and returns the pathname of the new directory.
NewFile returns a new File with the given file descriptor and name.
NewSyscallError returns, as an error, a new [SyscallError] with the given system call name and error details.
Open opens the named file for reading.
OpenFile is the generalized open call; most users will use Open or Create instead.
OpenInRoot opens the file name in the directory dir.
OpenRoot opens the named directory.
Pipe returns a connected pair of Files; reads from r return bytes written to w.
ReadDir reads the named directory, returning all its directory entries sorted by filename.
ReadFile reads the named file and returns the contents.
Readlink returns the destination of the named symbolic link.
Remove removes the named file or (empty) directory.
RemoveAll removes path and any children it contains.
Rename renames (moves) oldpath to newpath.
SameFile reports whether fi1 and fi2 describe the same file.
Setenv sets the value of the environment variable named by the key.
StartProcess starts a new process with the program, arguments and attributes specified by name, argv and attr.
Stat returns a [FileInfo] describing the named file.
Symlink creates newname as a symbolic link to oldname.
TempDir returns the default directory to use for temporary files.
Truncate changes the size of the named file.
Unsetenv unsets a single environment variable.
UserCacheDir returns the default root directory to use for user-specific cached data.
UserConfigDir returns the default root directory to use for user-specific configuration data.
UserHomeDir returns the current user's home directory.
WriteFile writes data to the named file, creating it if necessary.
# Constants
DevNull is the name of the operating system's “null device.” On Unix-like systems, it is "/dev/null"; on Windows, "NUL".
a: append-only.
c: Unix character device, when ModeDevice is set.
D: device file.
d: is a directory.
l: exclusive use.
?: non-regular file; nothing else is known about this file.
p: named pipe (FIFO).
Unix permission bits, 0o777.
g: setgid.
u: setuid.
S: Unix domain socket.
t: sticky.
L: symbolic link.
T: temporary file; Plan 9 only.
Mask for the type bits.
append data to the file when writing.
create a new file if none exists.
used with O_CREATE, file must not exist.
open the file read-only.
open the file read-write.
open for synchronous I/O.
truncate regular writable file when opened.
open the file write-only.
OS-specific path list separator.
OS-specific path separator.
seek relative to the current offset.
seek relative to the end.
seek relative to the origin of the file.
# Variables
Args hold the command-line arguments, starting with the program name.
"file already closed".
"i/o timeout".
"file already exists".
"invalid argument".
"file type does not support deadline".
"file does not exist".
"permission denied".
ErrProcessDone indicates a [Process] has finished.
The only signal values guaranteed to be present in the os package on all systems are os.Interrupt (send the process an interrupt) and os.Kill (force the process to exit).
The only signal values guaranteed to be present in the os package on all systems are os.Interrupt (send the process an interrupt) and os.Kill (force the process to exit).
Stdin, Stdout, and Stderr are open Files pointing to the standard input, standard output, and standard error file descriptors.
Stdin, Stdout, and Stderr are open Files pointing to the standard input, standard output, and standard error file descriptors.
Stdin, Stdout, and Stderr are open Files pointing to the standard input, standard output, and standard error file descriptors.
# Structs
File represents an open file descriptor.
LinkError records an error during a link or symlink or rename system call and the paths that caused it.
ProcAttr holds the attributes that will be applied to a new process started by StartProcess.
Process stores the information about a process created by [StartProcess].
ProcessState stores information about a process, as reported by Wait.
Root may be used to only access files within a single directory tree.
SyscallError records an error from a specific system call.
# Interfaces
A Signal represents an operating system signal.
# Type aliases
A DirEntry is an entry read from a directory (using the [ReadDir] function or a [File.ReadDir] method).
A FileInfo describes a file and is returned by [Stat] and [Lstat].
A FileMode represents a file's mode and permission bits.
PathError records an error and the operation and file path that caused it.