Free Ram in Bash

If you want to get the free Ram of your system you could run:

this return free ram in gigabytes :

Check if the value is right :

result :

total       used       free     shared    buffers     cached
Mem:       7573696    6918704     654992          0     362128    5550592
-/+ buffers/cache:    1005984    6567712
Swap:      2540540        480    2540060

seems fine.

CPU Load average in Bash

If you want to use the load average in your Perl-Script you could use this Bash snippets, The load average returns the summary of the last 1,5 and 15 minutes.

This returns the last minute :

How it works : uptime returns all 3 loads, I print with awk the number 10 in the array.then the result is “3,45,” … I remove the last comma with cut and then translate all commas to dots with tr to convert it to a number in Perl.


if you want the last 5 minutest you have to change it to :

awk ‘{print $11}’

and for the last 15minutes to :

awk ‘{print $12}’

to check your result run :

result :

12:11:35 up 7 days, 20:20, 2 users, load average: 0,29, 0,35, 0,40

seems fine.

Generate Preview Jpeg/gif from Video

I use this Perl-Function to create a Thumbnail Gif and a Preview JPEG for my videos.If you want to switch the image with mouse over in HTML see this script.

I use the standard variable $$  (Prozess-ID)  to create a own folder for each process then convert, optimize and then delete.