Questions tagged [find]

A commandline utility to find files and directories.

Filter by
Sorted by
Tagged with
2
votes
1answer
49 views

How to use the “find” command to find files bigger than 1MB, and execute a chosen command on each file?

I'm trying to write a script that will find all files bigger than 1MB, and one at a time ask the user what to do with each file: delete, compress, or skip. So far this is what I have got: find / -type ...
0
votes
2answers
51 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 ...
2
votes
1answer
696 views

Where is pip config file on Ubuntu 20.04.2 LTS?

I have searched everywhere and I can not find the config file on Ubuntu Ubuntu 20.04.2 LTS with only pip3 installed do I have to make one? The below commands return null: locate pip.conf or locate ...
0
votes
0answers
24 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/...
1
vote
0answers
30 views

Using find with -delete but not scanning a backup disk mounted in /media

I need to find all directories named ABC in /, but I want find to ignore (not scan) the path /media. I've tried a few ways, as I found on the Internet, but none are working properly. My latest three ...
0
votes
2answers
55 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 ...
0
votes
1answer
36 views

Finding Apache files

I'm using a newly installed Ubuntu 18:04 and am new to Unix systems, but very experienced in Windows I've carefully followed an instruction set to install the LAMP files and Apache has been running ...
2
votes
2answers
48 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
vote
2answers
34 views

Cronjob: Deleting the oldest file with at least 50GB while keeping 2 files in the directory

I have a backup script running that creates a ~300GB backup file to a backup folder daily. In that backup folder are some files that are smaller (less than 50GB) as well. Using a cronjob I want to to ...
0
votes
1answer
32 views

find command to search for logs

I need to search logs only in a, b ,c, d, e, f directories and not in the subdirectories The command I use: find . -name "*.log" | xargs rm which deletes important logs inside these ...
0
votes
0answers
59 views

Works in bash, but not on Streamdeck?

I recently bought a Streamdeck for my job (and also just to play with...) and I wanted to program a key to create a playlist in Clementine composed entirely of a single artist, shuffle, and play that ...
-1
votes
1answer
71 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
2answers
84 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
1answer
36 views

why is find on my bind mount not working

I'm running lubuntu 20.04. In /etc/fstab I mount my Debian-home filesystem and from that a bind mount for an folder. cat /etc/fstab # /etc/fstab: static file system information. # # Use 'blkid' to ...
0
votes
1answer
94 views

find files grep result then sort by file datetime modification

