Questions tagged [find]
A commandline utility to find files and directories.
655
questions
-4
votes
0
answers
33
views
regarding how to find and run a downloaded .sh file [closed]
I downloaded a .sh file from internet when I tried to run an error saying "chmod: cannot access 'setup.sh': No such file or directory". What should i do now ?
0
votes
0
answers
33
views
Ubuntu can't find or reogonize file
I've recently just installed Ubuntu, and it's been working fine, until now.
Ubuntu doesn't seem to regonize new files anymore. I just downloaded a file, put it in my desktop by GUI, and tried using ...
1
vote
5
answers
180
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 ...
0
votes
2
answers
74
views
Detect multiple files at subfolder containing specific string on Linux
I have multiple files of work.log at different subfolders need to detect two keyword Can't find file or Not pass by number
Direct path like :
/folder/Date/Job1/20190116_ADMtest_1/ADM.log
/folder/Date/...
6
votes
1
answer
257
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 ...
1
vote
2
answers
27
views
find special characters in filenames and copy them into new folder. filenames may contain weird non ascii characters and special ones
I like to copy all files with special character "|" in filenames (not the pipe one) into a folder.
However, i have several problems cause filenames may include ascii and not ascii characters,...
0
votes
2
answers
70
views
How to remove null in find when no file does match?
How to remove null in stdout of find when no file does match?
Vformat=(mp4 wmv pgep mov)
for File in ${Vformat[@]}
do
find $SrcDir -iname "*.$File" | xargs ls -l --time-style=full-iso
...
0
votes
1
answer
38
views
find (mmin) gives unexpected results
I originally wanted to find which files have been modified in the last week (before the unexpected results led me onto the quest I describe in this question), so I ran this following command (10080 ...
0
votes
0
answers
64
views
No search results with filebrowser and terminal
Hei,
Ubuntu 22.10
I don't get search results while searching for files both with databrowser
and terminal.
Concrete: "Search" stopps after search in the first mentioned directory.
A lot of &...
2
votes
2
answers
478
views
bash: syntax error near unexpected token '|'
Once logged in, use the "Find" utility to search within the current folder for the file whose name matches the following regex pattern:
lower-case letter
number
special character (% & # ...
2
votes
1
answer
108
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 ...
1
vote
1
answer
209
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:...
-1
votes
1
answer
102
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/
├──...
0
votes
1
answer
47
views
Using find's -prune action
In this script:
#!/bin/bash
# Get the current epoch time minus 1 second to be sure all files are captured.
eptime=$((EPOCHSECONDS-1))
# Execute the commands that will do the sought for file changes:...
4
votes
1
answer
401
views
Can find's -newermt accept epoch time?
I seek to find files made after a specific time similar to how this command does it:
find . -type f -newermt '1/30/2017 0:00:00'
except instead of a date, and time, string, I need the time stamp to ...
2
votes
1
answer
116
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 -
...
2
votes
0
answers
37
views
Is there an easy way to find all files on an ubuntu server and load them along with path information into mysql?
I am using Ubuntu server 20.04 for OwnCloud and backups of multiple networked computers. I know I have many duplicate files on the server and would like to have one database of all files so I can ...
1
vote
1
answer
182
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 ...
1
vote
0
answers
83
views
Copy selected files from one folder, retaining the directory structure
I want to copy all the JPG files from one folder to another and it works.
find /path/from/dirA/ -name "*.JPG" -exec cp "{}" /path/to/dirB \;
To improve on the above, I would like ...
2
votes
1
answer
157
views
Processing files in a directory with variables
This script will be run on Ubuntu 22.04.1 LTS
I am new to Ubuntu and scripting, but I have written code and o/s scripts in other o/s (mostly VMS) and C (many years ago). I know Linux often puts ...
-1
votes
1
answer
60
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
476
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?
4
votes
5
answers
602
views
Use `find` for filename with []
Background: I am trying to find music files that are mentioned in an xml file to organize my music playlists. I'm writing a script to pull out the filenames from the xml tag to automatically find the ...
0
votes
1
answer
358
views
How to copy all log files from a particular date to the current date?
I want to copy the log files from a particular date, say Nov 18, to the current date. How can I do that?
3
votes
1
answer
76
views
Find and delete files starting or ending with certain sign
Using find, I need to find and delete files that start or end with # and files that end with~ but I can't find any way. I tried:
find-name "#*#" -type f -delete
But couldn't make it fully ...
4
votes
2
answers
872
views
How can I extract files in the directory where they're located with the find command?
I have tried to extract multiple files from the directory where they're located with:
for i in $(find . -name '*.tgz'); do # search the tgz files and extract them
tar -xvzf $i
done
I expected ...
0
votes
1
answer
38
views
Unable to find Ubuntu directory in order to delete it
Hello all and sorry for the newbie question, but I'm going through this tutorial: How do I remove "Ubuntu" in the bios boot menu? (UEFI) and am unable to find the Ubuntu subdirectory to ...
0
votes
1
answer
295
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
50
views
How to list the size and path of all files in the working directory by using find?
Now I'm trying to list the size and path by using find
This is what I have done
root@MSI:~/breakfast# find; du
.
./practice.py
./helloworld.txt
./file1.txt
./file2.txt
./messy
./messy/read file
./...
0
votes
1
answer
1k
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 ...
0
votes
1
answer
87
views
Remove Text from multiple folder names in fish or bash
have a folder with sub folders. I want to remove [ garbage.com ] from each folder name. I would like to remove the space after the ]
Currently
$ ls
[ garbage.com ] happy
[ garbage.com ] Sad
[ ...
1
vote
1
answer
53
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....
0
votes
1
answer
170
views
find and copy directories
I have this directory structure:
.../current folder/Bx/Px/
where x are different numbers, like x=1, 2, 3... and so on.
I want to find directories P* in the current folder and then copy all of them ...
2
votes
0
answers
46
views
find does not find directory
I have a folder with information of the courses I am teaching or I have teached. In there I execute find to search by name:
~/Academic/Cursos$ find . -name '2022*' -print
./MaGAAV/Formulación de ...
4
votes
0
answers
4k
views
Invalid magic number and need to load kernel
I'm new to try Ubuntu on my broken laptop to backup some files before reinstall W10. I downloaded Ubuntu 22.04 LTS through official website and used Rufus to create a bootable USB with that ISO thing ...
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
0
answers
107
views
Find command with ZSH based on a list of files
I was used to running BASH but I recently discovered ZSH and I have to say that it works well. However I have a problem with the find instruction below.
Let's say we have 3 webp files and one listing....
0
votes
0
answers
32
views
how to find location of my firefox executable [duplicate]
Hi All: In some previous version of Ubuntu which I guess was 21.10, the location of my firefox executable was /usr/bin/firefox. Now, in 22.04, the location must have changed.
because I have a function ...
0
votes
1
answer
96
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 ...
-1
votes
1
answer
49
views
Listing specific files matching file type
I am using the find command to search for files in the list of directories stored in array fdir.
find "${fdir[@]}" -type f "${sufx[@]}"
I amusing progl=( ".rc" ".el&...
0
votes
1
answer
423
views
get xargs to run a command once for each input instead of once with every input
I thought I could run the following
find ./ -iname "*\.mkv" | xargs -d "\n" ffprobe -show_streams -i
to get codec information for each file, but it appears xargs is trying to pass ...
2
votes
1
answer
919
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&...
-1
votes
1
answer
53
views
Using files instead of directories in find command
I am using the find command on a number of directories stored in fdir array to execute head on each file. How can I adapt the code to also use files in fdir?
nf=${#fdir[@]}
for (( i=0 ; i < $nf ; ...
0
votes
1
answer
124
views
Compress PDF recursively - Find PDF in directories and subdirectories and execute script
I want to execute a script on each PDF in all subdirectories but I have a problem with filenames containing spaces.
I've searched a lot and this post seems to be a solution but I don't find a way to ...
0
votes
1
answer
64
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
vote
1
answer
112
views
VLC how to play all files that contain specific word
I would like to play all files in all subdirectories that contain specific term.
I tried it using:
find . -type f | grep Song | vlc
I think I might be misunderstanding how | works, because it doesn't ...
-1
votes
1
answer
2k
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 ...
2
votes
1
answer
1k
views
Using "find" command with "-mtime" and "-exec rm -rf" Deletes More Files than Expected [closed]
I am testing with the following command line to delete older files on Ubuntu 18.04:
sudo find /media/Archive -type f -mtime +463 -exec rm -rf {} \;
Currently the /Archive folder has files from 2021 ...
0
votes
0
answers
28
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
123
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 +...