I technically know how to do all these things, but combining it is problematic. Inode is saved in first line of text file (I can eventually read it directly from file), I need results saved to the same file.
How can I do this?
I technically know how to do all these things, but combining it is problematic. Inode is saved in first line of text file (I can eventually read it directly from file), I need results saved to the same file.
How can I do this?
You can use find utility with -inum parameter. From man 1 find:
-inum nFile has inode number
n. It is normally easier to use the
-samefiletest instead.
You can use find command with the argument -inum with inode number like as below
Example-
touch /home/ajeet/original_file.txt
ln /home/ajeet/original_file.txt /root/hard_link_file.txt
ls -li /root/hard_link_file.txt
1704088 -rw-r--r-- 2 root root 0 May 24 18:24 /root/hard_link_file.txt
ls -li /home/ajeet/original_file.txt
1704088 -rw-r--r-- 2 root root 0 May 24 18:24 /home/ajeet/original_file.txt
find / -inum 1704088
/home/ajeet/original_file.txt
/root/hard_link_file.txt
findinstead oflocate. – Yurij Goncharuk May 24 '19 at 19:29findsearch only in folder where script is located? – Corporal Girrafe May 25 '19 at 17:44find -ls ln -i /home/user/folder/file | cat>>savebut i getfind: paths must precede expression lnerror. And this is the issue, i don't have the path, i want to search in whole system. – Corporal Girrafe May 25 '19 at 19:45