How to get the available space of $HOME as a variable in shell scripting? The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Ubuntu server terminal?Is bash scripting the same as shell scripting?Concatenation in Shell Scripting BashShell ScriptingShell Scripting Function questionShell scripting add slashes in file name with spaceShell scripting,Case sensitivity in shell scriptingbash shell scripting errorWhat graphical libraries are available for Bash shell scripting?

Who or what is the being for whom Being is a question for Heidegger?

In horse breeding, what is the female equivalent of putting a horse out "to stud"?

Are spiders unable to hurt humans, especially very small spiders?

Are my PIs rude or am I just being too sensitive?

When did F become S? Why?

Buddha's advice for after enlightenment

Create an outline of font

Derivation tree not rendering

The following signatures were invalid: EXPKEYSIG 1397BC53640DB551

"... to apply for a visa" or "... and applied for a visa"?

Does Parliament hold absolute power in the UK?

Does Parliament need to approve the new Brexit delay to 31 October 2019?

Working through the single responsibility principle (SRP) in Python when calls are expensive

Am I ethically obligated to go into work on an off day if the reason is sudden?

Is it ethical to upload a automatically generated paper to a non peer-reviewed site as part of a larger research?

Road tyres vs "Street" tyres for charity ride on MTB Tandem

How many people can fit inside Mordenkainen's Magnificent Mansion?

Make it rain characters

Can the DM override racial traits?

Is it ok to offer lower paid work as a trial period before negotiating for a full-time job?

How to copy the contents of all files with a certain name into a new file?

Typeface like Times New Roman but with "tied" percent sign

How can I define good in a religion that claims no moral authority?

Is every episode of "Where are my Pants?" identical?



How to get the available space of $HOME as a variable in shell scripting?



The 2019 Stack Overflow Developer Survey Results Are In
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Ubuntu server terminal?Is bash scripting the same as shell scripting?Concatenation in Shell Scripting BashShell ScriptingShell Scripting Function questionShell scripting add slashes in file name with spaceShell scripting,Case sensitivity in shell scriptingbash shell scripting errorWhat graphical libraries are available for Bash shell scripting?



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








2















I am writing a bash script to install a program for different users.



For that I want to make sure that each user has at least 500Mb available in their $HOME. My $HOME directory looks as follows



jen@ser23:~$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 2,9G 1,1G 1,7G 40% /
udev 10M 0 10M 0% /dev
tmpfs 13G 826M 12G 7% /run
/dev/sda3 15G 9,8G 4,1G 71% /usr
tmpfs 32G 0 32G 0% /dev/shm
tmpfs 5,0M 0 5,0M 0% /run/lock
tmpfs 32G 0 32G 0% /sys/fs/cgroup
/dev/mapper/local_disk_1-tmp 3,7G 21M 3,7G 1% /tmp
/dev/mapper/local_disk_1-opt 20G 2,0G 18G 10% /opt
/dev/mapper/local_disk_1-project1 401G 287G 114G 72% /project1
/dev/mapper/local_disk_1-var 3,8G 1,7G 1,7G 50% /var
/dev/mapper/local_disk_1-project2 99G 70G 29G 71% /project2
/dev/mapper/local_disk_1-usr_local 2,0G 3,4M 1,9G 1% /usr/local
nfs4.sf0.ise.fhg.de:/g/6/TSB/Archiv 632T 349T 276T 56% /net/p/600/groupdrives/TSB/Archiv
nfs4.sf0.ise.fhg.de:/home 632T 349T 276T 56% /net/home
tmpfs 6,4G 0 6,4G 0% /run/user/12419
tmpfs 6,4G 4,0K 6,4G 1% /run/user/13471
tmpfs 6,4G 4,0K 6,4G 1% /run/user/9351
tmpfs 6,4G 0 6,4G 0% /run/user/13142


My idea is to use df -h /path/to/home | awk but I am not sure how I can get the actual available space from df -h. Any help please? Thanks, Jen.



jen@ser23:~$ df -P /net/home/j/jen
Filesystem 1024-blocks Used Available Capacity Mounted on
nfs4.sf0.dfd.fhg.de:/home 5242880 1026048 4216832 20% /net/home









share|improve this question



















  • 1





    @EODCraft Staff : Nop! :)

    – Jenny
    Apr 7 at 17:40






  • 1





    df -P /path/to/home | awk 'NR>1 print $4'?

    – Cyrus
    Apr 7 at 17:41







  • 1





    There's no 1,7G. There's at the moment 4216832.

    – Cyrus
    Apr 7 at 17:53







  • 1





    Ah! I thought I should actually get the space in the partition /dev/sda1 2,9G 1,1G 1,7G 40% /

    – Jenny
    Apr 7 at 17:57






  • 1





    If you’re on a big shared system, it’s quite possible that individual accounts have quotas, separate from the available mounted storage. For example, at my old institution, you used the diskquota command to check the available space. You may want to check if an equivalent system exists at your institution.

    – nneonneo
    Apr 7 at 21:12

















2















I am writing a bash script to install a program for different users.



For that I want to make sure that each user has at least 500Mb available in their $HOME. My $HOME directory looks as follows



jen@ser23:~$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 2,9G 1,1G 1,7G 40% /
udev 10M 0 10M 0% /dev
tmpfs 13G 826M 12G 7% /run
/dev/sda3 15G 9,8G 4,1G 71% /usr
tmpfs 32G 0 32G 0% /dev/shm
tmpfs 5,0M 0 5,0M 0% /run/lock
tmpfs 32G 0 32G 0% /sys/fs/cgroup
/dev/mapper/local_disk_1-tmp 3,7G 21M 3,7G 1% /tmp
/dev/mapper/local_disk_1-opt 20G 2,0G 18G 10% /opt
/dev/mapper/local_disk_1-project1 401G 287G 114G 72% /project1
/dev/mapper/local_disk_1-var 3,8G 1,7G 1,7G 50% /var
/dev/mapper/local_disk_1-project2 99G 70G 29G 71% /project2
/dev/mapper/local_disk_1-usr_local 2,0G 3,4M 1,9G 1% /usr/local
nfs4.sf0.ise.fhg.de:/g/6/TSB/Archiv 632T 349T 276T 56% /net/p/600/groupdrives/TSB/Archiv
nfs4.sf0.ise.fhg.de:/home 632T 349T 276T 56% /net/home
tmpfs 6,4G 0 6,4G 0% /run/user/12419
tmpfs 6,4G 4,0K 6,4G 1% /run/user/13471
tmpfs 6,4G 4,0K 6,4G 1% /run/user/9351
tmpfs 6,4G 0 6,4G 0% /run/user/13142


My idea is to use df -h /path/to/home | awk but I am not sure how I can get the actual available space from df -h. Any help please? Thanks, Jen.



jen@ser23:~$ df -P /net/home/j/jen
Filesystem 1024-blocks Used Available Capacity Mounted on
nfs4.sf0.dfd.fhg.de:/home 5242880 1026048 4216832 20% /net/home









share|improve this question



















  • 1





    @EODCraft Staff : Nop! :)

    – Jenny
    Apr 7 at 17:40






  • 1





    df -P /path/to/home | awk 'NR>1 print $4'?

    – Cyrus
    Apr 7 at 17:41







  • 1





    There's no 1,7G. There's at the moment 4216832.

    – Cyrus
    Apr 7 at 17:53







  • 1





    Ah! I thought I should actually get the space in the partition /dev/sda1 2,9G 1,1G 1,7G 40% /

    – Jenny
    Apr 7 at 17:57






  • 1





    If you’re on a big shared system, it’s quite possible that individual accounts have quotas, separate from the available mounted storage. For example, at my old institution, you used the diskquota command to check the available space. You may want to check if an equivalent system exists at your institution.

    – nneonneo
    Apr 7 at 21:12













2












2








2








I am writing a bash script to install a program for different users.



For that I want to make sure that each user has at least 500Mb available in their $HOME. My $HOME directory looks as follows



jen@ser23:~$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 2,9G 1,1G 1,7G 40% /
udev 10M 0 10M 0% /dev
tmpfs 13G 826M 12G 7% /run
/dev/sda3 15G 9,8G 4,1G 71% /usr
tmpfs 32G 0 32G 0% /dev/shm
tmpfs 5,0M 0 5,0M 0% /run/lock
tmpfs 32G 0 32G 0% /sys/fs/cgroup
/dev/mapper/local_disk_1-tmp 3,7G 21M 3,7G 1% /tmp
/dev/mapper/local_disk_1-opt 20G 2,0G 18G 10% /opt
/dev/mapper/local_disk_1-project1 401G 287G 114G 72% /project1
/dev/mapper/local_disk_1-var 3,8G 1,7G 1,7G 50% /var
/dev/mapper/local_disk_1-project2 99G 70G 29G 71% /project2
/dev/mapper/local_disk_1-usr_local 2,0G 3,4M 1,9G 1% /usr/local
nfs4.sf0.ise.fhg.de:/g/6/TSB/Archiv 632T 349T 276T 56% /net/p/600/groupdrives/TSB/Archiv
nfs4.sf0.ise.fhg.de:/home 632T 349T 276T 56% /net/home
tmpfs 6,4G 0 6,4G 0% /run/user/12419
tmpfs 6,4G 4,0K 6,4G 1% /run/user/13471
tmpfs 6,4G 4,0K 6,4G 1% /run/user/9351
tmpfs 6,4G 0 6,4G 0% /run/user/13142


My idea is to use df -h /path/to/home | awk but I am not sure how I can get the actual available space from df -h. Any help please? Thanks, Jen.



jen@ser23:~$ df -P /net/home/j/jen
Filesystem 1024-blocks Used Available Capacity Mounted on
nfs4.sf0.dfd.fhg.de:/home 5242880 1026048 4216832 20% /net/home









share|improve this question
















I am writing a bash script to install a program for different users.



For that I want to make sure that each user has at least 500Mb available in their $HOME. My $HOME directory looks as follows



jen@ser23:~$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 2,9G 1,1G 1,7G 40% /
udev 10M 0 10M 0% /dev
tmpfs 13G 826M 12G 7% /run
/dev/sda3 15G 9,8G 4,1G 71% /usr
tmpfs 32G 0 32G 0% /dev/shm
tmpfs 5,0M 0 5,0M 0% /run/lock
tmpfs 32G 0 32G 0% /sys/fs/cgroup
/dev/mapper/local_disk_1-tmp 3,7G 21M 3,7G 1% /tmp
/dev/mapper/local_disk_1-opt 20G 2,0G 18G 10% /opt
/dev/mapper/local_disk_1-project1 401G 287G 114G 72% /project1
/dev/mapper/local_disk_1-var 3,8G 1,7G 1,7G 50% /var
/dev/mapper/local_disk_1-project2 99G 70G 29G 71% /project2
/dev/mapper/local_disk_1-usr_local 2,0G 3,4M 1,9G 1% /usr/local
nfs4.sf0.ise.fhg.de:/g/6/TSB/Archiv 632T 349T 276T 56% /net/p/600/groupdrives/TSB/Archiv
nfs4.sf0.ise.fhg.de:/home 632T 349T 276T 56% /net/home
tmpfs 6,4G 0 6,4G 0% /run/user/12419
tmpfs 6,4G 4,0K 6,4G 1% /run/user/13471
tmpfs 6,4G 4,0K 6,4G 1% /run/user/9351
tmpfs 6,4G 0 6,4G 0% /run/user/13142


My idea is to use df -h /path/to/home | awk but I am not sure how I can get the actual available space from df -h. Any help please? Thanks, Jen.



jen@ser23:~$ df -P /net/home/j/jen
Filesystem 1024-blocks Used Available Capacity Mounted on
nfs4.sf0.dfd.fhg.de:/home 5242880 1026048 4216832 20% /net/home






command-line bash scripts






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Apr 7 at 17:52







Jenny

















asked Apr 7 at 17:31









JennyJenny

1018




1018







  • 1





    @EODCraft Staff : Nop! :)

    – Jenny
    Apr 7 at 17:40






  • 1





    df -P /path/to/home | awk 'NR>1 print $4'?

    – Cyrus
    Apr 7 at 17:41







  • 1





    There's no 1,7G. There's at the moment 4216832.

    – Cyrus
    Apr 7 at 17:53







  • 1





    Ah! I thought I should actually get the space in the partition /dev/sda1 2,9G 1,1G 1,7G 40% /

    – Jenny
    Apr 7 at 17:57






  • 1





    If you’re on a big shared system, it’s quite possible that individual accounts have quotas, separate from the available mounted storage. For example, at my old institution, you used the diskquota command to check the available space. You may want to check if an equivalent system exists at your institution.

    – nneonneo
    Apr 7 at 21:12












  • 1





    @EODCraft Staff : Nop! :)

    – Jenny
    Apr 7 at 17:40






  • 1





    df -P /path/to/home | awk 'NR>1 print $4'?

    – Cyrus
    Apr 7 at 17:41







  • 1





    There's no 1,7G. There's at the moment 4216832.

    – Cyrus
    Apr 7 at 17:53







  • 1





    Ah! I thought I should actually get the space in the partition /dev/sda1 2,9G 1,1G 1,7G 40% /

    – Jenny
    Apr 7 at 17:57






  • 1





    If you’re on a big shared system, it’s quite possible that individual accounts have quotas, separate from the available mounted storage. For example, at my old institution, you used the diskquota command to check the available space. You may want to check if an equivalent system exists at your institution.

    – nneonneo
    Apr 7 at 21:12







1




1





@EODCraft Staff : Nop! :)

– Jenny
Apr 7 at 17:40





@EODCraft Staff : Nop! :)

– Jenny
Apr 7 at 17:40




1




1





df -P /path/to/home | awk 'NR>1 print $4'?

– Cyrus
Apr 7 at 17:41






df -P /path/to/home | awk 'NR>1 print $4'?

– Cyrus
Apr 7 at 17:41





1




1





There's no 1,7G. There's at the moment 4216832.

– Cyrus
Apr 7 at 17:53






There's no 1,7G. There's at the moment 4216832.

– Cyrus
Apr 7 at 17:53





1




1





Ah! I thought I should actually get the space in the partition /dev/sda1 2,9G 1,1G 1,7G 40% /

– Jenny
Apr 7 at 17:57





Ah! I thought I should actually get the space in the partition /dev/sda1 2,9G 1,1G 1,7G 40% /

– Jenny
Apr 7 at 17:57




1




1





If you’re on a big shared system, it’s quite possible that individual accounts have quotas, separate from the available mounted storage. For example, at my old institution, you used the diskquota command to check the available space. You may want to check if an equivalent system exists at your institution.

– nneonneo
Apr 7 at 21:12





If you’re on a big shared system, it’s quite possible that individual accounts have quotas, separate from the available mounted storage. For example, at my old institution, you used the diskquota command to check the available space. You may want to check if an equivalent system exists at your institution.

– nneonneo
Apr 7 at 21:12










3 Answers
3






active

oldest

votes


















4














The important point to remember is that df operates on filesystems, which may be attached to particular folders, and if you specify a path or file, it will resolve to usage of the filesystem on which file/folder resides. So df -P /net/home/j/jen operates on the filesystem mounted at /net/home, which is nfs4.sf0.ise.fhg.de network attached storage apparently.



The usage of a directory and all the files requires a recursive solution that will traverse files and directories within particular directory. The tool that you seek then, is du and in particular du -shx /net/home/user.



Keypoints (for more read man du):




  • du is recursive by default


  • -s provides summary instead of listing filesizes individually


  • -h provides human readable output. If you require further processing on data, -b might be more preferable.


  • -x is to keep du descending into another. For instance, you could have another network server attached to /net/home/user/anotherplace, so processing that directory is undesirable as it will give incorrect filesystem usage results.

Considering that this is an assignment, further processing and manipulations on output of du are left to the reader to implement






share|improve this answer
































    1














    It looks like you're heading towards a workable solution already in the comments, but I'm going to throw this in:



    DFHOME=$( df $HOME | awk 'print $4;' | tail -n 1 )
    if [ $DFHOME -lt 500000 ]; then
    echo "You don't got enough space!";
    fi


    I'd recommend not using -h because if the size is small enough, the G will turn to an M and your solution might break.






    share|improve this answer
































      1














      No need to parse df output with awk, you can use --output switch:



      df --output=avail "$HOME" | tail -n1




      --output[=FIELD_LIST]

      use the output format defined by FIELD_LIST, or print all fields if FIELD_LIST is omitted.



      FIELD_LIST is a comma-separated list of columns to be included. Valid field names are: 'source', 'fstype', 'itotal', 'iused', 'iavail', 'ipcent', 'size', 'used', 'avail', 'pcent', 'file' and 'tar‐
      get'







      share|improve this answer























        Your Answer








        StackExchange.ready(function()
        var channelOptions =
        tags: "".split(" "),
        id: "89"
        ;
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function()
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled)
        StackExchange.using("snippets", function()
        createEditor();
        );

        else
        createEditor();

        );

        function createEditor()
        StackExchange.prepareEditor(
        heartbeatType: 'answer',
        autoActivateHeartbeat: false,
        convertImagesToLinks: true,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: 10,
        bindNavPrevention: true,
        postfix: "",
        imageUploader:
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        ,
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        );



        );













        draft saved

        draft discarded


















        StackExchange.ready(
        function ()
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1131935%2fhow-to-get-the-available-space-of-home-as-a-variable-in-shell-scripting%23new-answer', 'question_page');

        );

        Post as a guest















        Required, but never shown

























        3 Answers
        3






        active

        oldest

        votes








        3 Answers
        3






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        4














        The important point to remember is that df operates on filesystems, which may be attached to particular folders, and if you specify a path or file, it will resolve to usage of the filesystem on which file/folder resides. So df -P /net/home/j/jen operates on the filesystem mounted at /net/home, which is nfs4.sf0.ise.fhg.de network attached storage apparently.



        The usage of a directory and all the files requires a recursive solution that will traverse files and directories within particular directory. The tool that you seek then, is du and in particular du -shx /net/home/user.



        Keypoints (for more read man du):




        • du is recursive by default


        • -s provides summary instead of listing filesizes individually


        • -h provides human readable output. If you require further processing on data, -b might be more preferable.


        • -x is to keep du descending into another. For instance, you could have another network server attached to /net/home/user/anotherplace, so processing that directory is undesirable as it will give incorrect filesystem usage results.

        Considering that this is an assignment, further processing and manipulations on output of du are left to the reader to implement






        share|improve this answer





























          4














          The important point to remember is that df operates on filesystems, which may be attached to particular folders, and if you specify a path or file, it will resolve to usage of the filesystem on which file/folder resides. So df -P /net/home/j/jen operates on the filesystem mounted at /net/home, which is nfs4.sf0.ise.fhg.de network attached storage apparently.



          The usage of a directory and all the files requires a recursive solution that will traverse files and directories within particular directory. The tool that you seek then, is du and in particular du -shx /net/home/user.



          Keypoints (for more read man du):




          • du is recursive by default


          • -s provides summary instead of listing filesizes individually


          • -h provides human readable output. If you require further processing on data, -b might be more preferable.


          • -x is to keep du descending into another. For instance, you could have another network server attached to /net/home/user/anotherplace, so processing that directory is undesirable as it will give incorrect filesystem usage results.

          Considering that this is an assignment, further processing and manipulations on output of du are left to the reader to implement






          share|improve this answer



























            4












            4








            4







            The important point to remember is that df operates on filesystems, which may be attached to particular folders, and if you specify a path or file, it will resolve to usage of the filesystem on which file/folder resides. So df -P /net/home/j/jen operates on the filesystem mounted at /net/home, which is nfs4.sf0.ise.fhg.de network attached storage apparently.



            The usage of a directory and all the files requires a recursive solution that will traverse files and directories within particular directory. The tool that you seek then, is du and in particular du -shx /net/home/user.



            Keypoints (for more read man du):




            • du is recursive by default


            • -s provides summary instead of listing filesizes individually


            • -h provides human readable output. If you require further processing on data, -b might be more preferable.


            • -x is to keep du descending into another. For instance, you could have another network server attached to /net/home/user/anotherplace, so processing that directory is undesirable as it will give incorrect filesystem usage results.

            Considering that this is an assignment, further processing and manipulations on output of du are left to the reader to implement






            share|improve this answer















            The important point to remember is that df operates on filesystems, which may be attached to particular folders, and if you specify a path or file, it will resolve to usage of the filesystem on which file/folder resides. So df -P /net/home/j/jen operates on the filesystem mounted at /net/home, which is nfs4.sf0.ise.fhg.de network attached storage apparently.



            The usage of a directory and all the files requires a recursive solution that will traverse files and directories within particular directory. The tool that you seek then, is du and in particular du -shx /net/home/user.



            Keypoints (for more read man du):




            • du is recursive by default


            • -s provides summary instead of listing filesizes individually


            • -h provides human readable output. If you require further processing on data, -b might be more preferable.


            • -x is to keep du descending into another. For instance, you could have another network server attached to /net/home/user/anotherplace, so processing that directory is undesirable as it will give incorrect filesystem usage results.

            Considering that this is an assignment, further processing and manipulations on output of du are left to the reader to implement







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Apr 8 at 6:19

























            answered Apr 7 at 18:26









            Sergiy KolodyazhnyySergiy Kolodyazhnyy

            75.4k9155328




            75.4k9155328























                1














                It looks like you're heading towards a workable solution already in the comments, but I'm going to throw this in:



                DFHOME=$( df $HOME | awk 'print $4;' | tail -n 1 )
                if [ $DFHOME -lt 500000 ]; then
                echo "You don't got enough space!";
                fi


                I'd recommend not using -h because if the size is small enough, the G will turn to an M and your solution might break.






                share|improve this answer





























                  1














                  It looks like you're heading towards a workable solution already in the comments, but I'm going to throw this in:



                  DFHOME=$( df $HOME | awk 'print $4;' | tail -n 1 )
                  if [ $DFHOME -lt 500000 ]; then
                  echo "You don't got enough space!";
                  fi


                  I'd recommend not using -h because if the size is small enough, the G will turn to an M and your solution might break.






                  share|improve this answer



























                    1












                    1








                    1







                    It looks like you're heading towards a workable solution already in the comments, but I'm going to throw this in:



                    DFHOME=$( df $HOME | awk 'print $4;' | tail -n 1 )
                    if [ $DFHOME -lt 500000 ]; then
                    echo "You don't got enough space!";
                    fi


                    I'd recommend not using -h because if the size is small enough, the G will turn to an M and your solution might break.






                    share|improve this answer















                    It looks like you're heading towards a workable solution already in the comments, but I'm going to throw this in:



                    DFHOME=$( df $HOME | awk 'print $4;' | tail -n 1 )
                    if [ $DFHOME -lt 500000 ]; then
                    echo "You don't got enough space!";
                    fi


                    I'd recommend not using -h because if the size is small enough, the G will turn to an M and your solution might break.







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Apr 7 at 18:11

























                    answered Apr 7 at 17:56









                    KarlKarl

                    215




                    215





















                        1














                        No need to parse df output with awk, you can use --output switch:



                        df --output=avail "$HOME" | tail -n1




                        --output[=FIELD_LIST]

                        use the output format defined by FIELD_LIST, or print all fields if FIELD_LIST is omitted.



                        FIELD_LIST is a comma-separated list of columns to be included. Valid field names are: 'source', 'fstype', 'itotal', 'iused', 'iavail', 'ipcent', 'size', 'used', 'avail', 'pcent', 'file' and 'tar‐
                        get'







                        share|improve this answer



























                          1














                          No need to parse df output with awk, you can use --output switch:



                          df --output=avail "$HOME" | tail -n1




                          --output[=FIELD_LIST]

                          use the output format defined by FIELD_LIST, or print all fields if FIELD_LIST is omitted.



                          FIELD_LIST is a comma-separated list of columns to be included. Valid field names are: 'source', 'fstype', 'itotal', 'iused', 'iavail', 'ipcent', 'size', 'used', 'avail', 'pcent', 'file' and 'tar‐
                          get'







                          share|improve this answer

























                            1












                            1








                            1







                            No need to parse df output with awk, you can use --output switch:



                            df --output=avail "$HOME" | tail -n1




                            --output[=FIELD_LIST]

                            use the output format defined by FIELD_LIST, or print all fields if FIELD_LIST is omitted.



                            FIELD_LIST is a comma-separated list of columns to be included. Valid field names are: 'source', 'fstype', 'itotal', 'iused', 'iavail', 'ipcent', 'size', 'used', 'avail', 'pcent', 'file' and 'tar‐
                            get'







                            share|improve this answer













                            No need to parse df output with awk, you can use --output switch:



                            df --output=avail "$HOME" | tail -n1




                            --output[=FIELD_LIST]

                            use the output format defined by FIELD_LIST, or print all fields if FIELD_LIST is omitted.



                            FIELD_LIST is a comma-separated list of columns to be included. Valid field names are: 'source', 'fstype', 'itotal', 'iused', 'iavail', 'ipcent', 'size', 'used', 'avail', 'pcent', 'file' and 'tar‐
                            get'








                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Apr 8 at 7:47









                            RoVoRoVo

                            8,2491943




                            8,2491943



























                                draft saved

                                draft discarded
















































                                Thanks for contributing an answer to Ask Ubuntu!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid


                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.

                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function ()
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1131935%2fhow-to-get-the-available-space-of-home-as-a-variable-in-shell-scripting%23new-answer', 'question_page');

                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown







                                Popular posts from this blog

                                Romeo and Juliet ContentsCharactersSynopsisSourcesDate and textThemes and motifsCriticism and interpretationLegacyScene by sceneSee alsoNotes and referencesSourcesExternal linksNavigation menu"Consumer Price Index (estimate) 1800–"10.2307/28710160037-3222287101610.1093/res/II.5.31910.2307/45967845967810.2307/2869925286992510.1525/jams.1982.35.3.03a00050"Dada Masilo: South African dancer who breaks the rules"10.1093/res/os-XV.57.1610.2307/28680942868094"Sweet Sorrow: Mann-Korman's Romeo and Juliet Closes Sept. 5 at MN's Ordway"the original10.2307/45957745957710.1017/CCOL0521570476.009"Ram Leela box office collections hit massive Rs 100 crore, pulverises prediction"Archived"Broadway Revival of Romeo and Juliet, Starring Orlando Bloom and Condola Rashad, Will Close Dec. 8"Archived10.1075/jhp.7.1.04hon"Wherefore art thou, Romeo? To make us laugh at Navy Pier"the original10.1093/gmo/9781561592630.article.O006772"Ram-leela Review Roundup: Critics Hail Film as Best Adaptation of Romeo and Juliet"Archived10.2307/31946310047-77293194631"Romeo and Juliet get Twitter treatment""Juliet's Nurse by Lois Leveen""Romeo and Juliet: Orlando Bloom's Broadway Debut Released in Theaters for Valentine's Day"Archived"Romeo and Juliet Has No Balcony"10.1093/gmo/9781561592630.article.O00778110.2307/2867423286742310.1076/enst.82.2.115.959510.1080/00138380601042675"A plague o' both your houses: error in GCSE exam paper forces apology""Juliet of the Five O'Clock Shadow, and Other Wonders"10.2307/33912430027-4321339124310.2307/28487440038-7134284874410.2307/29123140149-661129123144728341M"Weekender Guide: Shakespeare on The Drive""balcony"UK public library membership"romeo"UK public library membership10.1017/CCOL9780521844291"Post-Zionist Critique on Israel and the Palestinians Part III: Popular Culture"10.2307/25379071533-86140377-919X2537907"Capulets and Montagues: UK exam board admit mixing names up in Romeo and Juliet paper"Istoria Novellamente Ritrovata di Due Nobili Amanti2027/mdp.390150822329610820-750X"GCSE exam error: Board accidentally rewrites Shakespeare"10.2307/29176390149-66112917639"Exam board apologises after error in English GCSE paper which confused characters in Shakespeare's Romeo and Juliet""From Mariotto and Ganozza to Romeo and Guilietta: Metamorphoses of a Renaissance Tale"10.2307/37323537323510.2307/2867455286745510.2307/28678912867891"10 Questions for Taylor Swift"10.2307/28680922868092"Haymarket Theatre""The Zeffirelli Way: Revealing Talk by Florentine Director""Michael Smuin: 1938-2007 / Prolific dance director had showy career"The Life and Art of Edwin BoothRomeo and JulietRomeo and JulietRomeo and JulietRomeo and JulietEasy Read Romeo and JulietRomeo and Julieteeecb12003684p(data)4099369-3n8211610759dbe00d-a9e2-41a3-b2c1-977dd692899302814385X313670221313670221

                                Creating closest line along the point''s azimuth using PostgreSQL Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?Drawing line between points at specific distance in PostGIS?How to efficiently find the closest point over the dateline?How to find the nearest point by using PostGIS function?PostGIS nearest point with LATERAL JOIN in PostgreSQL 9.3+Creating a table and inserting selected streets using plpgsql functionsCreating a table that stores Distances and other columnSaving select query results (year wise) from PostgreSQL/PostGIS to text filesWhat is the information behind this geometry?How to give start and end vertex ids dynamically in pgr_dijkstra?Point to Polygon nearest distance DS_distance is not using geography index & knn <-> or <#> does not give result in orderLine to point conversion with start point and end point detection?

                                Crop image to path created in TikZ? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Crop an inserted image?TikZ pictures does not appear in posterImage behind and beyond crop marks?Tikz picture as large as possible on A4 PageTransparency vs image compression dilemmaHow to crop background from image automatically?Image does not cropTikzexternal capturing crop marks when externalizing pgfplots?How to include image path that contains a dollar signCrop image with left size given