Questions tagged [find]

A commandline utility to find files and directories.

Filter by
Sorted by
Tagged with
0
votes
0answers
14 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
43 views

Can't use multiple extensions with “find”

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
14 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
34 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/...
0
votes
0answers
23 views

How to directly run the examples of “man” for a particular function [duplicate]

man function are best way for learning new information in Ubuntu. They are the most extensive source possible. Every man has a section of **Example (in majority of cases),my query is on ways to use it ...
0
votes
3answers
70 views

How to count files separated by null characters, as returned by; find . -type f -print0?

Extract from man find: -print0 True; print the full file name on the standard output, followed by a null character (instead of the newline character that -print uses). This allows file names ...
1
vote
2answers
43 views

Using grep or find to get all files created in 2018 with “log” extension [closed]

Directory contains catalogs that have the following format: «20180201». I want to Get the list of all files created in 2018 with the "log" extension and their sizes. Can anyone explain me this?
0
votes
0answers
69 views

Unable to use find or ls command in a folder containing 50 million files on an NTFS formatted drive

I have a 10TB data drive that is shared on a ubuntu 18.04 and Windows 10 Pro system (dual boot). It's a NTFS system. I have two folders containing millions of image and xml files (jpg and xml). One ...
1
vote
1answer
69 views

How do I pass a variable to a shell expression run with `sh -c`?

