All Questions
Tagged with command-line find
329
questions
-1
votes
1
answer
91
views
find a file name using command line
I would like to determine the location of a file using command-line. I have tried:
find ./tor.keyring
I must be missing something here
-1
votes
1
answer
68
views
How do I find files of a certain extension(s) except in paths that contain certain strings and then print the result to a file?
Upon a little search, I came up with this command:
> find . -type f \( -name "*.exe" \) | egrep -v
> 'games_1|rei|games|tor|jogos|mods|text' > 1
What I wanted to do was find files ...
1
vote
1
answer
50
views
Why doesn't the given command mask other lines? [duplicate]
Command: sudo find / -name miniedit.py -print | grep -i "miniedit" | tail -1
Output:
find: ‘/proc/10031/task/10031/net’: Invalid argument
find: ‘/proc/10031/net’: Invalid argument
find: ‘/...
4
votes
3
answers
637
views
Search for a "string" or "String with Spaces" recursively that may be a file- or directory-name or a text inside a file
I would like to search for the string rstudio (and its different possible combinations mentioned below) recursively starting from /.
In some locations, rstudio is a string inside another file (but ...
0
votes
3
answers
93
views
Help finding files with the same filename (except what's inside parenthesis) and deleting the smaller size ones
I need to know how to find one or more files with the same filename (except what's inside parenthesis) and delete the one(s) with the smaller size, in a folder. I don't care if it's a GUI app or ...
2
votes
0
answers
229
views
Correct way to delete /boot/firmware .bak files in Ubuntu 22.04?
I'm very new to Ubuntu, I installed the Raspberry Pi Ubuntu Server 22.04.3 LTS (64-bit) image, with their imager tool:
# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:...
0
votes
1
answer
105
views
Find images recursively, copy, rename, and resize?
How can I find images recursively and copy them into their own directories with new names? For example:
folder
- subfolder1
- a.jpg
- subfolder2
- b.jpg
- subfolder3
- c.jpg
So I can get:
...
0
votes
1
answer
345
views
How to use variable in Find and grep command?
find command to get files have part of their names as date ($Y variable that has date in the script)
Y=(date -d "1 day ago" "+%Y-%m-%d")
find /log/bssuser/CDR/Postpaid_CDR_Log/ -...
5
votes
3
answers
2k
views
how to use find command to get files created yesterday?
What is the option used with find to get files created yesterday on Linux scripting?
The below trials don't work:
find /log/bssuser/CDR/Postpaid_CDR_Log/ -newer yesterday
OR
find -mtime 24
----------...
1
vote
5
answers
387
views
list items correctly in bash with a space in their name
I have for example following Files:
test1.txt
test2.txt
test space.txt
I use the following command:
output=$(ls -l --time-style=long-iso | awk '{print $8, $6}')
And I get following output:
test1.txt ...
7
votes
1
answer
3k
views
To delete the directories using find command
I am using the Linux command to delete the directories from my server.
find . ! -name . -type d -mtime +30 -print -delete
But the directories are not deleting. Attached the image , please refer.
I am ...
2
votes
1
answer
125
views
Get stats of number of files of unqiue file extensions including binaries from command line
I am trying to recursively count the number of different extensions and how often each of them occurs in the files of a directory and I want to include the number of files with no extension. I am ...
3
votes
1
answer
534
views
How to delete files with specific size?
Using ls -lSrh I get this output:
-rw-rw-r-- 1 a a 2.4K Feb 15 04:44 10010.png
-rw-rw-r-- 1 a a 2.4K Feb 15 04:43 1000.png
-rw-rw-r-- 1 a a 2.4K Feb 15 04:44 10009.png
-rw-rw-r-- 1 a a 2.4K Feb 15 04:...
0
votes
1
answer
233
views
Calculate video total video length and output as total with respective folder
I'm working with some videos and I want to measure the total length of videos each folder contains and output it with the respective folder. Current structure is like this.
.
└── Parent folder/
├──...
2
votes
1
answer
245
views
exclude files that have specific characters in name
here is my command to find files in a specific location and with specific extensions only, it works fine. But I want to exclude files that have '_bkp' or '_backup' as a substring in their file names -
...
1
vote
1
answer
226
views
how to us the chown command and mv with find command
I have been searching around and found this question which almost solved my problem. The goal is to have a folder on Ubuntu server which other computers connect to and save files. I have two ...
0
votes
1
answer
110
views
Remove all files in folder except files with certain sequence
I have a folder with a massive number of .dat files that follows a certain pattern (i.e., *_t_0.1000.dat, *_t_0.1001.dat .... , *_t_0.2000.dat). What I eventually want to do is to delete all files ...
0
votes
1
answer
779
views
Linux TCP/IP Connections Limit
I want only 1 incoming connection from port 1000 to 65535 to be able to connect to the ubuntu server, how and in what way can it be done?
0
votes
1
answer
1k
views
UBUNTU commands to find file in a folder
I want to find files in a certain folder with certain extension, lets say finding ".sql" in "/backup-nfs". Later on, I will use this command on crontab to delete some files ...
0
votes
1
answer
5k
views
Why does "ls --all --recursive -1 *.htm*" only list files in current directory?
In Terminal I do this command:
ls --all --recursive -1 *.htm*
or this:
ls -a -R -1 *.htm*
But it only lists the html-files in the current directory...?!
According to 'man ls' that option has this ...
1
vote
1
answer
62
views
Find commands include files not in directory
there are only three files/subdirectories in my directory
root@acd95b24dde6:~# ls -l
total 1048
-rw-r--r-- 1 root root 1067355 Sep 6 12:57 apollo13.txt
-rw-r--r-- 1 root root 6 Sep 12 22:02 out....
7
votes
1
answer
2k
views
Why does "cp" complain about identical files when chaining with "find"?
I have a find command as below that lists the matching files:
$ find . -type f -name "*.txt"
./level2/file2.txt
./level2/level3/file3.txt
./level2/level3/level4/file4.txt
./level2/level3/...
0
votes
1
answer
157
views
Cannot locate file after moving
The thing is that I am starting after a few months of experience in linux to use the command line. I was trying to use a new "cursor theme". I found on reddit that I needed to move the file ...
2
votes
1
answer
2k
views
How to find files using the `find` command and add text to them?
What I am trying to do is find files using the find command and then add text to those files.
I tried multiple ways, but nothing works:
find . -type f -iname 'filename' -exec '{}' echo "hello123&...
0
votes
1
answer
70
views
Moving contents of a directory to another
I want to move all the contents including files and sub directories from /home/storage_new/nidhal/foldertest/ to /home/storage_new/nidhal/foldertest1/.
When I use the command ...
while true; do
...
-1
votes
1
answer
3k
views
How do I search for a certain folder located inside the root directory?
I'm specifically looking for the command equivalent of sudo find / -name filename for searching folders instead of files in the terminal. Suggestions with a better set of commands for achieving the ...
0
votes
0
answers
30
views
Display files that have additional rights for group and others that the user does not have
I have a problem to solve for a university class I am taking.
I need a command that lists files in a directory that have a group or others permission that is set, but it is not set for the owner (such ...
1
vote
0
answers
180
views
Find files from timestamps
I have a lot of files, of which I need to show only those created in the last 3 hours, and sort this list by date. I tried to do it with the following command:
find /root/shell/copy/ \( -type f -mmin +...
2
votes
1
answer
1k
views
Where does Kubuntu/KDE keep references to themes?
I hope this message finds you well.
I've attempted to remove a desktop theme via System Settings > Workspace Theme > Desktop Theme. Clicking the 'Remove Theme' button removes the theme from the ...
2
votes
2
answers
1k
views
Find all files with given extension in subfolders, and add substring corresponding to subfolder
I have numerous txt files, scattered across different folders.
- case1
|
- 0.25
|
- case1.txt
- 0.35
|
_ case1.txt
- 0.30
|
_ case1.txt
-...
0
votes
1
answer
1k
views
Shell script to delete all files of certain type in different folders, except 10 latest
First of all, please excuse my poor english.
I am trying to write a shell script to clean up some files of certain type in my backup folders.
I need to remove files of certain type, except 10 newest ...
2
votes
1
answer
187
views
Rename some files to their own name + something else
I have a directory like Photo
and I want to change the names of the directories inside it -> to what they are, but without it [www.faraDa...] like the first one that I change by mv command.
but I ...
-1
votes
3
answers
2k
views
How to list all ASCII files present in a directory?
I want to list all ASCII files that are without extensions(.txt) in my present working directory(home).
I started with the ls command in the terminal but i don't know what i should put in the options ...
0
votes
1
answer
74
views
Find command from left to right and attach ID
I am trying to match MRI files with their volume files.
Background:
Link to files: https://wiki.cancerimagingarchive.net/pages/viewpage.action?pageId=68550661#68550661171ba531fc374829b21d3647e95f532c
...
2
votes
1
answer
226
views
why is output different of counting files?
I just want to count all the files in a directory. I used two method what I found:
tree /home/bkp
Whit this method the output is 2177879 file.
find /home/bkp -type f | wc -l
And with that one is ...
0
votes
0
answers
280
views
Output of find | xargs not redirecting to log file
I'm developing a Bash script which cleans up old data files periodically, and right now everything works except for the log file I'm trying to generate so I can see what it did.
The structure I'm ...
6
votes
1
answer
2k
views
My `find` command in script does not find files and directories with spaces in their names
Some time ago I wrote a script that moves files and directories from Downloads to .Downloads if they are older than 3 days, and delete them from this directory after 30 days. It is working just fine, ...
1
vote
1
answer
324
views
Searching for and deleting files with a certain extension or ending with a number
I'd like my script to find a certain file type and delete it.
I know that find path/to/directory/ -type f -name '*.ext' -delete will find and delete all files with the extension.
Now I'd also like to ...
2
votes
1
answer
4k
views
find -exec rm -r print delete
I am trying to delete terabytes worth of folders and would like to see that things are actually being deleted. Currently, the command
find . -name "labelled_point_clouds" -type "d" ...
0
votes
3
answers
165
views
How do I find folders without a certain name?
I'm trying to find a lot of folders, all without a certain bracket.
They're movie folders, like so:
Zombie Flesh Eaters (1979) [tmdb-7219]
Zombieland (2009) [tmdb-19908]
Zombieland Double Tap (2019) [...
1
vote
1
answer
705
views
Find command shows the files are present but not found inside the directory
I tried search a files using following find command
find . -type f -mtime +18 -name '*[-.]20[0-9][0-9\-]*' -exec basename {} \;
I can see the files output like .
handh2.access.20210429.bz2
handh2....
0
votes
2
answers
215
views
Trying to find files beggining with a number
For my school, I need to search all the files who start with a numeric. Ive tried searching on the web before but didnt find any answer. I need to use the find command.
The question is: Are there any ...
0
votes
0
answers
434
views
Using find to edit multiple files in multiple directories (that are in consistent form)
what I a trying to do is to use find to edit/replace string in multiple files with same name in multiple directories with consistent form
multiple files:
status1_cap
multiple directories:
/home/user/...
0
votes
2
answers
280
views
Find the list of immediate next directory from the given location for reaching a destination file?
We can find the full absolute path of a destination file using find keyword. In my case, I need the list of all immediate next directory to my given location which can lead me to my program log file ...
3
votes
2
answers
2k
views
Find files with certain text within certain date range
I have a folder with huge number of files and I want to extract files present with certain text XYZ created within a date range.
I found this to search files within a date range, but unsure how to ...
-1
votes
1
answer
376
views
sh -c '...' sh {} not working when using if statement and having ' in the filename
I have the following simplified script:
find /home/cas/plex-media/series/ -type f ! -name "*.srt" -exec sh -c '
file=$1
if [ if-statement using $file ]; then
echo "true&...
0
votes
2
answers
125
views
Linux Command [Requirement] [duplicate]
Can anyone tell me what this command means?
I've seen it in a tutorial but can't get it well.
find . -type f | xargs file
1
vote
1
answer
885
views
How to find and return the names of all images containing specific metadata?
I want to find all .jpg files in my directory that contain a specific tag and copy them to a different directory. In particular, I am using GThumb which allows me to put tags to my photos - it stores ...
0
votes
1
answer
305
views
find - Logical operators
I want find shows me the result with excluding permissions 660 AND files.
I.e. it has to show me files that have no permission 660 and all directories.
I run:
find "/path/to/dir" -not \( -...
0
votes
1
answer
137
views
Move all files related to a Basename file in folders and subfolders
I have this files into a folder:
Enero.01200.2019.txt
Enero.01200.2019.pdf
Enero.01200.2019.png
Febrero.03100.2019.txt
Febrero.03100.2019.pdf
Febrero.03100.2019.png
Inside of each .txt file I have a ...