UNIX file system free space, used space, total space

Anyone have an idea about getting UNIX file system free space, used space,
total space numbers without having to resort to something like the following
( which gets the percent of used space for a command-line supplied file
system name stored in the variable ${file_sys} ):

$per_used = `df -k | grep " ${file_sys}\$" | awk '{print \$5}'`;

> Anthony (Tony) Esposito
> Senior Technical Consultant 
> Inovis(tm), formerly Harbinger and Extricity
> 2425 N. Central Expressway, Suite 900 
> Richardson, TX  75080 
> (972) 643-3115 
> tony.esposito@inovis.com 
> 
> 
0
tony
3/18/2003 9:41:15 PM
perl.beginners 29246 articles. 3 followers. Follow

3 Replies
775 Views

Similar Articles

[PageSpeed] 44

Tony Esposito wrote:
> 
> Anyone have an idea about getting UNIX file system free space, used space,
> total space numbers without having to resort to something like the following
> ( which gets the percent of used space for a command-line supplied file
> system name stored in the variable ${file_sys} ):
> 
> $per_used = `df -k | grep " ${file_sys}\$" | awk '{print \$5}'`;


my ($per_used) = `df -k` =~ m|^\Q$file_sys\E.*?(\d+)%|m;


John
-- 
use Perl;
program
fulfillment
0
krahnj
3/18/2003 11:20:36 PM
Tony Esposito wrote:

> Anyone have an idea about getting UNIX file system free space, used space,
> total space numbers without having to resort to something like the
> following ( which gets the percent of used space for a command-line
> supplied file system name stored in the variable ${file_sys} ):
> 
> $per_used = `df -k | grep " ${file_sys}\$" | awk '{print \$5}'`;
> 

try:

#!/usr/bin/perl -w
use strict;

use Filesys::DiskFree;

(my $disk = Filesys::DiskFree->new)->df;

print "total: ",$disk->total('/'),"\n";
print "used: ",$disk->used('/'),"\n";
print "available: ",$disk->avail('/'),"\n";

__END__

prints:

total: 8589885440
used: 4378312704
available: 3775221760

david
0
dzhuo
3/19/2003 5:51:37 PM
Good suggestion.....now I just need to get Filesys.pm installed on my
system.
Thanks!

-----Original Message-----
From: david [mailto:dzhuo@looksmart.net]
Sent: Wednesday, March 19, 2003 11:52 AM
To: beginners@perl.org
Subject: Re: UNIX file system free space, used space, total space


Tony Esposito wrote:

> Anyone have an idea about getting UNIX file system free space, used space,
> total space numbers without having to resort to something like the
> following ( which gets the percent of used space for a command-line
> supplied file system name stored in the variable ${file_sys} ):
> 
> $per_used = `df -k | grep " ${file_sys}\$" | awk '{print \$5}'`;
> 

try:

#!/usr/bin/perl -w
use strict;

use Filesys::DiskFree;

(my $disk = Filesys::DiskFree->new)->df;

print "total: ",$disk->total('/'),"\n";
print "used: ",$disk->used('/'),"\n";
print "available: ",$disk->avail('/'),"\n";

__END__

prints:

total: 8589885440
used: 4378312704
available: 3775221760

david

-- 
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
0
tony
3/19/2003 6:14:01 PM
Reply:

Similar Artilces:

Line spacing, word spacing, char spacing
I already found out line , word and char spacing are not foreseen in GDI+.According to some websites, the MeasureString method does not work the way it should. (which I could use to manually change the X/Y positions etc.)Does anyone know of a component that will do the trick?And preferrably not one that will cost me hundreds of euros :)All I want to do is put some text on an image ...The only problem being is that line, word and char spacing are strict requirement.Seems easy, but I'm quite desperate so thank you for your early reply....

Users space restrictions free space
When I set a user space restriction for a user it shows the correct free space when I use the client, but when I hit it by native file (WinXP or Mac OSX) it shows I have access to the whole volume. I am using 6.5 SP2. Any Suggestions? Windows or Mac networking have no idea of NetWare user or dir space restrictions and thus cannot take them into account. -- Andrew C Taubman Novell Support Forums Volunteer SysOp http://support.novell.com/forums (Sorry, support is not provided via e-mail) Opinions expressed above are not necessarily those of Novell Inc. ...

space restriction (negative space in use)
I have NW6.0 SP4 and have space restriction enabled on NSS volume. The "space in use column" show negative numbers, any ideas how to fix this issue? Thanks. TID10074366 ? Cheers Dave -- Dave Parkes [NSCS] Occasionally resident at http://support-forums.novell.com/ Dave Parkes wrote: > 10074366 This TID takes me to http://www.novell.com/coolsolutions/netware/qna/nss.html There is a link "Wierd NSS Stats" which tells me to click on a link to 10074366. That link tells me: The document /10074366.htm is no longer available at support.novell...

Space in Use Negative with Space Restrictions
Using Console 1.3.6 I seem to get quite a few users who have a Space in Use statistic with a negative value therefore allowing them to save a lot more info in their home directories than the restriction should allow. Is there an issue in Console One or is it that the space restrictions on the volume are not working properly? Thanks for any enlightenment on this subject. Ben. ----------------------------------------------------------------------------------------- Ben Davis - Computer Systems Manager Christian Outreach College Brisbane email: ben@brisbane.coc.edu.au WWW: http://www....

Great gap between Est. Temp Space Used and Act. Temp Space Used
Hi all, I have a question about the Est. Temp Space Used and Act. Temp Space Used, from the query plan, I found the estimated temp space is 200% of the actual temp space Est. Temp Space Used (Mb) 4722.6 Act. Temp Space Used (Mb) 1948.6 This make it difficult to set QUERY_TEMP_SPACE_LIMIT as the resources is very tight, do you have any idea to make the estimation of the temp space used more accurate? Version: 12.7.0/080707/P/ESD 5/MS/Windows 2003/64bit Keith Ma wrote: > Hi all, > > I have a question about the Est. Temp Space Used and Act. Temp Space Use...

Drive Free Space vs Available Space
I have 2 ext3 partitions that seem to have an improper discrepency between free Space and available space. In the one case the partition is listed as having 27.3 gb free but only 21.3 available, and another shows 25.2 gb free but only 20.5 available. I was wondering if anyone knew how I could fix this? -- silenuz ------------------------------------------------------------------------ Have a read here; 'boncey.org - Reclaiming ext3 disk space' (http://boncey.org/2006_11_18_reclaiming_ext3_disk_space) [Although that doesn't explain all of it...] ...

Reserve Table Space / Use All Space Questions
XE3 version 11.0.4.820 Will using a database with the *Reserve Table Space* set to ‘No’ on a large database (10 GB) with lots of activity / updating would cause issues with performance with Interbase? Will using the XE3 database with the *Reserve Table Space* set to ‘No’ cause any long term issues? Gbak has the *–use_all_space* which I imagine the existence of the parameter is same as IBConsole’s ‘Use All Space’ set to true? IBConsole has the Use All Space (false is default or true). Are there any differences between a default restore using gbak compared to ibconsole? Jeff Cope ...

using the free space
Partition Type Size Object ID [V503-A3-D0:0-PF472] NSS Partition 6877MB Eh [V503-A3-D0:0-P0] System Configuration Partition35MB 8h [V503-A3-D0:0-P23] Big DOS; OS/2 Win 95 Partition 251MB 9h [V503-A3-D0:0-P11E] NSS Partition 15001MB Ah [V503-A3-D0:0-P3BB8] NSS Partition 28193MB Bh [V503-A3-D0:0-PA9D9] NSS Partition 15000MB Ch [V503-A3-D0:0-PE471] NSS Partition 4097MB Dh Free 47290MB Duplicate post. -- Andrew C Taubman Novell Support Connection Volunteer SysOp http://support.novell.com/forums (Sorry, support is not provided via e...

space
s a a Hartmut Hartmut Figge: >Hartmut Figge: >>s a >> a >> >>Hartmut > >Hartmut Hartmut Hartmut Figge: >Alfred Peters: >>Hmm. The first one looks a bit strange. > >Alfred? What are you doing here? ;) > >>* space.png (14,5 KB) hosted on Dropbox: https://db.tt/CtfOwvtJ > >http://www.triffids.de/pub/screenshot/bl140809.png > >Hm. I assume that you are using monospace, so this has have to with '>' >vs. bar. I haven't used bars in ages. Perhaps i should look into my ...

space
Hello to all. I need to know one way to check only the utilized space log areas from one database. The command sp_helpdb returns the information separated by devices, but I need to obtain the information from the all log devices in one line, including total and occupied space. Example: DATABASE NAME TOTAL LOG SPACE OCCUPIED LOG SPACE example_database 100 MB 80 MB Is there someone can help me? Are There something miracle store procedure? Thanks. ---== Posted via the PFCGuide Web Newsreader ==--- http://www.p...

space
------=_NextPart_000_0054_01C0EF88.DC0CF000 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable who knows of some free web space that allows the use of perl? so i can = test my "hello world" program and more and more... :) bc ------=_NextPart_000_0054_01C0EF88.DC0CF000-- You could just set up a web server on your own machine, if that's all you're looking to do. -----Original Message----- From: bc [mailto:bee@mindspring.com] Sent: Thursday, June 07, 2001 7:34 PM To: beginners@perl.org Subject: space ...

space
How can I search for empty space in the textbox and if it is one i need to display error message. This is for the prevent user the enter filename with space. You can always just replace any spaces with no space...In VB it would be....Replace(myTextBox.Text, " ", "")And in C# it would be..... myTextBox.Text.Replace(" ", ""); Hope this helps,Zath Using regular expressions would be a good way to go for this task. Please take a look at this site: regexlib.Grz, Kris.Read my blog. Handy Firefox plugins for web developers.Workaround for non working Mark as answer buttons....

Space
Infomaker 7.0.3 Build 100009, Oracle 8i I have an if statement that produces a null value. This null value is given space on my report. I need to get rid of that space. Is there a way to say if(x,y,?)? If x is true do y, else stop or(do nothing)? I can't think of any way to get rid of the space?? Thanks in advance! I'm not sure I understand you. You can conditionally change the size (width, height) of a column using an expression. Select the Properties for the column and then the Position tab. Click on the little red buttons beside the Width and Height boxes to de...

I can't move a table from system dp space to another db space!
help me ,thanks! "strong" <nie.cs@163.net> wrote: >help me ,thanks! Unfortunately, ALTER TABLE doesn't let you change the dbspace name. However, you can use ALTER TABLE to rename the current table, CREATE TABLE to create a new table with the old name in the other dbspace, INSERT INTO with SELECT to copy rows from the current table to the new table, and then DROP TABLE to get rid of the current table. Breck You might want to consider rebuilding the database then. Use DBUNLOAD or Sybase Central to unload the database and the structure. Once that ...

Using Regular Expression Validator for removing consecutive white spaces with single white space
Hi I had a textbox feild in which I want to remove consecutive white spaces with single white spaces from beginning,end and middle of text and I want to use Regular Expression Validator to do this Looking out for some Help Kartik Hi,Regular Expression Validator will not remove the space.It will throw a client side validation.To remove space use Trim method on server side.Virendra (MCTS)My Site, Blog Hi! If you want to do it on server side then following is the vb.net code: Imports System.Text.RegularExpressions -----------------------------------------Dim r As Regex = New Reg...

