nixCraft Linux Forum

nixCraft

Linux Tech Support Forum

How to create a bigfile (> 1Gb)?

This is a discussion on How to create a bigfile (> 1Gb)? within the Shell scripting forums, part of the Development/Scripting category; Hi friends I'm newbie here, at first, I wanna to say "Hi, so nice to be here" to all you. ...


Go Back   nixCraft Linux Forum > Development/Scripting > Shell scripting

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 03-29-2008, 03:36 PM
dnquynh's Avatar
Junior Member
User
 
Join Date: Mar 2008
My distro: Redhat
Posts: 4
Rep Power: 0
dnquynh is on a distinguished road
Unhappy How to create a bigfile (> 1Gb)?

Hi friends
I'm newbie here, at first, I wanna to say "Hi, so nice to be here" to all you.
I've got a problem in my work and need your help, thx in advance

I have to write a shell script to create one or many bigfiles (>1Gb). I was able to do that by using some nested big-while-loop, echo "", ">", ">>" character to put texts into a file, but It's apparently a stupid way.

Experts, please be kindly help me. Is there any other way to create a big-file? the data stored in the file is anything!

Many thanks
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 03-30-2008, 01:28 PM
Member
User
 
Join Date: Mar 2007
Location: Kathmandu
My distro: Ubuntu and Redhat
Posts: 33
Rep Power: 0
surmandal
Send a message via MSN to surmandal
Default

Why Don't you use seq command to create the File. use man seq for others parameters.
__________________
HACKER VS CRACKER
Reply With Quote
  #3 (permalink)  
Old 03-31-2008, 04:08 PM
Junior Member
User
 
Join Date: Mar 2008
My distro: Debian
Posts: 2
Rep Power: 0
lugoteehalt is on a distinguished road
Default

Don't really understand so please forgive me if this crass.

Create a file with $ touch filename. Glue the first file to the second with: $ cat file1 >> file2. $ dd if=/dev/zero of=filename bs=1024 count=1000000 gives a 1GB file full of zeros.
Reply With Quote
  #4 (permalink)  
Old 04-01-2008, 12:17 PM
dnquynh's Avatar
Junior Member
User
 
Join Date: Mar 2008
My distro: Redhat
Posts: 4
Rep Power: 0
dnquynh is on a distinguished road
Default

Thx friends, I tried as your suggestions
Using $dd is the good and quick way to create a big-file, but not sure what happened! lugoteehalt, could you please help me to make it clear?

I used file1.txt (included text "Hello, so nice to meet you") instead of /dev/zero, and not able to create a 1 GB file
Reply With Quote
  #5 (permalink)  
Old 04-01-2008, 12:26 PM
dnquynh's Avatar
Junior Member
User
 
Join Date: Mar 2008
My distro: Redhat
Posts: 4
Rep Power: 0
dnquynh is on a distinguished road
Default

Quite clear now by means of wiki . But I'm still a little bit confused, How could I create a 1-GB-file included non-null character
Many thanks
Reply With Quote
  #6 (permalink)  
Old 04-01-2008, 06:58 PM
Junior Member
User
 
Join Date: Mar 2008
My distro: Debian
Posts: 2
Rep Power: 0
lugoteehalt is on a distinguished road
Default

I'm not really an experienced scribe. Perhaps something like string together a load of Hello, nice to see you's to make 1KB - you could do this easilly with vim, say - this step isn't really necessary then:

for n in 1000000 this work??
cat file >> bigfile
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
create directory vyshas Shell scripting 3 01-14-2008 07:14 AM
Create output in columns rakeshrhn Shell scripting 5 12-07-2007 06:27 PM
Unable to create user vaibhav.kanchan Getting started tutorials 3 12-07-2007 10:46 AM
how to create super user click007 Getting started tutorials 12 08-28-2007 08:14 PM
How to create Backup NeoGreen Linux software 1 08-12-2007 11:54 AM


All times are GMT +5.5. The time now is 11:25 AM.


Powered by vBulletin® Version 3.7.3 - Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36