How to Find a File Path in Ubuntu

In this guide, we will discover: How to Find a File Path in Ubuntu – Easy Beginners Guide 2023
So, let’s begin!

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.

By Oluwaseun Bamisile | Updated April 17, 2023 | 11 minutes read

This article will demonstrate three methods to get a file’s path in Ubuntu. Specifically, you will learn how to perform this task through the Ubuntu file manager.

I will also teach you how to know the path of a file in Ubuntu via the file’s properties. Moreover, this guide illustrates three commands to find the path of a Ubuntu file through the terminal.

In addition to all that, I will include an FAQ section in this article. That section will feature answers to five of the most asked questions relating to the topic in view.

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.

Get a File Path in Ubuntu Through File Manager

Get A File Path In Ubuntu 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.

Know a File Path in Ubuntu Via the File’s Properties

Know A File Path In Ubuntu 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.

Find a File Path in Ubuntu Through the Terminal

Find A File Path In Ubuntu 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 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 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 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

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

My Final Thoughts

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, we would appreciate it if you could spare a few minutes to share your opinions with our community at Itechguides Community Forum.

Asides from sharing your opinions, you can also ask questions regarding this article’s topic at Itechguides Community Forum. Our forum team and some community members will be happy to answer your questions.

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

References and Further Reading

  1. linuxhandbook.com – Get Absolute File Path in Linux
  2. Itechguides Community Forum
vote/تقييم

Avatar

is Senior Writer DZ-TECH, where he covers the world of technology, hacking, cybersecurity, surveillance and privacy.

Leave a Comment