Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 228
  • Last Modified:

How to predict df resutls on different machines?!



Hello all,
Let's consider a scenario:

1) User is going to transfer   /usr/local  from Machine A onto Machine B.
2) Obviously, the first thing, would be comparing the size of data  on Machine A to available room on Machine B.
3) User runs  (on local):

# du  -s  /usr/local   in a scrip I have used          du -s  /usr/local | cut  f1

and also doing a query on remote machine using:

                           ssh  $REMOTE_MACHINE  df -k  .    |   awk '{ print $4 }'

then compare them BUT the problem is when I run the same command on a different machine such as Fedora instead of $4
I have to use $3 since $4 on Fedora brought up 56% which is a percentage of used room on remote machine.

Now, how can I predict which one should I use? this script will be used on different machines and has to work just fine.

Your feedback will be appreciated greatly.
Thanks


0
akohan
Asked:
akohan
  • 2
  • 2
1 Solution
 
ravenplCommented:
df -kP /usr/local # should give portable results...
0
 
akohanAuthor Commented:

Hello ravenpl,

Do you mean that I have to df instead of du ?! can you explain it in what them that command is useful?
room occupied by a directory? or available room on a media?


0
 
ravenplCommented:
> ssh  $REMOTE_MACHINE  df -k  .
You said that the above gives You different results on various OSes.
try df -kP # P stands for POSIX portable output format
0
 
akohanAuthor Commented:


Yes, it is working and thanks
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now