Tagged Questions
2
votes
4answers
49 views
find command: how to ignore pathname?
I have to find some type of files in a directory and it's subdirectories and I only have to print out the filenames.
So here's the main command:
find -type f -name "*.c"
Now, how could I cut the ...
2
votes
4answers
102 views
Find and copy directories containing file type
I have a directory "Movies" containing subdirectories "Movie Name". Each subdirectory "Movie Name" contains a movie file and related image/nfo files etc.
I'm trying to copy all directories containing ...
6
votes
1answer
113 views
find is missing a result — how is that possible?
What conditions explain this output:
root@ip:/# find / -name "server.xml" -print
/etc/tomcat7/server.xml
root@ip:/# ls /var/lib/tomcat7/conf/server.xml
/var/lib/tomcat7/conf/server.xml
I am ...
2
votes
3answers
137 views
file mass deletion
I would like to delete all the txt, xls,pdf files in a directory as well as its sub directories. I would like to save everything else.
find . -type f ! -iname '*.xml$,.png$,.jpeg$,.gif$,' -delete
...
1
vote
4answers
154 views
Is there a command to list files, exclude sub-directories and display size and date?
Before I begin please assume I have only basic knowledge in UNIX. Basic meaning I have only started reading about it since last week for a work related purpose.
I have been experimenting with the ls ...
17
votes
4answers
717 views
Howto find duplicate files on disk
Is it possible to find duplicate files on my disk which are bit to bit identical but have different file-names?
2
votes
4answers
105 views
How to count recursively for the number of files in several directories?
I have a directory, containing a lot of files and directories.
I am trying to get the number of files (and directories) contained recursively in every directory.
I tried the following approach:
for ...
1
vote
2answers
107 views
A bunch of files have 777 permissions
I have been learning Python and Bash scripting, and I up to now I have given my scripts 777 permissions. Having learned more about how to set permissions, and knowing this is a bad idea, I ran the ...
2
votes
4answers
339 views
Move all files with a certain extension from multiple subdirectories into one directory
Suppose I have a bunch of zip files in several directories:
Fol1/Fol2
Fol3
Fol4/Fol5
And I want to move them all to a common base folder. How would I do this?
2
votes
2answers
56 views
Select greatest numbered filename
Simple requirement but can't find anything online which can achieve it.
I have a list of dated files as below...
filename_20120101.dat
filename_20120102.dat
filename_20120103.dat
I ...
13
votes
3answers
604 views
locate vs find: usage, pros and cons of each other
In Linux and Unix systems there are two common search commands: locate and find.
What are the pros and cons of each? When one have benefits over the other?
2
votes
2answers
104 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 ...
6
votes
4answers
304 views
Find images by size: find / file / awk
I've been trying to find png image files a certain height (over 500px). I know that file will return image dimensions. Example:
$ file TestImg1a.png
TestImg1a.png: PNG image data, 764 x 200, ...
3
votes
2answers
189 views
List files created on Sundays
How do I list/find all the files created on Sundays or Mondays?
How do I use the date parameter to display them?
Something like :
ls -f date + %a
or
find -type f | date +%A
or
find -type f ...
7
votes
2answers
206 views
Search MP3/Ogg files by tags/parameters from the command line
Is there any utility to search MP3/Ogg files by tags (or other characteristics) from the command line? (e.g. finding all audio files longer than 10 minutes with genre set to 'Rock').
I found this, ...
2
votes
1answer
92 views
How to run a command against all the files of particular types on a filesystem?
I've just recovered tons of files (distributed in a complex directory structure, having very long names, using Unicode symbols, spaces etc in names) from a damaged hard drive. Now I'd like to verify ...
1
vote
3answers
195 views
Merging files into one also adding a new line between each file
I'm using
find . -type f \( -name "*.js" ! -name "*-min*" \) -exec cat {} \; > all.js
to merge files together. Unfortunately I don't get a new line after each file but it ends and the new file ...
4
votes
2answers
581 views
Finding all “Non-Binary” files
Is it possible to use the find command to find all the "non-binary" files in a directory? Here's the problem I'm trying to solve.
I've getting an archive of files from a windows user. This archive ...
2
votes
2answers
347 views
Remove 50GB oldest files in busybox when used capacity reaches 95%
Ok i have requested a code here but initial i didn't ask to make it busybox compatible. My bad. I'm new to linux and coding.
The code needs to do the following:
Delete 50GB of oldest data (dir ...
2
votes
2answers
101 views
How to generate folder ownership lists for each user?
I'd like to generate several separate lists for each user in Ubuntu. The lists contains the files and folders belong to each user.
Using the command following list me all the users in the system:
...
1
vote
1answer
1k views
Find a file in lots of zip files (like find command for directories) [duplicate]
Possible Duplicate:
Find recursively all archive files of diverse archive formats and search them for file name patterns
I need to search for a file in all zip files in a directory.
Is ...
1
vote
1answer
258 views
rename files maching specific mtime value within directory
I use simple set of shell commands to in order to create mysqldumps daily. The script is called by cron daemon. It looks like:
presentdate="`date +%d-%m-%Y_%H:%M.%S`"
basedir="/var/db_my_backup"
...
6
votes
2answers
123 views
How can I substitute into this shell command?
I have a find command that I want to substitute a list of GIDs into.
Here's the command:
find / -follow \( -group 39 -o -acl_group 39 \) -exec ls -ln {} \; 2> $HOME/error.39.log 1> ...
10
votes
1answer
4k views
How to skip “permission denied” errors when running find in Linux? [duplicate]
Possible Duplicate:
How do I remove “permission denied” printout statements from the find program?
When I run this command in Linux (SuSE):
find / -name ant
I get many error ...
0
votes
3answers
1k views
How to find executable filetypes?
I want to find file types that are executable from the kernel's point of view. As far as I know all the executable files on Linux are ELF files. Thus I tried the following:
find * | file | grep ELF
...
2
votes
2answers
132 views
find command for the newest 500 files in a directory tree and also be POSIX compliant
I am looking for a single line shell script or unix command to find the newest 500 files in a directory. Major constraints are it should be POSIX complaint and the directory can have tons of files.
1
vote
1answer
114 views
Listing specific lines in listed files
Find all files in /tmp that are ordinary files and print the lines
that end with Programming.
For this problem I know how to list all files in /tmp.
What I do not know how to do is whether to use ...
3
votes
2answers
604 views
List of Recently Modified Files
How can I Get a list of all files modified , say 3 months ago.
I checked this question but I was not able to apply it to my scenario.
I am trying this now , it seems to be working , but I know there ...
1
vote
1answer
568 views
Rename All Files with a Certain Name
I'm trying to find certain files with the name "stringx" and replace the name (but not the extension) with "stringy". So basically for stringx.txt and stingx.cs, I'd want stringy.txt and stringy.cs. ...
7
votes
3answers
2k views
Getting size with du of files only
How can I get the size of all files and all files in its subdirectories using the du command.
I am trying the following command to get the size of all files (and files in subdirectories)
find . ...
0
votes
1answer
123 views
Listing only the files in a folder and inside its subfolders
Is there a linux command for getting only the files in a folder and inside its subfolders? I have used the find command, but it is displaying all the files and folders. I am executing this shell ...
3
votes
3answers
304 views
How to grep recursive UNIX tree results along with each tree node?
Here is what I do
tree -R /Applications/NetBeans/NetBeans\ 7.0.app/ | perl -e 'while (<>) { print if /java$/ }'
but of course this doesn't return the result I want.
What I want is to display ...
1
vote
0answers
84 views
How to search for file contents [duplicate]
Possible Duplicate:
Finding a substring in files across subdirectories with a single built-in command?
I know that I can use grep for a single file, but what about a whole directory tree?
2
votes
2answers
301 views
Find incoming symlinks
In Linux, what is the best way to find all symbolic links that point to a given file (regardless of whether the symlink is relative or absolute)? I realize this will require scanning the whole ...
7
votes
2answers
6k views
How to find binary executables within a directory
How do I list all binary executable files recursively within a directory?
I use find command like this:
find /mydir/mysubdir -executable -type f
All executable files are listed (excluding ...