The UNIX Forums
"Join the Network of UNIX System Users"


 
m1l
Newbie
Rank: 1



UID 243
Digest Posts 0
Credits 0
Posts 7
Reading Access 10
Registered Apr 25, 2007
Status Offline
Post at Jun 20, 2007 10:40 AM  Profile | P.M. 
create a file



create a file



hi,
under linux redhat how to create an empty file with a defined size ?
how to put it at the end of another file ?


Top
Anta
Newbie
Rank: 1



UID 5
Digest Posts 0
Credits 0
Posts 20
Reading Access 10
Registered Apr 25, 2007
Status Offline
Post at Jun 20, 2007 10:40 AM  Profile | P.M. 
to create a 1m file:

code:

$ dd if=/dev/zero of=./tmpfile bs=1024 count=1024
1024+0 records in
1024+0 records out
1048576 bytes transferred in 0.033088 secs (31690552 bytes/sec)
$ ls -lh ./tmpfile
-rw-r--r--   1 user group       1m may 22 17:09 ./tmpfile
this file will be filled with \0's (nul's - man ascii).

if you really want to append this to another file, you could do

code:

$ cat somefile tmpfile > newfile
$ mv newfile somefile
after creating tmpfile.

cheers
Top
AllyWalker
Newbie
Rank: 1



UID 48
Digest Posts 0
Credits 0
Posts 49
Reading Access 10
Registered Apr 25, 2007
Status Offline
Post at Jun 20, 2007 10:40 AM  Profile | P.M. 
how about

mkfile -n <size>

e.g:

mkfile -n 20k
Top
 

 

All times are GMT, the time now is Mar 12, 2010 03:06 PM

Powered by Discuz! 5.0.0  © 2001-2006 UNIX Forums
Processed in 0.004983 second(s), 8 queries

Clear Cookies - Contact Us - UNIX Help - Archiver - WAP