Finding the absolute path of any file

jc -  
 Pseudo -
How to find the absolute path of any file in Unix?

By running ll -R | grep machin, it does not show where the file is located

thank you
Configuration: Windows XP Firefox 2.0.0.1

4 answers

  1. jipicy Posted messages 40842 Registration date   Status Moderator Last intervention   4 898
     
    Hi,

    There is no shortage of possibilities:
    find / -name "le_fichier" whereis le_fichier which le_fichier type le_fichier locate le_fichier
    See the "man" pages for "find, whereis, and which" and the "man bash" for the other 2...

    ;-))
    --
    Z'@+...che.
    JP: Zen, my Nuggets! ;-) Knowledge is only valuable if shared.
    16
    1. jc
       
      Hi
      thanks for your response, but concerning:

      whereis -> it only looks for commands
      which -> it only searches in certain directories

      with find it's perfect

      thanks
      0
      1. laldo > jc
         
        Well, for my part, when I type find / -name "mon_fichier"
        I do get the absolute path of mon_fichier displayed, but this command also returns many other lines, which does not allow me to retrieve the path of this file to then manipulate it using a variable "the_path_of_my_file"
        Thank you for your response.
        0
  2. Pseudo
     
    `pwd` to get the full path of the directory you are in. With an `ls`, a well-placed `grep`, and a bit of string concatenation, you'll achieve your goal.
    7
  3. lami20j Posted messages 21506 Registration date   Status Moderator, Security Contributor Last intervention   3 571
     
    Hello,

    whereis -> it only searches for commands
    which -> it only searches in certain directories


    More specific from shell beginner's usage guide

    The difference between whereis and which

    * whereis - searches for executable files, source files, and manual pages of a command
    * which - searches in the PATH variable for executable files
    --
    lami20j
    3