The “realpath” Command
The realpath command displays a file’s absolute path. We will not use any option here, unlike the readlink command. The implementation and output are given below:
How to Get the Full Path of a File in Linux
We often work with Linux files while creating shell scripts. But sometimes we need to know the full path of a file we are working on and this article will let you know how you can get the full path of a file. We have listed some methods that will help you find the location of a particular file.
But before going any further, let’s first create a file:
The above output clearly shows that file.txt has been successfully created.
Now, we will take a look at the methods that will give us the full path of a file. In total, there are 6 methods listed in this article. They include: