question about files?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers question about files?
# 8  
Old 12-10-2003
Quote:
Originally posted by Neo
Perfect, something like:

Code:
cat /dev/zero | dd of=test.file bs=20000

Thanks!

Not sure how to make 20MBs from this Smilie Perhaps someone can assist? I tried bs=20000 but it was HUGH!!! Much bigger than 20MB!!!!

Neo
Don't try this at home Smilie .... it just keeps growing bigger and bigger without bounds until it fills up the disk !!

I even tried:


Code:
cat /dev/zero | dd of=test.file bs=1

But GROWS AND GROWS on my Linux box... hmmm?

PS: On Linux we have both /dev/zero and /dev/full ....
# 9  
Old 12-10-2003
Code:
#!/bin/bash

while ["$f_size" -ne "$desired_size"]
do
        cat /dev/zero > tempfile
done


so $f_size would be :
f_size=`filesize name of empty file`

and $desired_size would be:
desired_size=whatever size you want



oh, i guess cat /dev/zero would go on forever as neo had said before.. ok so pick a file thats not to big to cat to your file.
# 10  
Old 12-10-2003
Quote:
Originally posted by norsk hedensk
Code:
#!/bin/bash

while ["$f_size" -ne "$desired_size"]
do
        cat /dev/zero > tempfile
done

.
Thats a great approach by norsk hedensk and will work because it tests the size of the file that is written.

I'm still confused as to why the simple cat |dd pipeline will not work with /dev/zero......Smilie
# 11  
Old 12-10-2003
Well, I'm a pro...so I tried it at home despite your warning...

dd if=/dev/zero bs=1048576 count=20 of=20meg

seems to work fine. Smilie
# 12  
Old 12-10-2003
Quote:
Originally posted by Perderabo
Well, I'm a pro...so I tried it at home despite your warning...

dd if=/dev/zero bs=1048576 count=20 of=20meg

seems to work fine. Smilie
Well, didn't mean you, Perderabo Smilie

This also works, thanks.....

Code:
cat /dev/zero |dd  bs=1048576 count=20 of=20meg_again

....as one might expect.

Neo
# 13  
Old 12-10-2003
Solaris has a mkfile command that does this. I don't know if other OS's have this also.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Question on awk source files

Im repeating same command to get count, filename from 4 different files, writing to one same file. awk 'END{print NR"|"FILENAME}' file.txt >> temp.txt; awk 'END{print NR"|"FILENAME}' asdf.txt >> temp.txt; awk 'END{print NR"|"FILENAME}' lkjh.txt >> temp.txt; awk 'END{print NR"|"FILENAME}'... (12 Replies)
Discussion started by: JSKOBS
12 Replies

2. Shell Programming and Scripting

Bash Looking into files question

I have a bunch of files that are messages in my directory. Each message has a date located in the file. How can I look into each file and find the date? Thank you for any help (7 Replies)
Discussion started by: totoro125
7 Replies

3. Shell Programming and Scripting

Bash script deleting my files, and editing files in subdirectories question

#!/bin/bash # name=$1 type=$2 number=1 for file in ./** do if then filenumber=00$number elif then filenumber=0$number fi tempname="$name""$filenumber"."$type" if (4 Replies)
Discussion started by: TheGreatGizmo
4 Replies

4. Solaris

Question about copying files in Solaris

Hi everyone, What is the Solaris equivalent of cp -u? I'm copying files from one directory to another, and I'd like to only copy files which are newer. Thanks! (4 Replies)
Discussion started by: Fatbob
4 Replies

5. UNIX for Dummies Questions & Answers

Please help Question about Excel Files and Unix

Hello I have an excel file , it has 4 tabs , each having specific details for example it has a customer tab , it has a payments tab and it has an address tab Question is How do I seperate each of these tabs and load them into 3 different excel files Using Unix That is the... (2 Replies)
Discussion started by: arnab1978
2 Replies

6. Shell Programming and Scripting

Simple bash question - 2 files together

Hello Friends, I have a simple problem but I can't seem to find a solution, perhaps you could gimme a hand here.. I have to files 1.txt which contains the following 00 01 02 03 and 2.txt which contains the following: 20 21 22 23 All I need is to concatenate these 2 files in... (2 Replies)
Discussion started by: bashshadow1979
2 Replies

7. Shell Programming and Scripting

question using grep with files

hi, i'm trying to figure out how to use grep in different ways in bash.. lets say you have two files, one with a list of words and the other with text i want to go through the list of words in one file and for each word, find every occurrence of that word in the other file and display... (1 Reply)
Discussion started by: kratos.
1 Replies

8. UNIX for Dummies Questions & Answers

listing files question

hello im new to linux programming trying to list files in a directory i current have the code to list all the files but i do not want the hidden files to show such as a file named .openoffice.org2.0 for example, can anyone help me or point me in the right direction #include <sys/types.h>... (2 Replies)
Discussion started by: Fortune
2 Replies

9. Shell Programming and Scripting

Compare files question

Hi all, How do I compare contents of entire two files except for the first line is each of them? I am sure first lines from both my files are going to be different so I want to ignore them. Is there a easier way than creating temporary files by cutting out the first line and then comparing... (1 Reply)
Discussion started by: jakSun8
1 Replies

10. UNIX for Dummies Questions & Answers

Question: Removing Files Using du

I want to identify files that have zero length, bascially files that are 0 byte in size. Then remove those files that are found using du. I wanted to do this in a way that, let's remove 0 size jpg files: foreach f (*jpg) du $f end This will only list the size and file name, I wanted... (4 Replies)
Discussion started by: ApprentiSorcier
4 Replies
Login or Register to Ask a Question