

Refers to the file ‘hello.txt.’ in the folder ‘Documents’ in the current working directory. Refers to the file ‘hello.txt’ in the current working directory. When using relative paths, there is no initial /. You can refer to files and folder relative to the shell’s current working directory. To help with that a shell has a ‘current working directory.’ Relative PathsĪddressing files and folders with their full path each and every time would be very tedious. Note: Finder in macOS and other graphical interfaces use the word ‘folder.’ Unix and other command line shells use the word ‘directory.’ They are the same. This path tells me (and the shell) that there is a file ‘hello.txt’ in a folder ‘Documents’ in a folder ‘armin’ in a folder ‘Users’ on the root of the file system, the current startup volume. Note: The file system root / should not be confused with the system user root. On macOS the root of the file system is the top level of the volume or disk with the active system, i.e. The complete series of folders to a file or folder is called its ‘path.’įor example, if there is a file hello.txt in your Documents folder in your home directory, its complete path or absolute path is: /Users/armin/Documents/hello.txtĪ path starts at the ‘root’ of the file system, which is shown as simply /. In a Unix shell you denote a folder or file in another folder with the forward ‘ /’ slash character. Modern file systems are hierarchical and have many folders and files nested in each other. On macOS, Terminal will also show the working directory in the window title bar. Pwd is short for ‘print working directory.’ It shows the folder this shell is currently working in, much like a Finder window displays the contents of a certain folder. Depending on the configuration of your Mac, your path might be entirely different. Unless your name is also armin, the path will end with your user name, not mine. You entered the command pwd and the shell returned a result: $ pwd If you like this series and want to learn Terminal and the shell on macOS in more detail, get my book “ macOS Terminal and Shell“ Working Directoryīack to our earlier example, the pwd command.
