The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
create data file from report file cvvsnm UNIX for Dummies Questions & Answers 3 02-01-2008 12:25 PM
Read words from file and create new file using K-shell. bsrajirs Shell Programming and Scripting 4 06-01-2007 12:15 PM
File Compare and Create New File with Diff guiguy UNIX for Advanced & Expert Users 7 02-28-2007 06:43 AM
How to create .SO file (DLL) sarwan High Level Programming 3 09-29-2005 09:36 AM
Create a file? peter UNIX for Dummies Questions & Answers 2 02-16-2001 03:10 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-22-2007
big123456 big123456 is offline
Registered User
  
 

Join Date: May 2005
Posts: 200
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 ?
Many thanks.
  #2 (permalink)  
Old 05-22-2007
zazzybob's Avatar
zazzybob zazzybob is offline Forum Advisor  
Registered Geek
  
 

Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 2,100
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
ZB
  #3 (permalink)  
Old 05-22-2007
big123456 big123456 is offline
Registered User
  
 

Join Date: May 2005
Posts: 200
Thank you.
  #4 (permalink)  
Old 05-23-2007
the_learner the_learner is offline
Registered User
  
 

Join Date: Apr 2007
Posts: 75
how about

mkfile -n <size>

e.g:

mkfile -n 20k

(not sure, this works for me on solaris though)
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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




All times are GMT -4. The time now is 09:03 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0