I have the following script that is run in a folder that looks like log_file/2020/04/30 This folder contains a server.log file. And there is one for each date. My script path_date=$(echo "$(pwd)" | ...
1
vote
3answers
48 views

Use “find” to select a zip file and deplace them with mv

First Im beginning on Linux, I try to select zip files only and move them in an other folder, but it's not working :/ Please help Im completely loosed. The code: find . -type f -name "*.zip" | xargs ...
1
vote
2answers
97 views

find grep -E gives error: find: unknown predicate `-E'

I am running the command (on Ubuntu 18.04) find . \| grep -E "(\_\_pycache__\|\.pyc\|\.pyo$)" \| xargs rm -rf and I get the error find: unknown predicate '-E' I used to run this command on ...
-1
votes
1answer
40 views

FIND - how do you use -exec {} +?

I'm learning the command find, and have a search that works, using -exec cp {} \;. THANK YOU FOR THE REPLIES. THIS IS MY EDITED QUESTION: (I hope this meets the formatting conventions.) Below, I ...
1
vote
1answer
26 views

Finding directories inside a folder and deleting folder + parent if subdirectory is smaller than a certain size?

I use gmusic to order and organise my folder structure. However this means I am left with some folders that do not have any files other then normally, a image cover. I would like to sort through all ...
1
vote
2answers
29 views

Filtering for a set of files that start and end with certain characters

Hi I am new to all of this so any help is appreciated!! I have a list of files that I want my bash script to work on such as BG2_45TS02.assembled.fast BG2_45TS02.riboassembled.fastq BG3_45TS02....
0
votes
0answers
27 views

how to find directories , compress and save in other location

I have a task - To search 6 months old directories/files. 1) Tar and save to another location. Below command works perfectly, but saving to same location where old files exist find . -mtime +180 -...
1
vote
2answers
104 views

Find files and rename and move to another directory

When I run the command find dir_1 -type f -name 'f*' I found 2 files there "file_11" and "file_22". Now I want to move those files to another directory "dir_2" using -exec with the "find" command. ...
0
votes
1answer
32 views

How to list all files in a specific directory that starts with 'sh' including inode number in one line

Assuming I'm in the home directory I'm trying to list all the files in /etc to show all files that start with sh along with the inode number I tried the following: sudo find /etc -name 'sh*' # this ...
0
votes
1answer
35 views

Get success status from Find -delete

Wondering how I get success code when using the Find -delete command. Want to know what files it has removed and if there were any errors. I want to save this information in a log file.
1
vote
1answer
32 views

How can I select mp3 files by album?

Sorry, I'm a little newer to Ubuntu. I want to use the terminal to delete a large number of mp3 files, but only the ones in a certain album while leaving files in other albums untouched. I have too ...
0
votes
0answers
23 views

Print only the path of the file found

When I type this command : find / -name Gson the terminal prints all the folders it is searching and then somewhere in between I see the path Can I somehow print just the path of the file found and ...
1
vote
1answer
71 views

More efficient way to find content of files within millions of files

We currently have a series of files ordered by date, by type and then individual XML files containing details, with the basic structure as: 2020-01-01/ FR_abc FR_abc_datetime_random.xml ...
0
votes
1answer
27 views

Cron runs command but it has no effect. How to fix?

I have a storage directory on my apache server and I need to remove all files and folders in it every 6 hours. To achieve that I added next line to crontab file: * */6 * * * root find ~/project/...
0
votes
1answer
54 views

How to store output of find from a background command

I have the following excerpt from a script for finding certain subfolders. Meanwhile a spinner indicates that something is taking longer in the background: # runs find as background task and ...
1
vote
1answer
71 views

Ubuntu restore deleted files from find -delete [duplicate]

So I just recently downloaded Linux Ubuntu and I was experimenting with some of the functions to get used to Linux. While I was trying to learn I wrote in the terminal find . -delete -name (file name) ...
2
votes
1answer
49 views

How can I find out which file was changed a few minutes ago?

I want to transport a configuration from one user to another one. But I don't know in which file the program in question stores its configuration. In order to find out where the configuration is ...
0
votes
1answer
47 views

Bash, get 3 last files detected by first 3 same characters, and move other files

Issue, I have many files in folder backup. 3tpt_20190810_061011816.csv 3tpt_20190811_060912007.csv 3tpt_20190812_060910510.csv 3tpt_20190813_060911075.csv 3tpt_20190814_060911689.csv ...
1
vote
1answer
63 views

How can I print this to file in bash?

I have no idea what I should do to make it work: find . -name '*.txt' -printf '\t%s\t%f\n' |sort -n -r | > txt.txt
1
vote
2answers
269 views

how to find or list file and directories which having size more than 100mb

How to find or list file directories which having size more than 100 MB I'm using du -sh* to get the size of file but my system don't have permission
-2
votes
1answer
48 views

Copy files such that individual files gets copied to the folder having file name as a string within complete folder name [closed]

I am using Cygwin as Linux shell, I have following contents in my current working directory: Files : Abc.dat 123.dat 456.dat Directories: W_Abc_w W_123_w W_456_w Now I want to copy files as ...
3
votes
2answers
176 views

find files with suffix of org or md [duplicate]

I'd like to find all the files suffix with .md or .org find ~ -iregex ".*\.md$" find ~ -iregex ".*\.org$" How could combine them?
6
votes
3answers
605 views

Listing files that end in “.txt” from directories with the word “SALARIO” in its name without using pipes

I used: find . -type d -name "SALARIO*" to find the directories with that word in the name and then: find . -type f -name "*.txt" to find all files that end in txt in those directories. How do I ...
0
votes
1answer
101 views

Remove previous directories before cloning in Gitlab CI/CD

I am using Gitlab Runner for deploy new website version into server. Original scenario of deploying is to shallow clone to new directory with current date time string like "2019-10-27-17-43-05". then ...
21
votes
1answer
2k views

Ubuntu 19.10: why is the “locate” command missing?

OS: Ubuntu 19.10 When I ran locate plymouth, I got dkb@dkb-uee:~$ locate plymouth Command 'locate' not found, but can be installed with: sudo apt install mlocate dkb@dkb-uee:~$ So I installed ...
1
vote
1answer
76 views

stat command format to append '/' to file name if directory, and remove “./” from front

With the following command I have been able to list all the directories relative to the current directory along with the epoch time last modified: find . -exec stat -c '%n: %Y' {} \; the output ...
2
votes
3answers
594 views

cp: cannot stat './1_true/*': No such file or directory, when find directories and copy files

i have many directories like this: $ ls 1_true 1_false 2_true 2_false 3_true 3_false ... i want to copy files in "*_true/" to other directory. when i run command like below find . -name "*_true"...
0
votes
0answers
33 views

How to disable windows Key in Unity desktop [duplicate]

I find that I often hit the Windows key by accident and it opens the "search your computer" and freezes up my computer for 5 or 10 seconds. How do I disable the Windows key? Ubuntu 16.04 LTS
-1
votes
2answers
178 views

how do i move all files from one folder to another in terminal

I have searched various forums with variations on the question - I am trying to move all files including those in sub folders from one folder to another - just the files not the folders. This ...
11
votes
3answers
1k views

How do I find files with no group permissions?

I just want to know how I can find, in a folder, the files that have no group user permission (no read/write/execute) at all, using the terminal.
4
votes
1answer
625 views

Find command with regular expressions

I am practicing a find command and the moment, and am curious about the usage of regular expressions in the find command(similar to grep). Does the command support it? If so, what are the options to ...
3
votes
2answers
284 views

find with wildcard path and export the result to a file

I need to find files that match this pattern: find root_folder/*/match_string/*.ext "*" means any levels of folders or files. So it means any file with an extention "ext" under root_folder or its ...
15
votes
4answers
2k views

Delete empty subfolders, keep parent folder

When I use find /home/user/parentdir -type d -empty -delete it looks recursively for empty subfolders inside /home/user/parentdir and deletes them. But if /home/user/parentdir is also empty, it ...
6
votes
1answer
337 views

How to use multiple criteria for -find

I have a folder where my untagged music is where I want to launch a script to delete all the .png and .jpg except those beginning by the word 'cover'. Here's what I tried: find . -name '*.jpg' -or -...
4
votes
1answer
164 views

Why is the output of this find -newermt command apparently not in order?

When I run touch a.txt && sleep 0.1 && \ touch b.txt && sleep 0.1 && \ touch c.txt && sleep 0.1 && \ touch d.txt && sleep 0.1 && \ ...
1
vote
1answer
2k views

What does “-ls” do when used with “find”?

According to man find: -ls True; list current file in ls -dils format on standard output. The block counts are of 1K blocks, unless the environment variable POSIXLY_CORRECT is set, in ...
0
votes
1answer
278 views

Script to convert many binary files to ASCII

I'd like to run a script, say convert.py (which converts binary to ascii, but outputs to stdout) on 30 or so *.gz files, but instead of output going to screen, it goes to a *.txt file, similar to so: ...
0
votes
1answer
65 views

Can find recurse into some folders but not others in the same command?

I want to use find to recurse through certain subfolders in $HOME but not in others in the same command. Is that possible? To clarify, I'd like to recurse into ~/Desktop, ~/Documents, and ~/Dropbox, ...
3
votes
1answer
71 views

Why does find -exec only accept {} in some positions?

The following command is working fine: find . -iname \*.7z -exec ls {} -al \; But while I change \; to \+ , That is: find . -iname \*.7z -exec ls {} -al \+ I got error report: missing argument to ...
6
votes
1answer
107 views

Adding one variable into multiple parts of an alias? alias nd='mkdir $1' works but cannot add anything after, why? [duplicate]

I have the alias alias moveit='mkdir $1 && find -name "*$1*" -type f -exec mv -t ~/$1 {} +' But I'm not quite sure what I'm doing wrong. Any help would be much appreciated. I'm trying to ...
4
votes
2answers
738 views

Confused about grep and the * wildcard

I am running the following command in order to find all files/directories that do not have anything to do with "flash_drive_data": find . -not -path './flash_drive_data*' | grep "./*flash*" There ...
0
votes
1answer
370 views

Using the “not” operator with find not working as expected

I have a directory "X" with a subdirectory called "lib", as well as other files and directories. This "lib" subdirectory in turn has a bunch of directories and files itself. I am trying to use find to ...

1
2 3 4 5
11