Original author(s) | AT&T Bell Laboratories |
---|---|
Developer(s) | Various open-source and commercial developers |
Initial release | June 1974 |
Written in | C |
Operating system | Multics, Unix, Unix-like, V, Plan 9, Inferno, SpartaDOS X, PANOS, Windows CE, KolibriOS |
Platform | Cross-platform |
Type | Command |
License | coreutils: GPLv3+ Plan 9: MIT License |
In Unix-like and some other operating systems, the pwd
command (print working directory) [1] [2] [3] writes the full pathname of the current working directory to the standard output. [4] [5] [6] [7] [8] [9] [10]
Multics had a pwd
command (which was a short name of the print_wdir
command) [11] from which the Unix pwd command originated. [12] The command is a shell builtin in most Unix shells such as Bourne shell, ash, bash, ksh, and zsh. It can be implemented easily with the POSIX C functions getcwd()
or getwd()
.
It is also available in the operating systems SpartaDOS X, [13] PANOS, [14] and KolibriOS. [15] The equivalent on DOS ( COMMAND.COM
) and Microsoft Windows ( cmd.exe
) is the cd
command with no arguments. Windows PowerShell provides the equivalent Get-Location
cmdlet with the standard aliases gl
and pwd
. On Windows CE 5.0, the cmd.exe
Command Processor Shell includes the pwd
command. [16]
pwd
as found on Unix systems is part of the X/Open Portability Guide since issue 2 of 1987. It was inherited into the first version of POSIX.1 and the Single Unix Specification. [17] It appeared in Version 5 Unix. [18] The version of pwd
bundled in GNU coreutils was written by Jim Meyering. [19]
The numerical computing environments MATLAB and GNU Octave include a pwd
function with similar functionality. [20] [21] The OpenVMS equivalent is show default
.
Command | Explanation |
---|---|
pwd | Display the current working directory. Example: /home/foobar |
pwd -P | Display the current working directory physical path - without symbolic link name, if any. Example: If standing in a dir /home/symlinked, that is a symlink to /home/realdir, this would show /home/realdir |
pwd -L | Display the current working directory logical path - with symbolic link name, if any. Example: If standing in a dir /home/symlinked, that is a symlink to /home/realdir, this would show /home/symlinked |
Note: POSIX requires that the default behavior be as if the -L
switch were provided.
POSIX shells set the following environment variables while using the cd command: [22]
pushd
and popd
The Single UNIX Specification (SUS) is a standard for computer operating systems, compliance with which is required to qualify for using the "UNIX" trademark. The standard specifies programming interfaces for the C language, a command-line shell, and user commands. The core specifications of the SUS known as Base Specifications are developed and maintained by the Austin Group, which is a joint working group of IEEE, ISO JTC 1 SC22 and The Open Group. If an operating system is submitted to The Open Group for certification, and passes conformance tests, then it is deemed to be compliant with a UNIX standard such as UNIX 98 or UNIX 03.
A Unix shell is a command-line interpreter or shell that provides a command line user interface for Unix-like operating systems. The shell is both an interactive command language and a scripting language, and is used by the operating system to control the execution of the system using shell scripts.
In computing, tar is a computer software utility for collecting many files into one archive file, often referred to as a tarball, for distribution or backup purposes. The name is derived from "tape archive", as it was originally developed to write data to sequential I/O devices with no file system of their own. The archive data sets created by tar contain various file system parameters, such as name, timestamps, ownership, file-access permissions, and directory organization. POSIX abandoned tar in favor of pax, yet tar sees continued widespread use.
In computing, ls
is a command to list computer files and directories in Unix and Unix-like operating systems. It is specified by POSIX and the Single UNIX Specification.
The cd
command, also known as chdir
, is a command-line shell command used to change the current working directory in various operating systems. It can be used in shell scripts and batch files.
The mkdir
command in the Unix, DOS, DR FlexOS, IBM OS/2, Microsoft Windows, and ReactOS operating systems is used to make a new directory. It is also available in the EFI shell and in the PHP scripting language. In DOS, OS/2, Windows and ReactOS, the command is often abbreviated to md
.
uname is a computer program in Unix and Unix-like computer operating systems that prints the name, version and other details about the current machine and the operating system running on it.
The ln
command is a standard Unix command utility used to create a hard link or a symbolic link (symlink) to an existing file or directory. The use of a hard link allows multiple filenames to be associated with the same file since a hard link points to the inode of a given file, the data of which is stored on disk. On the other hand, symbolic links are special files that refer to other files by name.
In computing, rmdir
is a command which will remove an empty directory on various operating systems.
In computing, touch
is a command used to update the access date and/or modification date of a computer file or directory. It is included in Unix and Unix-like operating systems, TSC's FLEX, Digital Research/Novell DR DOS, the AROS shell, the Microware OS-9 shell, and ReactOS. The command is also available for FreeDOS and Microsoft Windows.
In computing, echo
is a command that outputs the strings that are passed to it as arguments. It is a command available in various operating system shells and typically used in shell scripts and batch files to output status text to the screen or a computer file, or as a source part of a pipeline.
cksum
is a command in Unix and Unix-like operating systems that generates a checksum value for a file or stream of data. The cksum command reads each file given in its arguments, or standard input if no arguments are provided, and outputs the file's 32-bit cyclic redundancy check (CRC) checksum and byte count. The CRC output by cksum is different from the CRC-32 used in zip, PNG and zlib.
The standard Unix command who
displays a list of users who are currently logged into the computer.
rm
is a basic command on Unix and Unix-like operating systems used to remove objects such as computer files, directories and symbolic links from file systems and also special files such as device nodes, pipes and sockets, similar to the del
command in MS-DOS, OS/2, and Microsoft Windows. The command is also available in the EFI shell.
cpio is a general file archiver utility and its associated file format. It is primarily installed on Unix-like computer operating systems. The software utility was originally intended as a tape archiving program as part of the Programmer's Workbench (PWB/UNIX), and has been a component of virtually every Unix operating system released thereafter. Its name is derived from the phrase copy in and out, in close description of the program's use of standard input and standard output in its operation.
In computing, sleep is a command in Unix, Unix-like and other operating systems that suspends program execution for a specified time.
sum is a legacy utility available on some Unix and Unix-like operating systems. This utility outputs a 16-bit checksum of each argument file, as well as the number of blocks they take on disk. Two different checksum algorithms are in use. POSIX abandoned sum in favor of cksum.
In computing, help
is a command in various command line shells such as COMMAND.COM
, cmd.exe
, Bash, qshell, 4DOS/4NT, Windows PowerShell, Singularity shell, Python, MATLAB and GNU Octave. It provides online information about available commands and the shell environment.
In Unix and Unix-like operating systems, printf is a shell builtin that formats and prints data.
cat
is a standard Unix utility that reads files sequentially, writing them to standard output. The name is derived from its function to (con)catenate files. It has been ported to a number of operating systems.