How to find path of file on Mac Terminal


If you are using the Terminal app on the Mac and want to know what is your current path, well all you need to do is run the pwd command.

The pwd command returns the working directory name.

Example:
    % pwd
    /usr/local/bin
    % pwd
    /Users/c2ctech/Desktop/python

    As you would see in the above examples, just by typing pwd on the Terminal prompt you get the path as a response which you can copy to the clipboard.

Make use of man pwd command to know more about this command.

Mac Terminal Current Directory Path Example using pwd Command

It is important to know a few Mac Terminal commands that are used together with pwd.

  1. cd: The change directory command to move between directories.
  2. ls: To list the files & subdirectories within the current directory.
  3. find: walk a file hierarchy

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail: rakesh@code2care.org



















Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap