Questions tagged [file-search]
87 questions
49
votes
10 answers
How can I "grep" patterns across multiple lines?
It seems I am misusing grep/egrep.
I was trying to search for strings in multiple line and could not find a match while I know that what I'm looking for should match. Originally I thought that my regexes were wrong but I eventually read that these…
Jim
- 9,750
- 15
- 57
- 84
45
votes
7 answers
List the files containing a particular word in their text
I would like to list the files recursively and uniquely that contain the given word.
Example: Checking for word 'check', I normal do is a grep
$ grep check * -R
But as there are many occurrence of this word, I get a lot of output. So I just need…
mtk
- 26,802
- 35
- 91
- 130
24
votes
3 answers
How can I search in vim for a pattern that is NOT case sensitive?
I occasionally search through files in vim or less using / or ? but as far as I can tell, the search patterns are case sensitive.
So for example, /foo won't find the same things that /FOO will. Is there an way way to make it less strict? How can…
Mike B
- 8,769
- 24
- 70
- 96
16
votes
2 answers
Find font file from font name on Linux
I have a font with the name Media Gothic. How can I find the file name of that font in Linux? I need to copy that file to another system. I've tried:
find /usr/share/fonts/ -name '*media*'
But this gives no results. gothic gives some other fonts.…
jcubic
- 9,612
- 16
- 54
- 75
14
votes
3 answers
List all files in a directory recursively but exclude directories themselves
Simple question, I'm running the following find command:
find . -type d \( -path ./.git -o \
-path ./log -o \
-path ./public -o \
-path ./tmp \) \
-prune -o …
TheDelChop
- 249
- 1
- 2
- 4
12
votes
3 answers
How to search for video files on Ubuntu?
I had downloaded a video a few months back. I'm not very well remembering the name by which it is saved. Is there any command or any method that will output only video files so that I can search for my video there? From man pages, I couldn't find…
Ravi
- 3,723
- 13
- 44
- 66
11
votes
4 answers
find all end subdirectories in a tree
given the following structure:
oz123@debian:~/ $ tree .
.
├── a
│ ├── a1
│ ├── a2
│ └── a3
├── a1
│ ├── a11
│ ├── a12
│ └── a31
├── b
│ └── b1
│ ├── b11
│ │ └── b21
│ │ └── b31
│ ├── b12
│ └──…
oz123
- 507
- 7
- 20
11
votes
2 answers
Get list of all files by mask in terminal
I want to find all *.h,*.cpp files in folders with defined mask, like */trunk/src*. So, I can find separately *.h and *.cpp files:
find . -path "*/trunk/src/*.h"
find . -path "*/trunk/src/*.cpp"
What is the best way to get the file-list both of…
Loom
- 3,863
- 11
- 30
- 44
10
votes
5 answers
Why is the command "find | grep 'filename'" so much slower than " find 'filename' "?
I tried both commands and the command find | grep 'filename' is many many times slower than the simple find 'filename' command.
What would be a proper explanation for this behavior?
yoyo_fun
- 855
- 3
- 9
- 14
10
votes
4 answers
Trying to use `pwd` inside an alias giving unexpected results
If I want to search a file in the system I use the following command:
sudo find `pwd` -name filename.ext
I want to make an alias for an easier word like search, so I used the command:
alias search "find `pwd` -name "
The problem is that the…
asaf92
- 292
- 3
- 14
9
votes
4 answers
Search and Delete duplicate files with different names
I have a large music collection stored on my hard drive; and browsing through it, I found that I have a lot of duplicate files in some album directories. Usually the duplicates exist alongside the original in the same directory.
Usually the format…
Cestarian
- 1,991
- 5
- 26
- 45
9
votes
2 answers
Remove unknown unicode character from textfiles - sed, other bash/shell methods
I need to search and replace all occurences of an unknown character in some files having the same name.
Opening such files with vi, I read <91> code for that character.
Opening them with nano, I read a "question mark" in a diamond (black rhumble).
I…
jasmines
- 191
- 1
- 1
- 5
8
votes
2 answers
more less ...skipping... when searching
When I search a file in less or more, it will remove lines and replace them with "skipping". Does anyone know what causes this and/or how to avoid it?
After I '/' search a log file using either more or less, I see this:
crw-rw-rw- 1 root …
kdoggett
- 83
- 1
- 3
7
votes
2 answers
How to find files with a certain subpath?
I need to find all xml-files that are placed in folders named config. Also config must be somewhere under a folder named trunk. For example, I am interested in all files like…
Loom
- 3,863
- 11
- 30
- 44
7
votes
3 answers
Search for special characters using grep
I want to search for the lines that contains any of the following characters:
: / / ? # [ ] @ ! $ & ' ( ) * + , ; = %
user9371654
- 811
- 4
- 17
- 32