Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

updated:

I'd like to save a large amount data ( ~ 100MB ) from the standard input in temporary location for the duration of my bash session.

Piping it to a file won't work as I have only 30MB of free space. I also don't want to save it in a variable.

I'd obviously have to utilize some space other than that of my Disk Storage. Which leaves my RAM.

Is there some mechanism that will allow me to write to it, and then to retreive the written data again. ( like when you pipe to and from /dev/null )

share|improve this question
    
It appears you want to do this from a shell. Also, do you want the data to be locked in ram? That is to NEVER get swapped out? –  kbyrd Sep 16 '10 at 15:58
    
@kbyrd, updated the question, hope it makes more sense now :) –  Stefan Sep 16 '10 at 16:31
1  
I'm unclear about how krissi's answer doesn't address this. His answer provides a mechanism for writing to ram. –  Steven D Sep 16 '10 at 16:43

1 Answer 1

up vote 5 down vote accepted

you can mount an ramfs and store data there (as a file)

# mkdir /media/ram
# mount -t ramfs none /media/ram
# <texfile grep pattern > /media/ram/ram
# cat /media/ram/ram
# umount /media/ram
share|improve this answer
    
Stefan: this sounds like exactly what you're looking for - /media/ram will act like a device (like /dev/null), and will take up no disk space: any files you create in that directory will only be created "in memory" (i.e. in your RAM), and will be lost when you unmount /media/ram in the last step. –  Gaurav Sep 16 '10 at 17:50
    
and thus it has been accepted –  Stefan Sep 16 '10 at 19:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.