- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- shell programming -> find files by size
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2006 11:02 PM
03-27-2006 11:02 PM
I need to write a script to find all files with a size between 1,8 GB and 2 GB and discover the type of filesystem they reside to.
Can anyone help me get an idea how to do???
regards
Christian
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2006 11:16 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2006 11:17 PM
03-27-2006 11:17 PM
Re: shell programming -> find files by size
find . -size +1800000c > /tmp/a.lis
find . -size +2000000c > /tmp/b.lis
sdiff -s /tmp/a.lis /tmp/b.lis
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2006 11:17 PM
03-27-2006 11:17 PM
Re: shell programming -> find files by size
A start.
cd /
du -k | sort -rn | more
That will show you where the big files are.
Then you get to use the find command
see the parameters size -n (in blocks)
Example
find / -local -size +50 -print
Adjust the size to come up with your list.
The command will list the filesystem.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2006 12:19 AM
03-28-2006 12:19 AM
Re: shell programming -> find files by size
Using 'find' to select files whose sizes fall into the range you seek is simple, as already mentioned. 'find' has all of the necessary logic to limit the ranges thusly:
# find /tmp -xdev -size +100 -a -size -200 | xargs ls -l
The above example would find all files in '/tmp' whose (c)haracter size was more than 100 and less than 200 characters. That differentiation is done siwht the + and - operands before the size. The manpages for 'find' describe more details.
To determine the *type* of filesystem in which your directory resides, you can use 'fstyp' on its special device file. Most usually, today, the filesystem is going to be 'vxfs'.
The use of 'xdev' in the above 'find' prevents 'find' from crossing mountpoints. You can also instruct 'find' to confine its returned files to specific filesystem types (CDFS, HFS or NFS) by using the '-fstype' argument to 'find'. See again, the manpages for more information.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2006 12:23 AM
03-28-2006 12:23 AM
Re: shell programming -> find files by size
Use this command to list all files from size largest first :
# ls -lR | sort +4 -5nr | more
Hope this will help ,
Cheers,
Raj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2006 12:25 AM
03-28-2006 12:25 AM
Re: shell programming -> find files by size
hth,
Raj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2006 09:04 PM
03-28-2006 09:04 PM
Re: shell programming -> find files by size
you can use:
cd
find . -type f 2>/dev/null | xargs ll|awk '$5>1932735283&&$5<=2147483648'
It works on HP-UX 11i.
HTH,
ART