LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 12-12-2004, 12:47 PM   #1
payal_shah
LQ Newbie
 
Registered: Dec 2004
Posts: 17

Rep: Reputation: 0
how to know how much disk space is free on linux through programming


hello friends

i am a new to linux . I want to know the how much disk is space available or how much is free on linux partition. is there are any structure is available to know it through programming? and also i want to know what ports are free or which services runing on other port.

plz.......reply as quickly as possible.

I will appreciate your answer.

Thankyou
 
Old 12-12-2004, 12:55 PM   #2
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 97
Hi.

There's two ways: either run 'df' or look at /proc/partitions.

You should be able to parse either in your program.

Dave
 
Old 12-12-2004, 02:27 PM   #3
J.W.
LQ Veteran
 
Registered: Mar 2003
Location: Boise, ID
Distribution: Mint
Posts: 6,642

Rep: Reputation: 87
To add slightly to ilikejam's comment, this will display the free space amounts in standard measures
Code:
df -h
-- J.W.
 
Old 12-12-2004, 02:49 PM   #4
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 97
I missed the second part of your question: run 'netstat' to see the status of your ports. There's also files in /proc/net which you should look at (I'm not too familiar with their format).

Dave
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How much disk space do I have free? Ian D Linux - General 5 10-27-2005 06:22 PM
free disk space mp4-10 Linux - Software 1 04-06-2005 03:32 AM
Urgen:how to free the disk space in linux tejpatil Linux - Newbie 3 02-11-2004 05:27 AM
free disk space? Alf829 Linux - Newbie 3 08-01-2003 11:26 AM
How to see free disk space bripage Linux - General 3 04-29-2002 08:38 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 10:58 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration