All Questions

Tagged with
Filter by
Sorted by
Tagged with
7
votes
4answers
889 views

How can I find a file whose name includes a given string, such as “abcde”?

Within a set of directories, how do I find a file whose name includes a given string, such as "abcde"?
6
votes
2answers
35k views

How to list ALL directories according to their size? [without including the parent directory]

I have a bunch of random folders, some of them are hidden (beginning with a period). I want to list all of them, sorted by their sizes. I have something on the lines of this in mind: ls -d -1 -a */ ...
6
votes
3answers
2k views

Deleting lots of files

I accidentally created 8 million files and every time I'm trying to delete them the server almost dies because of the rm process eating all disk IO (the server is remote without console). Should ...
5
votes
5answers
2k views

Find fullpath and filename under a directory then pass to an executable file as arguments

I'd like to find fullpath and filename of all .txt under a directory, and pass to a executable file ./thulac . It cost me some time to reach: find /mnt/test -name "*.txt" -print0 |xargs -l bash -c '....
5
votes
5answers
2k views

How to create a bounded queue for shell tasks?

I have 1000 gzipped files which I want to sort. Doing this sequentially, the procedure looks pretty straightforward: find . -name *.gz -exec zcat {} | sort > {}.txt \; Not sure that the code ...
4
votes
2answers
361 views

pipeline as find's -exec argument

Is it possible to use a pipeline command as an argument to find's -exec option? This means, I want to do something like this: find . -name CMakeLists* -exec cat '{}' | grep lib \; where I am trying ...
3
votes
2answers
5k views

Sort the output of find before piping to openssh

I'm using this command to recursively generate a SHA-512 hash for each file in a directory hierarchy: find . -type f -exec openssl sha512 {} \; I'd like to sort the files in lexicographical order ...
3
votes
2answers
2k views

How to get the exit code of commands started by find?

I am using "find" in a Travis-CI to check a particular file type with a program. (To be exact, it is a shellcheck check.) However, when using find the exit codes of the command(s)/subshells executed ...
2
votes
4answers
62 views

Access a file located with find

In many cases after I find a file using the find command I then want to open the file or cat it or maybe print it. How can I operate on the result from find? For example, : find . -name "myfile.txt" ...
2
votes
1answer
1k views

Understanding the following find command

I am currently having a hard time understanding the following find command: find / -o -group `id -g` -perm \  -g=w -perm -u=s -o -perm -o=w\ -perm -u=s -o -perm -o=w \ -perm -g=s -ls  ...
1
vote
4answers
517 views

I have 10 files in Unix folder with .txt extension, here I need to get all files apart from fgh.txt (any one) file, what is the UNIX Command?

I have 10 files in Unix folder with .txt extension. Here I need to get all files apart from fgh.txt (any one) file. What is the UNIX Command? 1.abc.txt 2.bcd.txt 3.cde.txt 4.def.txt 5.efg.txt 6.fgh....
1
vote
2answers
1k views

Search and delete .Trash

I have 4 large USB devices with lots of backups collected over the years. I want to search for all .Trash folders and delete the contents on Fedora 17. I tried the following which failed:- # ...
1
vote
1answer
1k views

How to escape spaces while using command's output in command line [duplicate]

I want to perform the following command in command line : $ md5sum $(find . -type f) But this would cause problems when it encounter files with spaces in filenames : md5sum: Kaufmann: No such ...
1
vote
2answers
127 views

List the files of another format while finding a certain name pattern

I had wanted to edit the txt files of videoA and videoB only if the movs files names contains the namespace -test For eg. videoDir |-videoA |- videoA_v001_test.mov |- ...
1
vote
3answers
202 views

How to enter foo-* folder without actually using wildcard or shell expansions?

Short story I'm looking for the command to enter first found foo-something directory like: cd foo-* but without using wildcard (or other special shell characters). Long story As part of the ...