How to Locate a Specific File or Files on a UNIX Server

Imagine that you have saved a file but can't remember the root directory for the file location. If you know how to locate a specific file or files on a UNIX server, you will never be plagued with this problem again. Read on to learn how to locate a specific file or files on a UNIX server.

Instructions

    • 1

      Enter the "ls-lrt" command to create the directory listing for all your files, if you remember the correct directory but cannot recall your filename. Make sure that the newest file appeard at the end of the listing. Use the "Grep" utility of Unix to help you search for the filename. From your directory, type in grep plus the keyword that is identifiable with your filename.

    • 2

      Type in "Find -Name Filename -Print" in your home directory, if you remember the filename but not its location. "Find" will locate all of your files beginning with "Filename" while "Print" will list all your files with the same filename that you have entered.

    • 3

      Locate the file that you have modified since yesterday by entering "Find -Mtime -1 -Print." If you are locating a file that was worked two days ago, enter "2" or "-2".

    • 4

      Enter "Find -Name "*Part*" -Print" in case you only know some parts of the filename. "Part" stands for the chunk of the filename that you do remember. Make sure that this fragment is enclosed in quotation marks.

    • 5

      Enter "Grep -I Word Find.Name "*" -Print" in case you remember only a phrase of the file. Notice that this command makes use of both find and grep. For example, you are unsure whether a certain word in a file is in lower or upper case. The "-I" in the command disregards the case and will start searching for the "word" in all your files under the same directory you are presently in.

Tips & Warnings

  • Review your document files often.

  • Make a list of the date that you work on files, as well as their filenames so that you have an independent record of the files on your UNIX server.

  • Use care when typing in UNIX commands. Slight variations in the command string can have unexpected and disastrous results.

Related Searches:

Comments

You May Also Like

Related Ads

Featured