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

By eHow Computers Editor

Rate: (2 Ratings)

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

Difficulty: Moderate

Step1
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.
Step2
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.
Step3
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”.
Step4
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.
Step5
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.

Post a Comment

POST A COMMENT

Request a New How-To Article

Looking for more How To information? Chances are there’s an eHow member who knows how to do what you’re looking to do. Submit an article request now!

eHow Article:  How to Locate a Specific File or Files on a UNIX Server

eHow Computers Editor

eHow Computers Editor

Category: Computers

Articles: See my other articles

Related Ads