Space Oddity..a revision sung in Space..
<quote> Published on May 12, 2013 A revised version of David Bowie's Space Oddity, recorded by Commander Chris Hadfield on board the International Space Station. </quote> Views: 14,149,275 Time: 05:31 <http://www.youtube.com/watch?v=KaOC9danxNo&feature=youtu.be> -- The person who says it cannot be done should not interrupt the person who is doing it. ~ Chinese proverb On 5/20/2013 8:40 PM, Bernard Kolisz wrote: > <quote> > Published on May 12, 2013 > > A revised version of David Bowie's Space Oddity, > recorded by C...

find space in space in login name
can anybody tell me the way to check whether the user name entered is contained space or not. using asp.net membership control, thanks It will be good if you let us know the exact requirement. anyways, space checking can be done this wayif(TextBox1.Text.IndexOf(string.Empty) > 0) lblError.Text="space present" ;SHASHANK BHIDECAPGEMINI INDIA"THE ROAD TO SUCCESS IS ALWAYS UNDER CONSTRUCTION MARK MY RESPONSE AS ANSWER TO HELP ME BUILD IT :)"  Instead of using string.Empty, it should be if (TextBox1.Text.IndexOf(" ") > 0) {  lblError.Text="sp...

Disk Space
Hi, I am using DNN2 for our intranet which means it runs on our own server with lots of disk capacity (dozens of GB). The problem: in "site settings" or "host settings" I cannot enter more than three digits in the disk space field, which means that the highest disk space available is 999 MB. How can I change that limitation? Cheers, DocHoliday MCSA/MCSE on W2K3, artless DNN operator are you really going to have a website that is over a gig? You could probably directly change the db entry.Jeff MartinMCSD C# .NEThttp://www.jeffmartin.com I think on an i...

Line Spacing (How to Double space message)
Is there A way to double space or use 1.5 line spacing in my outgoing messages? On 4/10/2006 8:02 PM On a whim, Jordon Berkove pounded out on the keyboard > Is there A way to double space or use 1.5 line spacing in my outgoing > messages? > > > Hi Jordon, If composing in HTML you can insert a tag to set your line height. Click on Insert, HTML and in the box enter the following: <p style="line-height:1.5"> and click OK. Then type your text. You could save it as a Template so you don't have to enter it every time. I did that here and you can see my text is set to 2.0 -- Terry On 4/10/2006 8:38 PM On a whim, Terry pounded out on the keyboard > On 4/10/2006 8:02 PM On a whim, Jordon Berkove pounded out on the keyboard >> Is there A way to double space or use 1.5 line spacing in my outgoing >> messages? >> >> >> > > Hi Jordon, > If composing in HTML you can insert a tag to set your line height. > Click on Insert, HTML and in the box enter the following: > <p style="line-height:1.5"> > and click OK. Then type your text. You could save it as a Template so > you don't have to enter it every time. > > I did that here and you can see my text is set to 2.0 > <embarrassed=on> Well as you can see it sent in plain text. I forgot I had the default to send that way. Regardless, the above should work ...

Not all free space in a device fragment is used before using the next device for the segment ?
32-bit ASE 12.5.0.3 Solaris 8 As a result of having a free-space threshold, I have a segment that I have extended by adding another device to that segment. Now what I was expecting was that the free space on the device have to be 0 or something so low ( < 1 extent ) before ASE uses the new device that I added / extended to the segment. From the sp_helpdb output below, it is the index_segment that I have extended ( originally having only sgmaster_index device, then added segment_index02 device ). I noticed that ASE started using the new device ( sgmaster_index02 ) e...

Preserving white space in iframe control using style sheet="white-space:pre"
I am suing iframe control in the edit mode. I need to preserve white space in the control. e.g. if I put following data in the control and then save in the database, SSDB.CLMP1SO              735837              735837               0           0SSDB.CNCP2SO              735837              735837               0           0SSDB.CYMP...

using the free space #3
Partition Type Size Object ID [V503-A3-D0:0-PF472] NSS Partition 6877MB Eh [V503-A3-D0:0-P0] System Configuration Partition35MB 8h [V503-A3-D0:0-P23] Big DOS; OS/2 Win 95 Partition 251MB 9h [V503-A3-D0:0-P11E] NSS Partition 15001MB Ah [V503-A3-D0:0-P3BB8] NSS Partition 28193MB Bh [V503-A3-D0:0-PA9D9] NSS Partition 15000MB Ch [V503-A3-D0:0-PE471] NSS Partition 4097MB Dh Free 47290MB Duplicate post. -- Andrew C Taubman Novell Support Connection Volunteer SysOp http://support.novell.com/forums (Sorry, support is not provided via e...

System Files and Spaces Between Characters
Why is it so common for various system and program files to have some human-readable text, albeit with a space between each character (and two between each word)? -- tbl On 1/18/2013 1:07 PM, tbl wrote: > Why is it so common for various system and program files to have some human-readable > text, albeit with a space between each character (and two between each word)? > > -- > tbl > It's all just a conspiracy to make us type \ or \ \ to deal with spaces on a linux command line. On 1/18/2013 1:07 PM, tbl wrote: > Why is it so common for various syste...

using the free space #2
Partition Type Size Object ID [V503-A3-D0:0-PF472] NSS Partition 6877MB Eh [V503-A3-D0:0-P0] System Configuration Partition35MB 8h [V503-A3-D0:0-P23] Big DOS; OS/2 Win 95 Partition 251MB 9h [V503-A3-D0:0-P11E] NSS Partition 15001MB Ah [V503-A3-D0:0-P3BB8] NSS Partition 28193MB Bh [V503-A3-D0:0-PA9D9] NSS Partition 15000MB Ch [V503-A3-D0:0-PE471] NSS Partition 4097MB Dh Free 47290MB Duplicate post. -- Andrew C Taubman Novell Support Connection Volunteer SysOp http://support.novell.com/forums (Sorry, support is not provided via e...

Web resources about - UNIX file system free space, used space, total space - perl.beginners

List of areas in the United States National Park System - Wikipedia, the free encyclopedia
The National Park System of the United States is the collection of physical properties owned or administered by the National Park Service . This ...

Brisbane business rolls out restaurant system in Afghanistan
A Brisbane based point-of-sale systems business has found a customer in the most unlikely place.

Sean Price and the corrections system that let him loose to kill Masa Vukotic
Man who killed Masa Vukotic in a random stabbing attack one year ago was repeatedly let go by a corrections system whose most senior members ...

Sean Price and the corrections system that let him loose to kill Masa Vukotic
Man who killed Masa Vukotic in a random stabbing attack one year ago was repeatedly let go by a corrections system whose most senior members ...

Cool new app lets you turn all your friends’ phones into a giant sound system
One of the Galaxy S4's most gimmicky features was the ability to use NFC connectivity to sync up all of your friends' Galaxy S4 phones' audio ...

Fiorina: Trump, Clinton abuse the system
The former Hewlett-Packard CEO and GOP candidate said that the two front-runners are two sides of the same coin.

Entire DC subway system to shut down for inspections
WASHINGTON (AP) — It's already being branded #Metromageddon.

Ive says Apple Watch is a fashion system, not a product
Apple Watch was never designed to be a singular product, according to Jony Ive, but a whole fashionable system in its own right. Not just in ...

Insider Trading Summary: Cisco Systems, Inc. (CSCO)
Cisco Systems, Inc. (NASDAQ:CSCO ) insider has recently participated in insider trading activity. Executive Chairman, CHAMBERS JOHN T sold 541,667 ...

Here's an early taste of the 'System Shock' remake
Two decades after its original release, System Shock is being remade. Night Dive Studios, the developer in charge of the project, released some ...

Resources last updated: 3/17/2016 2:51:36 AM