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.
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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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
- 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.
- 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
- 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.
- Consequently, the command will search your entire file system for the file and display its path.
Find a File Path Using the Pwd Command
- 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.
- 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.
- 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
- 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.
- 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
- 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.
- Consequently, the command-line tool should begin to install.
- 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
- Consequently, the file’s path should appear as the output of the command.
Frequently Asked Questions
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.
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.
Yes, every file and folder on a computer has a path.
Yes, the Ubuntu Linux-based operating system is a free and open-source operating system.
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.