How can I get the absolute path of a file deep within a directory?
1
vote
4
answers
1499
views
Here's an example of directory
level0
contents in a tree-like format. However, suppose it is huge and contains many files as I am omitting many of them here:
$ tree level0
level0
└── level1
└── level2
└── sample.txt
I tried using grep
to check some file with grep, but this is the output I received:
$ tree /tmp/level0 | grep sample
└── sample.txt
However, I expect the output to be the actual absolute path /tmp/level0/level1/level2/sample.txt
.
How can I get the file's absolute path deep within a directory using a command?
Asked by showkey
(499 rep)
Feb 13, 2025, 09:02 AM
Last activity: Feb 16, 2025, 10:07 AM
Last activity: Feb 16, 2025, 10:07 AM