terminal

Terminal Navigation

Introduction#

This topic contains information about navigating throughout the filesystem using the terminal.

Basic Navigation Commands

Change Directory

Navigate to a directory

cd [directory]

Example: Changing to the projects directory

username$ cd projects

Navigate to the root directory (regardless of working directory)

cd /

Navigate to the parent directory (the directory containing the working directory)

cd ..

Navigate to the home directory

cd ~


Print Working Directory

Prints the path of the directory that you are working in

pwd

Example: Printing the working directory while in the projects folder

username$ pwd
/Users/username/projects

List

List the files that are in the current working directory

ls

Example: Listing the files in the projects directory

username$ ls
PythonProject
JavaProject
screenshot.png
index.html
paper.pdf

Files are listed with their file extension, directories are listed with no extension.

Use ls -l to get more information about files (size, timestamp, owner)


This modified text is an extract of the original Stack Overflow Documentation created by the contributors and released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow