Sponsored Content
Top Forums Shell Programming and Scripting Search file in the whole machine Post 303037473 by Corona688 on Friday 2nd of August 2019 11:41:11 AM
Old 08-02-2019
If you have locate installed, this should find it efficiently:
Code:
locate 'partoffilename'

If you don't, and really want to do a brute-force search of the entire system, bar nothing and nobody:
Code:
find / -name '*partoffilename*' 2>/dev/null

The 2> because this is going to spew lots of errors when it blunders through areas it doesn't belong.

If you can narrow it down even the slightest bit, you can make it much faster:
Code:
find /home -name '*partoffilename*'

This User Gave Thanks to Corona688 For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Search files for a string in the remote machine

Hi all, I want to search the files in a remote machine for a particular string. The SSH command I wrote is giving an error even when the syntax is correct. ssh user@hostmachine find . -name "*.txt" -exec grep "ARIVU" '{}' \; The error it gives is find: missing argument to `-exec' When the... (2 Replies)
Discussion started by: a_rivu
2 Replies

2. Red Hat

To find the LATEST file from a dir on REMOTE machine and SCP to local machine?

Hi All, URGENT - Please help me form a scipt for this: I need the LATEST file from a dir on REMOTE machine to be SCP'd to a dir on local machine. (and I need to execute this from local server) I know that the below cmd is used to find the LATEST file from a dir. But this command is not... (3 Replies)
Discussion started by: me_ub
3 Replies

3. Shell Programming and Scripting

How to transfer files from unix machine to local machine using shell script?

Hi All.. Am new to Unix!! Am creating a shell script in which a scenario is like i have transfer the output file from unix machine (Server) to local directory (Windows xp). And also i have to transfer the input file from the local directory to Unix machine (Server) Any help from you... (1 Reply)
Discussion started by: vidhyaS
1 Replies

4. Shell Programming and Scripting

sed help - search/copy from one file and search/paste to another

I am a newbie and would like some help with the following - Trying to search fileA for a string similar to - AS11000022010 30.4 31.7 43.7 53.8 60.5 71.1 75.2 74.7 66.9 56.6 42.7 32.5 53.3 I then want to replace that string with a string from fileB - ... (5 Replies)
Discussion started by: ncwxpanther
5 Replies

5. Shell Programming and Scripting

Perl - use search keywords from array and search a file and print 3rd field when matched

Hi , I have been trying to write a perl script to do this job. But i am not able to achieve the desired result. Below is my code. my $current_value=12345; my @users=("bob","ben","tom","harry"); open DBLIST,"<","/var/tmp/DBinfo"; my @input = <DBLIST>; foreach (@users) { my... (11 Replies)
Discussion started by: chidori
11 Replies

6. Shell Programming and Scripting

Nested search in a file and replace the inner search

Hi Team, I am new to unix, please help me in this. I have a file named properties. The content of the file is : ##Mobile props east.url=https://qa.east.corp.com/prop/end west.url=https://qa.west.corp.com/prop/end south.url=https://qa.south.corp.com/prop/end... (2 Replies)
Discussion started by: tolearn
2 Replies

7. Shell Programming and Scripting

Retrieving the relevant search from search file in the main file

I have two files: file 1: hello.com neo.com,japan.com,example.com news.net xyz.com, telecom.net, highlands.net, software.com example2.com earth.net, abc.gov.uk file 2: neo.com example.com abc.gov.uk file 2 are the search keys to search in file 1 if any of the search... (7 Replies)
Discussion started by: csim_mohan
7 Replies

8. UNIX for Dummies Questions & Answers

Search file and print everything except multiple search terms

I'm trying to find a way to search a range of similar words in a file. I tried using sed but can't get it right:sed 's/\(ca01\)*//'It only removes "ca01" but leaves the rest of the word. I still want the rest of the information on the lines just not these specific words listed below. Any... (3 Replies)
Discussion started by: seekryts15
3 Replies

9. Shell Programming and Scripting

Read in search strings from text file, search for string in second text file and output to CSV

Hi guys, I have a text file named file1.txt that is formatted like this: 001 , ID , 20000 002 , Name , Brandon 003 , Phone_Number , 616-234-1999 004 , SSNumber , 234-23-234 005 , Model , Toyota 007 , Engine ,V8 008 , GPS , OFF and I have file2.txt formatted like this: ... (2 Replies)
Discussion started by: An0mander
2 Replies

10. Shell Programming and Scripting

Run a loop that will search for a file to thousand machine and know who owns the file

Run a loop that will search for a file to thousand machine and know who owns the file $ for i in abc{01..02} > do > echo -n $i > ssh $i "sudo find / -name .ssh -exec ls -l {} \;|grep id" > done abc01-rw-------. 1 root root 1675 Nov 10 2018 id_rsa abc01-rw-------. 1 root root 1675 Nov 14... (6 Replies)
Discussion started by: invinzin21
6 Replies
FTWHICH(1)						      General Commands Manual							FTWHICH(1)

NAME
ftwhich - fault tolerant search for a command name SYNOPSIS
ftwhich [-#hIp][-t#] program_name DESCRIPTION
ftwhich is a fault tolerant version of the which(1) command. ftwhich searches for a given program in all directories included in your PATH environment variable and reports all files with a name that approximately matches the given program_name. ftwhich achieves fault tolerance by calculating the so called Weighted Levenshtein Distance. The Levenshtein Distance is defined as the minimum number of character insertions, deletions and replacements that transform a string A into a string B. ftwhich is similar to the which command with the following differences: - ftwhich is by default NOT case sensitive - ftwhich is fault tolerant - Some shells have a build in which command that will also search aliases. ftwhich can naturally not search for aliases as it does not know about alias definitions. - ftwhich lists all files that approximately match. The files first shown take preference over files of the same name printed later as they are from directories listed earlier in the PATH. - The level of fault tolerance can be adjusted by specifying the optional parameter tolerance. A tolerance of 0 specifies exact match. OPTIONS
-h Prints help/usage information. -I Do case sensitive search (default is case in-sensitive) -p print the actual distance value in front of the found filename. This value is equal to the number of insertions, deletions and replacements necessary to transform the name of the found program into the search key. -# or -t# Set the fault tolerance level to #. The fault tolerance level is an integer in the range 0-255. It specifies the maximum number of errors permitted in finding the approximate match. The default tolerance is (strlen(searchpattern) - number of wildcards)/6 + 1 program_name The program file to search for. '*' and '?' can be used as wildcards. '?' denotes one single character. '*' denotes an arbitrary number of characters. The last argument to ftwhich is not parsed for options as the program needs at least one program_name argument. This means that ftwhich -x will not complain about a wrong option but search for the program named -x. EXAMPLE
Search for all programs like gcc in your PATH: ftwhich gcc This will e.g. find gcc or cc or CC ... To find all files that start with any prefix and end in config and differ in 2 letters from the word config: ftwhich -2 '*config' To find all files that exactly start with the prefix if: ftwhich -0 'if*' To find all clock programs: ftwhich -0 '*clock*' BUGS
The wildcards '?' and '*' can not be escaped. These characters function always as wildcards. This is however not a big problem since there is normally hardly any command that has these characters in its name. AUTHOR
Guido Socher (guido@linuxfocus.org) SEE ALSO
whichman(1), ftff(1) Search utilities January 1999 FTWHICH(1)
All times are GMT -4. The time now is 01:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy