Generate File of a certain size?How can I limit downloaded file size in wget?Way to determine where certain global parameter is configuredDelete files of certain size rangeFind the total size of certain files within a directory branchAutomatically detect when a file has reached a size limitSort files into directories named by prefix of fileGenerating files of varying variability?Copy All Files With Certain Length File NameHow to generate a set of new different files through shell scripting given a certain pattern name?searching/showing size of files

The magic money tree problem

I’m planning on buying a laser printer but concerned about the life cycle of toner in the machine

Copycat chess is back

Should I join office cleaning event for free?

New order #4: World

What makes Graph invariants so useful/important?

Why is "Reports" in sentence down without "The"

LED on same Pin as Toggle Switch, not illuminating

Why doesn't Newton's third law mean a person bounces back to where they started when they hit the ground?

My colleague's body is amazing

How does one intimidate enemies without having the capacity for violence?

Why don't electron-positron collisions release infinite energy?

What do you call something that goes against the spirit of the law, but is legal when interpreting the law to the letter?

When blogging recipes, how can I support both readers who want the narrative/journey and ones who want the printer-friendly recipe?

XeLaTeX and pdfLaTeX ignore hyphenation

Why is this code 6.5x slower with optimizations enabled?

Is there really no realistic way for a skeleton monster to move around without magic?

Can a German sentence have two subjects?

Could a US political party gain complete control over the government by removing checks & balances?

Draw simple lines in Inkscape

What is the meaning of "of trouble" in the following sentence?

Why was the small council so happy for Tyrion to become the Master of Coin?

Do airline pilots ever risk not hearing communication directed to them specifically, from traffic controllers?

A function which translates a sentence to title-case



Generate File of a certain size?


How can I limit downloaded file size in wget?Way to determine where certain global parameter is configuredDelete files of certain size rangeFind the total size of certain files within a directory branchAutomatically detect when a file has reached a size limitSort files into directories named by prefix of fileGenerating files of varying variability?Copy All Files With Certain Length File NameHow to generate a set of new different files through shell scripting given a certain pattern name?searching/showing size of files






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








102















I'd like to generate a file with the name example.file. I could use



touch example.file


but I want the file to be exactly 24MB in size. I already checked the manpage of touch, but there is no parameter like this. Is there an easy way to generate files of a certain size?










share|improve this question



















  • 2





    stackoverflow.com/questions/139261/…

    – ire_and_curses
    Nov 15 '13 at 20:01











  • We will all assume you do not care what the content is so filled with zeroes will be fine.

    – Bgs
    Nov 15 '13 at 20:12

















102















I'd like to generate a file with the name example.file. I could use



touch example.file


but I want the file to be exactly 24MB in size. I already checked the manpage of touch, but there is no parameter like this. Is there an easy way to generate files of a certain size?










share|improve this question



















  • 2





    stackoverflow.com/questions/139261/…

    – ire_and_curses
    Nov 15 '13 at 20:01











  • We will all assume you do not care what the content is so filled with zeroes will be fine.

    – Bgs
    Nov 15 '13 at 20:12













102












102








102


30






I'd like to generate a file with the name example.file. I could use



touch example.file


but I want the file to be exactly 24MB in size. I already checked the manpage of touch, but there is no parameter like this. Is there an easy way to generate files of a certain size?










share|improve this question
















I'd like to generate a file with the name example.file. I could use



touch example.file


but I want the file to be exactly 24MB in size. I already checked the manpage of touch, but there is no parameter like this. Is there an easy way to generate files of a certain size?







bash command-line files






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 16 '13 at 21:14









Gilles

546k12911111625




546k12911111625










asked Nov 15 '13 at 19:54









R_UserR_User

613265




613265







  • 2





    stackoverflow.com/questions/139261/…

    – ire_and_curses
    Nov 15 '13 at 20:01











  • We will all assume you do not care what the content is so filled with zeroes will be fine.

    – Bgs
    Nov 15 '13 at 20:12












  • 2





    stackoverflow.com/questions/139261/…

    – ire_and_curses
    Nov 15 '13 at 20:01











  • We will all assume you do not care what the content is so filled with zeroes will be fine.

    – Bgs
    Nov 15 '13 at 20:12







2




2





stackoverflow.com/questions/139261/…

– ire_and_curses
Nov 15 '13 at 20:01





stackoverflow.com/questions/139261/…

– ire_and_curses
Nov 15 '13 at 20:01













We will all assume you do not care what the content is so filled with zeroes will be fine.

– Bgs
Nov 15 '13 at 20:12





We will all assume you do not care what the content is so filled with zeroes will be fine.

– Bgs
Nov 15 '13 at 20:12










5 Answers
5






active

oldest

votes


















130














You can use dd:



dd if=/dev/zero of=output.dat bs=24M count=1


or



dd if=/dev/zero of=output.dat bs=1M count=24


or, on Mac,



dd if=/dev/zero of=output.dat bs=1m count=24





share|improve this answer




















  • 1





    ... or use bs=1M and count=24. Many find it nicer and easier to read.

    – Bgs
    Nov 15 '13 at 20:11






  • 3





    Maybe dont use huge block sizes, my system did not like bs=1G count=1

    – ThorSummoner
    Dec 7 '16 at 0:17






  • 10





    On the Mac, use 24m (small m), because the Mac doesn't like the big M. dd if=/dev/zero of=output.dat bs=24m count=1

    – SPRBRN
    Feb 13 '17 at 13:30







  • 1





    On Android (5.1.1, might (not) be version or phone specific) I had to use a lowercase m too.

    – Erik
    Apr 12 '18 at 11:56







  • 1





    What is the problem with large block sizes specifically? I had hoped to use a 1G block size for a 1G file.

    – felwithe
    Jan 5 at 15:03


















42














Under non-embedded Linux or Cygwin (or any system with GNU coreutils) and FreeBSD:



truncate -s 24m example.file


This creates a file full of null bytes. If the file already exists and is smaller, it is extended to the requested size with null bytes. If the file already exists and is larger, is is truncated to the requested size.



The null bytes do not consume any disk space, the file is a sparse file.



On many systems, head -c 24m </dev/zero >example.file creates a non-sparse file full of null bytes. If head doesn't have a -c option on your system (it's common but not in POSIX), you can use dd bs=1024k count=24 </dev/zero >example.file instead (this is POSIX-compliant).






share|improve this answer























  • BusyBox also has it, so most embedded systems will too :-)

    – Ciro Santilli 新疆改造中心996ICU六四事件
    Oct 3 '18 at 1:46



















24














If you don't care about the content of the file, this is much faster than using dd:



fallocate -l 24M filename


Obviously, using dd for a 24MB file won't take any time on a modern system, but larger files can be noticeably slow.






share|improve this answer
































    12














    You can use dd:




    dd if=/dev/zero of=outputfile.out bs=1024k count=24




    Or in case you happen to be using Solaris



    mkfile 24m outputfile.out





    share|improve this answer


















    • 2





      mkfile seems to be present on macOS too

      – Ben Flynn
      Sep 19 '16 at 20:28











    • You can also pass -n to create a sparse file

      – russbishop
      Dec 8 '17 at 17:29


















    0














    FROM_NODE=N01;
    echo; cd $MOUNT_PATH; pwd; ls -la; sleep 1; echo;
    WHEN="$(date +%Y-%m-%d_%H-%M-%S)";
    fallocate -l 10M $MOUNT_PATH/"$FROM_NODE"_"$WHEN".dump
    ls -lha; echo;





    share|improve this answer


















    • 1





      Doesn't this say 10 megs while the Q asks for 24?

      – Jeff Schaller
      Jan 19 '17 at 20:10






    • 2





      fallocate could be a good answer, but why all the other lines? Cut your answer down so that it does just what was asked, and nothing more.

      – JigglyNaga
      Jan 19 '17 at 20:41






    • 1





      If you prefer sir: fallocate -l 10M somefile.dump

      – Pascal Andy
      Feb 5 '17 at 18:05












    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    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: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    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%2funix.stackexchange.com%2fquestions%2f101332%2fgenerate-file-of-a-certain-size%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    5 Answers
    5






    active

    oldest

    votes








    5 Answers
    5






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    130














    You can use dd:



    dd if=/dev/zero of=output.dat bs=24M count=1


    or



    dd if=/dev/zero of=output.dat bs=1M count=24


    or, on Mac,



    dd if=/dev/zero of=output.dat bs=1m count=24





    share|improve this answer




















    • 1





      ... or use bs=1M and count=24. Many find it nicer and easier to read.

      – Bgs
      Nov 15 '13 at 20:11






    • 3





      Maybe dont use huge block sizes, my system did not like bs=1G count=1

      – ThorSummoner
      Dec 7 '16 at 0:17






    • 10





      On the Mac, use 24m (small m), because the Mac doesn't like the big M. dd if=/dev/zero of=output.dat bs=24m count=1

      – SPRBRN
      Feb 13 '17 at 13:30







    • 1





      On Android (5.1.1, might (not) be version or phone specific) I had to use a lowercase m too.

      – Erik
      Apr 12 '18 at 11:56







    • 1





      What is the problem with large block sizes specifically? I had hoped to use a 1G block size for a 1G file.

      – felwithe
      Jan 5 at 15:03















    130














    You can use dd:



    dd if=/dev/zero of=output.dat bs=24M count=1


    or



    dd if=/dev/zero of=output.dat bs=1M count=24


    or, on Mac,



    dd if=/dev/zero of=output.dat bs=1m count=24





    share|improve this answer




















    • 1





      ... or use bs=1M and count=24. Many find it nicer and easier to read.

      – Bgs
      Nov 15 '13 at 20:11






    • 3





      Maybe dont use huge block sizes, my system did not like bs=1G count=1

      – ThorSummoner
      Dec 7 '16 at 0:17






    • 10





      On the Mac, use 24m (small m), because the Mac doesn't like the big M. dd if=/dev/zero of=output.dat bs=24m count=1

      – SPRBRN
      Feb 13 '17 at 13:30







    • 1





      On Android (5.1.1, might (not) be version or phone specific) I had to use a lowercase m too.

      – Erik
      Apr 12 '18 at 11:56







    • 1





      What is the problem with large block sizes specifically? I had hoped to use a 1G block size for a 1G file.

      – felwithe
      Jan 5 at 15:03













    130












    130








    130







    You can use dd:



    dd if=/dev/zero of=output.dat bs=24M count=1


    or



    dd if=/dev/zero of=output.dat bs=1M count=24


    or, on Mac,



    dd if=/dev/zero of=output.dat bs=1m count=24





    share|improve this answer















    You can use dd:



    dd if=/dev/zero of=output.dat bs=24M count=1


    or



    dd if=/dev/zero of=output.dat bs=1M count=24


    or, on Mac,



    dd if=/dev/zero of=output.dat bs=1m count=24






    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Mar 27 at 15:28









    Clay

    1033




    1033










    answered Nov 15 '13 at 20:01









    Paul92Paul92

    1,453188




    1,453188







    • 1





      ... or use bs=1M and count=24. Many find it nicer and easier to read.

      – Bgs
      Nov 15 '13 at 20:11






    • 3





      Maybe dont use huge block sizes, my system did not like bs=1G count=1

      – ThorSummoner
      Dec 7 '16 at 0:17






    • 10





      On the Mac, use 24m (small m), because the Mac doesn't like the big M. dd if=/dev/zero of=output.dat bs=24m count=1

      – SPRBRN
      Feb 13 '17 at 13:30







    • 1





      On Android (5.1.1, might (not) be version or phone specific) I had to use a lowercase m too.

      – Erik
      Apr 12 '18 at 11:56







    • 1





      What is the problem with large block sizes specifically? I had hoped to use a 1G block size for a 1G file.

      – felwithe
      Jan 5 at 15:03












    • 1





      ... or use bs=1M and count=24. Many find it nicer and easier to read.

      – Bgs
      Nov 15 '13 at 20:11






    • 3





      Maybe dont use huge block sizes, my system did not like bs=1G count=1

      – ThorSummoner
      Dec 7 '16 at 0:17






    • 10





      On the Mac, use 24m (small m), because the Mac doesn't like the big M. dd if=/dev/zero of=output.dat bs=24m count=1

      – SPRBRN
      Feb 13 '17 at 13:30







    • 1





      On Android (5.1.1, might (not) be version or phone specific) I had to use a lowercase m too.

      – Erik
      Apr 12 '18 at 11:56







    • 1





      What is the problem with large block sizes specifically? I had hoped to use a 1G block size for a 1G file.

      – felwithe
      Jan 5 at 15:03







    1




    1





    ... or use bs=1M and count=24. Many find it nicer and easier to read.

    – Bgs
    Nov 15 '13 at 20:11





    ... or use bs=1M and count=24. Many find it nicer and easier to read.

    – Bgs
    Nov 15 '13 at 20:11




    3




    3





    Maybe dont use huge block sizes, my system did not like bs=1G count=1

    – ThorSummoner
    Dec 7 '16 at 0:17





    Maybe dont use huge block sizes, my system did not like bs=1G count=1

    – ThorSummoner
    Dec 7 '16 at 0:17




    10




    10





    On the Mac, use 24m (small m), because the Mac doesn't like the big M. dd if=/dev/zero of=output.dat bs=24m count=1

    – SPRBRN
    Feb 13 '17 at 13:30






    On the Mac, use 24m (small m), because the Mac doesn't like the big M. dd if=/dev/zero of=output.dat bs=24m count=1

    – SPRBRN
    Feb 13 '17 at 13:30





    1




    1





    On Android (5.1.1, might (not) be version or phone specific) I had to use a lowercase m too.

    – Erik
    Apr 12 '18 at 11:56






    On Android (5.1.1, might (not) be version or phone specific) I had to use a lowercase m too.

    – Erik
    Apr 12 '18 at 11:56





    1




    1





    What is the problem with large block sizes specifically? I had hoped to use a 1G block size for a 1G file.

    – felwithe
    Jan 5 at 15:03





    What is the problem with large block sizes specifically? I had hoped to use a 1G block size for a 1G file.

    – felwithe
    Jan 5 at 15:03













    42














    Under non-embedded Linux or Cygwin (or any system with GNU coreutils) and FreeBSD:



    truncate -s 24m example.file


    This creates a file full of null bytes. If the file already exists and is smaller, it is extended to the requested size with null bytes. If the file already exists and is larger, is is truncated to the requested size.



    The null bytes do not consume any disk space, the file is a sparse file.



    On many systems, head -c 24m </dev/zero >example.file creates a non-sparse file full of null bytes. If head doesn't have a -c option on your system (it's common but not in POSIX), you can use dd bs=1024k count=24 </dev/zero >example.file instead (this is POSIX-compliant).






    share|improve this answer























    • BusyBox also has it, so most embedded systems will too :-)

      – Ciro Santilli 新疆改造中心996ICU六四事件
      Oct 3 '18 at 1:46
















    42














    Under non-embedded Linux or Cygwin (or any system with GNU coreutils) and FreeBSD:



    truncate -s 24m example.file


    This creates a file full of null bytes. If the file already exists and is smaller, it is extended to the requested size with null bytes. If the file already exists and is larger, is is truncated to the requested size.



    The null bytes do not consume any disk space, the file is a sparse file.



    On many systems, head -c 24m </dev/zero >example.file creates a non-sparse file full of null bytes. If head doesn't have a -c option on your system (it's common but not in POSIX), you can use dd bs=1024k count=24 </dev/zero >example.file instead (this is POSIX-compliant).






    share|improve this answer























    • BusyBox also has it, so most embedded systems will too :-)

      – Ciro Santilli 新疆改造中心996ICU六四事件
      Oct 3 '18 at 1:46














    42












    42








    42







    Under non-embedded Linux or Cygwin (or any system with GNU coreutils) and FreeBSD:



    truncate -s 24m example.file


    This creates a file full of null bytes. If the file already exists and is smaller, it is extended to the requested size with null bytes. If the file already exists and is larger, is is truncated to the requested size.



    The null bytes do not consume any disk space, the file is a sparse file.



    On many systems, head -c 24m </dev/zero >example.file creates a non-sparse file full of null bytes. If head doesn't have a -c option on your system (it's common but not in POSIX), you can use dd bs=1024k count=24 </dev/zero >example.file instead (this is POSIX-compliant).






    share|improve this answer













    Under non-embedded Linux or Cygwin (or any system with GNU coreutils) and FreeBSD:



    truncate -s 24m example.file


    This creates a file full of null bytes. If the file already exists and is smaller, it is extended to the requested size with null bytes. If the file already exists and is larger, is is truncated to the requested size.



    The null bytes do not consume any disk space, the file is a sparse file.



    On many systems, head -c 24m </dev/zero >example.file creates a non-sparse file full of null bytes. If head doesn't have a -c option on your system (it's common but not in POSIX), you can use dd bs=1024k count=24 </dev/zero >example.file instead (this is POSIX-compliant).







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Nov 17 '13 at 22:18









    GillesGilles

    546k12911111625




    546k12911111625












    • BusyBox also has it, so most embedded systems will too :-)

      – Ciro Santilli 新疆改造中心996ICU六四事件
      Oct 3 '18 at 1:46


















    • BusyBox also has it, so most embedded systems will too :-)

      – Ciro Santilli 新疆改造中心996ICU六四事件
      Oct 3 '18 at 1:46

















    BusyBox also has it, so most embedded systems will too :-)

    – Ciro Santilli 新疆改造中心996ICU六四事件
    Oct 3 '18 at 1:46






    BusyBox also has it, so most embedded systems will too :-)

    – Ciro Santilli 新疆改造中心996ICU六四事件
    Oct 3 '18 at 1:46












    24














    If you don't care about the content of the file, this is much faster than using dd:



    fallocate -l 24M filename


    Obviously, using dd for a 24MB file won't take any time on a modern system, but larger files can be noticeably slow.






    share|improve this answer





























      24














      If you don't care about the content of the file, this is much faster than using dd:



      fallocate -l 24M filename


      Obviously, using dd for a 24MB file won't take any time on a modern system, but larger files can be noticeably slow.






      share|improve this answer



























        24












        24








        24







        If you don't care about the content of the file, this is much faster than using dd:



        fallocate -l 24M filename


        Obviously, using dd for a 24MB file won't take any time on a modern system, but larger files can be noticeably slow.






        share|improve this answer















        If you don't care about the content of the file, this is much faster than using dd:



        fallocate -l 24M filename


        Obviously, using dd for a 24MB file won't take any time on a modern system, but larger files can be noticeably slow.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Sep 26 '17 at 8:14









        Socowi

        1485




        1485










        answered Jul 24 '17 at 4:35









        SArcherSArcher

        35337




        35337





















            12














            You can use dd:




            dd if=/dev/zero of=outputfile.out bs=1024k count=24




            Or in case you happen to be using Solaris



            mkfile 24m outputfile.out





            share|improve this answer


















            • 2





              mkfile seems to be present on macOS too

              – Ben Flynn
              Sep 19 '16 at 20:28











            • You can also pass -n to create a sparse file

              – russbishop
              Dec 8 '17 at 17:29















            12














            You can use dd:




            dd if=/dev/zero of=outputfile.out bs=1024k count=24




            Or in case you happen to be using Solaris



            mkfile 24m outputfile.out





            share|improve this answer


















            • 2





              mkfile seems to be present on macOS too

              – Ben Flynn
              Sep 19 '16 at 20:28











            • You can also pass -n to create a sparse file

              – russbishop
              Dec 8 '17 at 17:29













            12












            12








            12







            You can use dd:




            dd if=/dev/zero of=outputfile.out bs=1024k count=24




            Or in case you happen to be using Solaris



            mkfile 24m outputfile.out





            share|improve this answer













            You can use dd:




            dd if=/dev/zero of=outputfile.out bs=1024k count=24




            Or in case you happen to be using Solaris



            mkfile 24m outputfile.out






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 15 '13 at 20:25









            BitsOfNixBitsOfNix

            4,21821832




            4,21821832







            • 2





              mkfile seems to be present on macOS too

              – Ben Flynn
              Sep 19 '16 at 20:28











            • You can also pass -n to create a sparse file

              – russbishop
              Dec 8 '17 at 17:29












            • 2





              mkfile seems to be present on macOS too

              – Ben Flynn
              Sep 19 '16 at 20:28











            • You can also pass -n to create a sparse file

              – russbishop
              Dec 8 '17 at 17:29







            2




            2





            mkfile seems to be present on macOS too

            – Ben Flynn
            Sep 19 '16 at 20:28





            mkfile seems to be present on macOS too

            – Ben Flynn
            Sep 19 '16 at 20:28













            You can also pass -n to create a sparse file

            – russbishop
            Dec 8 '17 at 17:29





            You can also pass -n to create a sparse file

            – russbishop
            Dec 8 '17 at 17:29











            0














            FROM_NODE=N01;
            echo; cd $MOUNT_PATH; pwd; ls -la; sleep 1; echo;
            WHEN="$(date +%Y-%m-%d_%H-%M-%S)";
            fallocate -l 10M $MOUNT_PATH/"$FROM_NODE"_"$WHEN".dump
            ls -lha; echo;





            share|improve this answer


















            • 1





              Doesn't this say 10 megs while the Q asks for 24?

              – Jeff Schaller
              Jan 19 '17 at 20:10






            • 2





              fallocate could be a good answer, but why all the other lines? Cut your answer down so that it does just what was asked, and nothing more.

              – JigglyNaga
              Jan 19 '17 at 20:41






            • 1





              If you prefer sir: fallocate -l 10M somefile.dump

              – Pascal Andy
              Feb 5 '17 at 18:05
















            0














            FROM_NODE=N01;
            echo; cd $MOUNT_PATH; pwd; ls -la; sleep 1; echo;
            WHEN="$(date +%Y-%m-%d_%H-%M-%S)";
            fallocate -l 10M $MOUNT_PATH/"$FROM_NODE"_"$WHEN".dump
            ls -lha; echo;





            share|improve this answer


















            • 1





              Doesn't this say 10 megs while the Q asks for 24?

              – Jeff Schaller
              Jan 19 '17 at 20:10






            • 2





              fallocate could be a good answer, but why all the other lines? Cut your answer down so that it does just what was asked, and nothing more.

              – JigglyNaga
              Jan 19 '17 at 20:41






            • 1





              If you prefer sir: fallocate -l 10M somefile.dump

              – Pascal Andy
              Feb 5 '17 at 18:05














            0












            0








            0







            FROM_NODE=N01;
            echo; cd $MOUNT_PATH; pwd; ls -la; sleep 1; echo;
            WHEN="$(date +%Y-%m-%d_%H-%M-%S)";
            fallocate -l 10M $MOUNT_PATH/"$FROM_NODE"_"$WHEN".dump
            ls -lha; echo;





            share|improve this answer













            FROM_NODE=N01;
            echo; cd $MOUNT_PATH; pwd; ls -la; sleep 1; echo;
            WHEN="$(date +%Y-%m-%d_%H-%M-%S)";
            fallocate -l 10M $MOUNT_PATH/"$FROM_NODE"_"$WHEN".dump
            ls -lha; echo;






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Jan 19 '17 at 19:52









            Pascal AndyPascal Andy

            285




            285







            • 1





              Doesn't this say 10 megs while the Q asks for 24?

              – Jeff Schaller
              Jan 19 '17 at 20:10






            • 2





              fallocate could be a good answer, but why all the other lines? Cut your answer down so that it does just what was asked, and nothing more.

              – JigglyNaga
              Jan 19 '17 at 20:41






            • 1





              If you prefer sir: fallocate -l 10M somefile.dump

              – Pascal Andy
              Feb 5 '17 at 18:05













            • 1





              Doesn't this say 10 megs while the Q asks for 24?

              – Jeff Schaller
              Jan 19 '17 at 20:10






            • 2





              fallocate could be a good answer, but why all the other lines? Cut your answer down so that it does just what was asked, and nothing more.

              – JigglyNaga
              Jan 19 '17 at 20:41






            • 1





              If you prefer sir: fallocate -l 10M somefile.dump

              – Pascal Andy
              Feb 5 '17 at 18:05








            1




            1





            Doesn't this say 10 megs while the Q asks for 24?

            – Jeff Schaller
            Jan 19 '17 at 20:10





            Doesn't this say 10 megs while the Q asks for 24?

            – Jeff Schaller
            Jan 19 '17 at 20:10




            2




            2





            fallocate could be a good answer, but why all the other lines? Cut your answer down so that it does just what was asked, and nothing more.

            – JigglyNaga
            Jan 19 '17 at 20:41





            fallocate could be a good answer, but why all the other lines? Cut your answer down so that it does just what was asked, and nothing more.

            – JigglyNaga
            Jan 19 '17 at 20:41




            1




            1





            If you prefer sir: fallocate -l 10M somefile.dump

            – Pascal Andy
            Feb 5 '17 at 18:05






            If you prefer sir: fallocate -l 10M somefile.dump

            – Pascal Andy
            Feb 5 '17 at 18:05


















            draft saved

            draft discarded
















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • 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%2funix.stackexchange.com%2fquestions%2f101332%2fgenerate-file-of-a-certain-size%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







            -bash, command-line, files

            Popular posts from this blog

            Frič See also Navigation menuinternal link

            Identify plant with long narrow paired leaves and reddish stems 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?What is this plant with long sharp leaves? Is it a weed?What is this 3ft high, stalky plant, with mid sized narrow leaves?What is this young shrub with opposite ovate, crenate leaves and reddish stems?What is this plant with large broad serrated leaves?Identify this upright branching weed with long leaves and reddish stemsPlease help me identify this bulbous plant with long, broad leaves and white flowersWhat is this small annual with narrow gray/green leaves and rust colored daisy-type flowers?What is this chilli plant?Does anyone know what type of chilli plant this is?Help identify this plant

            fontconfig warning: “/etc/fonts/fonts.conf”, line 100: unknown “element blank” The 2019 Stack Overflow Developer Survey Results Are In“tar: unrecognized option --warning” during 'apt-get install'How to fix Fontconfig errorHow do I figure out which font file is chosen for a system generic font alias?Why are some apt-get-installed fonts being ignored by fc-list, xfontsel, etc?Reload settings in /etc/fonts/conf.dTaking 30 seconds longer to boot after upgrade from jessie to stretchHow to match multiple font names with a single <match> element?Adding a custom font to fontconfigRemoving fonts from fontconfig <match> resultsBroken fonts after upgrading Firefox ESR to latest Firefox