Get the Core temp with lm-sensors

install sensors with:

for the average core temp use this:

and max core temp:

Important is in sed to escape the ‘|’ in regex like ‘|’

CPU Temperature

if you want to get the core temperature you could use sensors, install with :

if it detects your cpu temperature you could use this script to get the them:

Result looks like this:

if you only want to get the temperature you could use this:

Result looks like this:

Secure copy to another Host

if you want to copy a file to another server that runs ssh you can use scp like this:

if your ssh server runs on another port use this :

changing  ssh port see here.

HDparm shut down HDD

if you want to spin down your HDDs you could use hdparm.

to check your state use :

then to spin down the disk use :

if you want to spin down the disk after a time you could use the -S Parameter. From the man Page :

Values from 1 to 240 specify multiples of 5 seconds, yielding timeouts from 5 seconds to 20 minutes. Values from 241 to 251 specify from 1 to 11 units of 30 minutes, yielding timeouts from 30 minutes to 5.5 hours. A value of 252 signifies a timeout of 21 minutes. A value of 253 sets a vendor-defined timeout period between 8 and 12 hours, and the value 254 is reserved. 255 is interpreted as 21 minutes plus 15 seconds. Note that some older drives may have very different interpretations of these values.

For save your settings must add it to the “/etc/hdparm.conf” config:

don’t forget if your raid is rebuilding you cant shut down the HDDs, check this with :

Free Disk Space in Bash

Returns free disk space:

Returns free disk space in human readable form like  K.M or G:

Returns the used Percentage as value  :

with Percentage character use :

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.