09-17-2016
Display largest files in multiple directories
Trying to locate the 25 largest files with read/execute world permissions to be displayed from a combination of 4 different directories. I'm rather new at UNIX and trying to learn the basics.
This is what I have come up with so far:
find /dir1 /dir2 /dir3 /dir4 -perm -u+rx | sort -nr | head -25
My results seems to be giving me 25 files just from the last directory and ignoring the other 3. Is there a way to display the file permissions from in my results as well? I have been looking at the find man page, but I can't seem to figure this out.
Any suggestions will be greatly appreciated!
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
The script below is written to ftp files to different directories on the destination server, but I'm not sure whether I have written the code correctly or not.
Can anyone help me on this?
#!/bin/sh
FILE_NAMES="FileA
FileB
FileC"
SERVER=xxxx
USERID=abcd
PASSWD=xxxxx... (12 Replies)
Discussion started by: abrd600
12 Replies
2. Shell Programming and Scripting
I'm trying to come up with a way of finding largest directories in a filesystem (let's say filesystems is running ot of space and I need to find what is consuming all the space). If a directory is a single filesystem, then it's easy, I just run "du -sk *| sort -nr". But the problem is, if some... (8 Replies)
Discussion started by: GKnight
8 Replies
3. UNIX for Dummies Questions & Answers
hello all.
i would like to be able to find the names of all files on a remote machine using ssh.
i only want the names of files, not directories
so far i'm stuck at "du -a | sort -n"
also, is it possible to write them to a file on my machine? i know how to write it to a file on that... (2 Replies)
Discussion started by: user19190989
2 Replies
4. Shell Programming and Scripting
What is the correct command for finding and displaying the largest file on the system?
I don't know how to specify "largest" with "find", and pipe that to something that will display the file contents. Or should I be using cat, more, less, ls, or something else? (4 Replies)
Discussion started by: raidkridley
4 Replies
5. Shell Programming and Scripting
I have multiple files that starts as TRADE_LOG spread across multiple folders in the given structure..
./dir1/1/TRADE_LOG*.gz
./dir2/10/TRADE_LOG*.gz
./dir11/12/TRADE_LOG*.gz
./dir12/13/TRADE_LOG*.gz
when I do ftp uisng mput from the "." dir I am getting the below given error
mput... (1 Reply)
Discussion started by: prasperl
1 Replies
6. Shell Programming and Scripting
Hi,
I have a directory /home/datasets/ which contains a bunch (720) of subdirectories called hour_1/ hour_2/ etc..etc.. in each of these there is a single text file called (hour_1.txt in hour_1/ , hour_2.txt for hour_2/ etc..etc..) and i would like to do some text processing in them.
Each of... (20 Replies)
Discussion started by: amarn
20 Replies
7. Shell Programming and Scripting
I'm trying to zip multiple files from within certain directories which are named out.
find . -name "*_out -print | xargs zip *
I get this error :
A file or directory in the path name does not exist
how do I get this to work from within my KSH script? (2 Replies)
Discussion started by: Bperl1967
2 Replies
8. Shell Programming and Scripting
Hi
I have the following file structure and I want to rename all the abc.jar files to abc_backup.jar
rock@server:~/rakesh> ls -R
.:
test1 test2 test3
./test1:
abc.jar
./test2:
abc.jar
./test3:
abc.jar (2 Replies)
Discussion started by: rakeshkumar
2 Replies
9. Shell Programming and Scripting
Hi All,
Everyday we will receive 33 files in our source directory(/prd/pk) with the current date. Once our jobs are completed all the 33 files immediately will be moved to backup folder (/prd/pk/backup).
Now, I need to check between source file directory (/prd/pdk) and backup file directory... (3 Replies)
Discussion started by: suresh_target
3 Replies
10. Shell Programming and Scripting
I would like to compress the files in multiple directories. For some reason, it only compress the first directory (/Sanbox/logs1) but not the rest of the other directories ("/Sanbox/logs2" "/Sanbox/logs3" "/Sanbox/logs4" ). Any help would be appreciated. Here's my code:
#!/bin/bash... (1 Reply)
Discussion started by: Loc
1 Replies
LEARN ABOUT DEBIAN
dh_fixperms
DH_FIXPERMS(1) Debhelper DH_FIXPERMS(1)
NAME
dh_fixperms - fix permissions of files in package build directories
SYNOPSIS
dh_fixperms [debhelperoptions] [-Xitem]
DESCRIPTION
dh_fixperms is a debhelper program that is responsible for setting the permissions of files and directories in package build directories to
a sane state -- a state that complies with Debian policy.
dh_fixperms makes all files in usr/share/doc in the package build directory (excluding files in the examples/ directory) be mode 644. It
also changes the permissions of all man pages to mode 644. It makes all files be owned by root, and it removes group and other write
permission from all files. It removes execute permissions from any libraries, headers, Perl modules, or desktop files that have it set. It
makes all files in the standard bin and sbin directories, usr/games/ and etc/init.d executable (since v4). Finally, it removes the setuid
and setgid bits from all files in the package.
OPTIONS
-Xitem, --exclude item
Exclude files that contain item anywhere in their filename from having their permissions changed. You may use this option multiple
times to build up a list of things to exclude.
SEE ALSO
debhelper(7)
This program is a part of debhelper.
AUTHOR
Joey Hess <joeyh@debian.org>
9.20120909 2012-05-19 DH_FIXPERMS(1)