Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Bash list files as {path + file}

I want to search for a file that has 1033 bytes of size. Therefore, I write ls -lRA, which outputs around 200 files, in around 20 folders. When I grep for the file with ls -lRA | grep 1033 I get one element alone, -rw-r----- 1 root bandit5 1033 Dec 3 08:14 .file2. However, there are 20 files with this name, so finding this one is a hard task.

My idea is to get an output such as -rw-r----- 1 root bandit5 1033 Dec 3 08:14 ./direcctory1/.file2, is it possible?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

I suggest to use GNU find. Search from current directory:

find . -size 1033c -ls

Output (e.g.)

110578      3 -rwxrwxrwx   1 root     root         2268 Dec  6 10:10 ./direcctory1/.file2

See: man find

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading