Skip to main content

Command

Infos CPU​

Affichage type processeur​

cat /proc/cpuinfo | grep "model name"

Nombre de coeur physique​

grep "physical id" /proc/cpuinfo |sort -u |wc -l

Nombre de coeur logique​

grep -c "processor" /proc/cpuinfo

Infos démarrage​

Dernier reboot​

last reboot | head -1

ou

who -b

Dernier shutdown​

last -x|grep shutdown | head -1

Compression/Décompression​

Décompresser avec rebase​

tar xvf 'file' --strip-components 5

Tarball one-liner​

tar xzf - -C ${HOME}/Tools k9s.exe < <(curl -Ls --cacert ${CERTS_FULL_CA_BUNDLE} ${K9S_URL})

Tester une connection TCP​

SERVER=google.com PORT=80
if (: </dev/tcp/$SERVER/$PORT) 2>/dev/null
then
printf "succeeded \n"
else
printf "failed \n"
fi
note

variante one-liner

bash -c 'exec 3<> /dev/tcp/'localhost'/'22';echo $?' 2>/dev/null

Tunnel SSH​

Exemple d'un tunnel http pour mise a jour yum

Machine 1 : Source Machine 2 : cible (accès internet)

Machine 1 Dans /etc/yum.conf

proxy=socks5h://localhost:1080

puis taper la commande suivante

ssh -D 1080 root@machine 2

puis taper la commande désiré sur la machine 1 depuis un autre terminal (très important)

YUM​

Option "downloadonly"​

yum install --downloadonly --downloaddir='path' 'package'
note

Prérequis : Installer le package yum-downloadonly

File System (visualisation)​

Création fichier avec masque défini​

umask 022
note

(avec 022 = chmod 755)

Affichage espace libre ou occupé​

Affichage espace occupé en Mo​

du -sm

Top 10 des plus gros fichiers​

du -am . | sort -nr | head -10

Tri sur la 4eme colonne​

df -h | sort -nk4