Rechercher dans ce blog

Affichage des articles dont le libellé est bash. Afficher tous les articles
Affichage des articles dont le libellé est bash. Afficher tous les articles

vendredi 26 mars 2021

simple bash CLI commands cpu info, afficher cpu frequency, stress cpu test, scaling governor

 

Pour visualiser toutes les infos sur tes cpu :

cat /proc/cpuinfo

Pour afficher les fréquences de fonctionnement des cpu toutes les 0,5s :

watch -n 0,5 'cat /proc/cpuinfo | grep "MHz"'

Ctrl - c pour stopper


Pour changer le governor (en admettant que ce soit utile...)

sudo -sE pour devenir root

Passer en powersave

for file in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do echo "powersave" > $file; done

en performance

for file in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do echo "performance" > $file; done

Pour afficher l'état actuel

cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor


Pour stresser un peu les cores du cpu voilà qui peut faire l'affaire :

D'abord créer un fichier binaire de données aléatoires, rien de plus simple :

dd if=/dev/urandom of=512.bin bs=32M count=16 iflag=fullblock

pour un fichier de 512Mo nommé (astucieusement) 512.bin

Ajuster bs ou count pour changer la taille selon les besoins

Lancer le stress test avec plusieurs instances de bzip2 depuis le répertoire où se trouve le fichier bin avec la commande (bash) suivante :

for instance in {1..4}; do coproc bzip2 -k 512.bin -c > /dev/null ; done

ajuster le nombre d'instance de bzip2 en changeant la valeur dans la liste, ici 4

Pour voir les jobs... utiliser la commande jobs ;)

Pour killer tous les jobs :

kill %{1..4} ajuster selon le nombre d'instances

ou

kill %n pour killer seulement le job n

jeudi 11 février 2021

Raccourcis BASH

Control Key combinations (CTRL+KEY)

   Ctrl + a : jump to the start of the line
   Ctrl + b : move back a char
   Ctrl + c : terminate the command
   Ctrl + d : delete from under the cursor
   Ctrl + e : jump to the end of the line
   Ctrl + f : move forward a char
   Ctrl + k : delete to EOL
   Ctrl + l : clear the screen
   Ctrl + r : search the history backwards
   Ctrl + R : search the history backwards with multi-occurrence
   Ctrl + u : delete backward from cursor
   Ctrl + w : delete backward a word
   Ctrl + xx : move between EOL and current cursor position
   Ctrl + z : suspend/stop the command

Alt Key combinations (ALT+KEY)

   Alt + < : move to the first line in the history
   Alt + > : move to the last line in the history
   Alt + ? : show current completion list
   Alt + * : insert all possible completions
   Alt + / : attempt to complete filename
   Alt + . : yank last argument to previous command
   Alt + b : move backward
   Alt + c : capitalize the word
   Alt + d : delete word
   Alt + f : move forward
   Alt + l : make word lowercase
   Alt + n : search the history forwards non-incremental
   Alt + p : search the history backwards non-incremental
   Alt + r : recall command
   Alt + t : move words around
   Alt + u : make word uppercase
   Alt + Backspace : delete backward from cursor

Escape Key combinations (ESC+KEY)

   Esc + d : delete from cursor position to end of the word
   Esc + f : move forward a word
   Esc + b : move backward a word
   Esc + t : transpose two adjacent words

------------------------------------------------
Thanks to:

http://cheat.errtheblog.com/s/bash
http://www.shell-tips.com

jeudi 24 mai 2012

Raccourcis BASH

Control Key combinations (CTRL+KEY)

Ctrl + a : jump to the start of the line

Ctrl + b : move back a char

Ctrl + c : terminate the command

Ctrl + d : delete from under the cursor

Ctrl + e : jump to the end of the line

Ctrl + f : move forward a char

Ctrl + k : delete to EOL

Ctrl + l : clear the screen

Ctrl + r : search the history backwards

Ctrl + R : search the history backwards with multi-occurrence

Ctrl + u : delete backward from cursor

Ctrl + w : delete backward a word

Ctrl + xx : move between EOL and current cursor position

Ctrl + z : suspend/stop the command

Alt Key combinations (ALT+KEY)

Alt + < : move to the first line in the history

Alt + > : move to the last line in the history

Alt + ? : show current completion list

Alt + * : insert all possible completions

Alt + / : attempt to complete filename

Alt + . : yank last argument to previous command

Alt + b : move backward

Alt + c : capitalize the word

Alt + d : delete word

Alt + f : move forward

Alt + l : make word lowercase

Alt + n : search the history forwards non-incremental

Alt + p : search the history backwards non-incremental

Alt + r : recall command

Alt + t : move words around

Alt + u : make word uppercase

Alt + Backspace : delete backward from cursor

Escape Key combinations (ESC+KEY)

Esc + d : delete from cursor position to end of the word

Esc + f : move forward a word

Esc + b : move backward a word

Esc + t : transpose two adjacent words