How to Find a File Path in Ubuntu

Photo of author

By Oluwaseun Bamisile

Published

Do you need the path of a certain file on your Ubuntu computer but don’t know how to find it? You should read through this guide, as it contains multiple methods to accomplish that.

Before we proceed, it is important to mention that the steps in this guide are based on the Ubuntu 22.04 LTS operating system. Therefore, some of the steps may differ slightly from other versions of the Ubuntu Linux-based operating system.

Option 1: Get a File Path Through File Manager

One way to find the path of a file on your Ubuntu computer is through the file manager. The steps listed below will demonstrate how to do that.

  1. Open the applications menu in Ubuntu by clicking the Show Applications icon on the dock. Then, type “files” in the search field and select File from the search result.
  1. In the Ubuntu file manager, navigate to the folder where the file you wish to know its path is stored. Then, simultaneously press the Ctrl + L keys on your keyboard.
Get A File Path In Ubuntu Through File Manager
  1. Consequently, the file’s path should appear in the search field of the file manager.

Option 2: Know a File Path via the File’s Properties

Another method to get the path of a file in Ubuntu is through the file’s properties. Follow the steps below to learn how to accomplish that.

  1. Click the Show Applications button in the Ubuntu dock to open the application menu. Next, input “files” in the search field and select the Files program from the search result.
  1. Now, navigate to the location where the file you wish to know its path is stored. Then, right-click the file and select Properties from the context menu that appears.
Know A File Path In Ubuntu Via The File's Properties
  1. Consequently, on the Basic tab in the file’s properties window, you will see the file’s path opposite Parent folder.

Option 3: Find a File Path Through the Terminal

Interestingly, you can also know the path of a file on your Ubuntu computer by running a simple command in the terminal. In fact, there are various command-line that allows you to get a file’s path via the Ubuntu terminal.

Some of these commands include the find command, pwd command, and locate command. Thus, the following sub-sections will demonstrate how to use those commands to get a file’s path via the Ubuntu terminal.

Know a File Path Using the Find Command

  1. Open the terminal in Ubuntu by right-clicking any empty space on the desktop and selecting Open in Terminal from the context menu. Alternatively, use the Ctrl + Alt + T keyboard shortcut to open the terminal in Ubuntu.
  1. In the Ubuntu terminal, type the command below and press the enter key on your keyboard. However, replace “filename” with the name of the file – including its extension – whose path you wish to find.
sudo find / -name filename

For example, if the name of the file whose path I wish to find is “background.jpeg,” below is what the command should look like.

sudo find / -name background.jpeg
Know A File Path Using Find Command
  1. Following that, you will be prompted to input your computer’s password. Thus, type your password and press the enter key on your keyboard to execute the command.
While typing your computer’s password, the characters won’t be visible.
  1. Consequently, the command will search your entire file system for the file and display its path.
Know A File Path Using Find Command

Find a File Path Using the Pwd Command

  1. On the Ubuntu dock, click the Show Applications icon to open the application menu. Then, type “files” in the search field and left-click the Files program from the search result.
  1. In the Ubuntu file manager, navigate to where the file you wish to know its path is located. Then, right-click any free space in the folder where the file is located and click Open in Terminal from the displayed options.
Find A File Path Using Pwd Command
  1. Now, run the command below in the Ubuntu terminal. Consequently, the file’s path should be revealed.
pwd

Get File Path Using the Locate Command

  1. Right-click any empty area on the Ubuntu desktop, then select Open in Terminal from the context menu. As an alternative, press the Ctrl + Alt + T keys simultaneously to open the terminal in Ubuntu.
Get File Path Using Locate Command
  1. Now, run the command below to install the locate command-line tool. However, before the command runs, you will be asked for your password – type your password and press the enter key.
sudo apt install plocate
Characters aren’t visible when typing a password in the Ubuntu terminal.
  1. Then, a couple of info regarding the installation should appear. Also, you will be asked if you want to continue with the installation – type “y” and press the enter key to continue.
Get File Path Using Locate Command
  1. Consequently, the command-line tool should begin to install.
  1. After installing the command-line tool, run the command below to view a file’s path. However, replace “filename” in the command with the name (including extension) of the file whose path you wish to know.
locate filename

For instance, if I wish to know the path of a file whose name is “background.jpeg,” below is what the command should look like.

locate background.jpeg
Get File Path Using Locate Command
  1. Consequently, the file’s path should appear as the output of the command.

Frequently Asked Questions

1. What is a file path?

A file path is a string that represents the location of a file or folder in a computer’s file system. It is used to navigate and access files and folders on a computer or network.

2. How do I find a file path in Ubuntu?

Follow the steps below to find a file path in Ubuntu.
a) Click the Show Applications button in the Ubuntu dock to open the application menu.
b) Next, input “files” in the search field and select the Files program from the search result.
c) Now, navigate to the location where the file you wish to know its path is stored.
d) Then, right-click the file and select Properties from the context menu that appears.
e) Consequently, on the Basic tab in the file’s properties window, you will see the file path opposite Parent folder.

3. Does every file and folder have a path?

Yes, every file and folder on a computer has a path.

4. Is the Ubuntu operating system free?

Yes, the Ubuntu Linux-based operating system is a free and open-source operating system.

5. When was the first version of Ubuntu released?

The first version of Ubuntu – Ubuntu version 4.10, codenamed Warty Warthog – was released in October 2004

Conclusion

When working with files and directories in the Ubuntu Linux-based OS, it’s necessary to know the file path in order to access or manipulate files. Fortunately, this guide demonstrated various methods to know the path of a file in Ubuntu.

Specifically, we discussed how to get a file path in Ubuntu through the file manager. This article also explained how to execute this task via the file’s properties.

That’s not all; this guide taught us three commands to get a file’s path in Ubuntu through the terminal. Thus, with the procedures provided in this guide, finding the path of a file in Ubuntu should be a straightforward process.

Hopefully, you enjoyed reading through this guide and found it helpful. If you did, click on “Yes” beside the “Was this page helpful” question below.

You may also express your thoughts and opinions by using the “Leave a Reply” form at the bottom of this page.

Finally, before leaving this page, you might want to check out our Linux how-to page to find other helpful Ubuntu Linux guides.

About the Author

Photo of author

Oluwaseun Bamisile

Oluwaseun is the Lead Content Editor at Itechguides.com. He holds a National Diploma in Computer Science (currently studying part-time for his Higher National Diploma). An internet geek with a love for automobiles, he writes product reviews, tech articles, and how-to guides on the site.

Related Articles

Get in Touch

We're committed to writing accurate content that informs and educates. To learn more, read our Content Writing Policy, Content Review Policy, Anti-plagiarism Policy, and About Us.

However, if this content does not meet your expectations, kindly reach out to us through one of the following means:

  1. Respond to "Was this page helpful?" above
  2. Leave a comment with the "Leave a Comment" form below
  3. Email us at [email protected] or via the Contact Us page.

Leave a comment