I have the following files **file_01.sh** abc bla bla function pause(){ bla foo function juliet(){ foo **file_02.sh** abc bla bla function pause(){ bla bla bla jjdjdjd foo function charlie(...
0
votes
1answer
31 views

Find files that are installed by a package [duplicate]

I have Ubuntu 16.04. Recently I downloaded a Nintendo DS emulator (DesmuME) with sudo apt install desmume. It seemed like I installed it successfully, but if try to search for the file desmume it ...
1
vote
0answers
17 views

find: double wildcard [duplicate]

I do find path/to/folder -name *foo.sh The utility lists the relevant files. However, if I do find path/to/folder -name *foo* I receive an error: find: paths must precede expression: Why? What to ...
2
votes
1answer
73 views

find command is not able to find piped file

I have a file named .sock in /var/spool/ dir. Here is the result of ls -al /var/spool/ drwxr-xr-x. 9 root root 121 Dec 16 09:55 . drwxr-xr-x. 19 root root 267 Dec 14 10:47 .. drwxr-xr-x. 2 ...
0
votes
0answers
31 views

Accidentally moved files with the find command to a non-existing folder

I ran the following command: find . -type f -name '*HEIC.jpg' -exec mv '{}' /media/bkup/New_folder/103APPLE/test_2 \ TEST_2 folder does not exist, I have a TEST 2 (no underscore), but the command ...
1
vote
1answer
31 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
0answers
113 views

command history

Which is the most correct answer for this question: Write a one-line command that searches the last 50 commands that have been used for the term "find", and saves the result in history.txt ...
4
votes
1answer
216 views

How to find all files containing only hex zeroes

I am using 20.04. I had some disk problems which I solved by using fsck. However, this left me with a configuration file that was the correct size but contained only hex '00' throughout instead of ...
0
votes
1answer
36 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
1answer
32 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 ...
0
votes
0answers
43 views

Create bash file to run commands containing loop in parallel

I have the following directory structure in Ubuntu. ./2020 ├── april │   ├── Data_april0.ini │   ├── Data_april-10.ini │   ├── Data_april10.ini │   ├── Data_april-5.ini │   ├── Data_april5.ini │   ├── ...
0
votes
0answers
18 views

rsync remote find prefixes home directory?

I am attempting to pull everything from a remote directory which is more then ten minutes old, and then remove the source files. My remote find seems to be working (tested independently on the remote ...
1
vote
1answer
104 views

Delete files with no permissions only (read, write and execute)

I have a directory, named data, with multiples files in it which have different types of permissions. I want to delete only the files that do not have any permissions, i.e shown as ---------- in ls -l....
0
votes
0answers
56 views

How to find and move files between certain dates? [duplicate]

I have two repertories named 'test1' and 'test2' with multiples files with .jpg or .mp3 extensions. I want to find and move all files between 22-juin-2016 and 21-September-2018 to a new folder called '...
0
votes
1answer
70 views

What does grep -cE “>” myfile.txt do?

I understand how to use grep; however, I am having trouble understanding the function of using ">" in my command?
0
votes
3answers
236 views

How to write a shell pipeline to print the group owner of all sub files a directory?

I need to know the group owner of the files in a specific directory, including the files in its subdirectories.
-2
votes
3answers
108 views

How to find duplicate files with same content, but with same or different names in linux? How to move them to bin or delete them permanantly? [duplicate]

I often end up with duplicate files with same content, but with same or different names while doing the literature study. How to find and delete the duplicate files from terminal? How to just move ...
0
votes
1answer
27 views

Execute command in directories that DON'T contain a certain file extension

I'm looking for a way, to find all (sub-)folders that DO NOT contain a certain file type (*.log) and then execute a command within that folder. All my simulation folders contain three different files: ...
1
vote
1answer
735 views

execute all files under a directory with sed and find

I'm trying to use find to execute all the files under a directory. I have a sed script that will replace all instances of # with //. Assume my directory is /path/to/directory and it contains file1, ...
0
votes
1answer
35 views

Delete certain files with find in subdirectories only

I want to delete certain files within my subfolders but not in the current folder. find offers a neat method to do that: How can I recursively delete all files of a specific extension in the current ...
6
votes
1answer
491 views

Why does my find command get executed two times?

I want to retrieve specific files then cp the result into another directory. It is all working, but my command seems to be executed a second time. For example, I have a file a and I want to cp it ...
-1
votes
2answers
209 views

Linux find command - find files based on inode and device?

I want to find the files with a given inode number. Using find with -inum is not entirely helpfull as its listing files with the inode number from every file system/device. How to confine this search ...
1
vote
1answer
46 views

Why do the results of the find command differ when the path is . and when it is ./*?

When I type find . -name "so*" I get all these results: ./sort ./.cache/evolution/sources ./.config/evolution/sources ./.local/share/sounds But when I type find ./* -name "so*" I ...
0
votes
0answers
641 views

How to find, change attr -i and delete files

I need a command to find, chattr -i and rm -rf (delete) files I have a long list of files which I'm trying to delete using sudo find / | grep nginx | sudo xargs rm -rf and getting the following error:...
-2
votes
2answers
86 views

Check my find/exec command before running

Before I run this, I want to make sure it is correct. I want to delete any .deb files. find /home/andy/.local/share/Trash/expunged/ -type f -exec rm *.deb This works on all files except .deb files. #!...
3
votes
2answers
263 views

Store sha256 hashes into relatives files

I would like to generate sha256 hash for each log file in a folder and store that hash in a file named by the original file name suffixed with ".sha265" int he same folder. For example, I ...
0
votes
0answers
153 views

“Permission denied” while trying to find files

I'm running: sudo find / -name .mysql_history and I'm getting: find: ‘/run/user/999/doc’: Permission denied find: ‘/run/user/999/gvfs’: Permission denied Why? Any help would be appreciated. OS Name: ...
0
votes
1answer
99 views

How to use find command and filter error messages

I'm running this command : find / | grep corectrl | grep log And I get a lot of permission denied errors and I would like to send stderr to null
0
votes
0answers
25 views

difference between find . -name *gz and find . -name “*gz” [duplicate]

What's the difference between find . -name *gz and find . -name "*gz" I sometimes get the same result, other times I don't
1
vote
1answer
160 views

Looking for a tool that finds quickly the duplicates of a known file

I have up to now used the tool fdupes to find all the duplicates of a file but this doesn't seem to work. I tried to do : fdupes -r ~/Large_directory file_to_find.txt Firstly I have, just after ...
6
votes
2answers
1k views

Accidentally copied files to wrong directory

Years ago I copied all the files from /usr/local/bin into /bin. Now my /bin directory is littered with unneeded files. How do I remove them using the find command without having to install third party ...
18
votes
3answers
3k views

What does the asterisk and period do in find -name “*.mp3”?

In find -name "*.mp3", there is an asterisk before the .mp3. Doesn't the * match the character before it any number of times? But there is nothing in front of the asterisk, so what does the *...
0
votes
0answers
43 views

SED command runs from console but not through incrontab

Trying to make find and replace in a file when it is modified by the system or other user. Incron+SED is the combination has worked the best till this moment. Problem is when the command is put into ...
0
votes
1answer
80 views

Can't use multiple extensions with “find” [duplicate]

I write a script to delete all types of archives from the last weak. My script is this and it works: list=$(find $1 -name "*zip." -mtime -7) for x in $list do rm -i "$x" done The problem is when I ...
0
votes
1answer
21 views

Find directories within directories ending in 'l0' that do not contain '*18*' in their names

I am currently doing find . ! -name '*18*' -name '*l0*' -type d but it is listing all the parent directories like 'd1_l0' , 'd2_l0', 'd3_l0' etc only. I actually want subdirectories like 'd1_l0/[15*,...
1
vote
1answer
40 views

Didn't return all hard links to a file

I failed to get all hard links to a file with find / -inum *. linux-5.5.9$ ls -lai total 856 1048577 drwxrwxr-x 24 root root 4096 Mar 12 14:18 . linux-5.5.9$ sudo find / -inum 1048577 /home/...

1
2 3 4 5
12