The “readlink” Command
The readlink command is used to print canonical file names. We will use the -f option in combination with readlink to print the location of the file. Here are the implementation and output:
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: