.
linux
changer editeur par default
export EDITOR=/bin/nano
export VISUAL=nano
export EDITOR=/usr/bin/vim
export VISUAL=vim
linux
https://alltime.pp.ua/blog/how-to-change-default-crontab-editor/
<iframe width="100%" height="308" src="http://snipet.teknotit.com/index.php?embed=5e83f19431103" type="text/html"></iframe>
Texte seul - Permalink - Snippet public posté le 01/04/2020
swap
fallocate -l 1G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
sysctl vm.swappiness=20
nano /etc/fstab
/swapfile swap swap defaults 0 0
nano /etc/sysctl.conf => vm.swappiness=10
sysctl vm.vfs_cache_pressure=50
nano /etc/sysctl.conf => vm.vfs_cache_pressure=50
linux swap sysadmin
https://linuxize.com/post/how-to-add-swap-space-on-debian-9/
<iframe width="100%" height="488" src="http://snipet.teknotit.com/index.php?embed=5d0cfdfee2c09" type="text/html"></iframe>
Texte seul - Permalink - Snippet public posté le 11/03/2021
Flush iptable
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
iptables -t nat -F
iptables -t mangle -F
iptables -F
iptables -X
linux ssh
<iframe width="100%" height="326" src="http://snipet.teknotit.com/index.php?embed=5beaf2818b827" type="text/html"></iframe>
Texte seul - Permalink - Snippet public posté le 13/11/2018
Swap
#raccourcis commande qui fait tout en un
---------------
sudo install -o root -g root -m 0600 /dev/null /swapfile
dd if=/dev/zero of=/swapfile bs=1k count=2048k
mkswap /swapfile
swapon /swapfile
echo "/swapfile swap swap auto 0 0" | sudo tee -a /etc/fstab
sudo sysctl -w vm.swappiness=10
echo vm.swappiness = 10 | sudo tee -a /etc/sysctl.conf
---------------
#Désactiver swap
swapoff -a
#Activer swap
swapon -a
Articles :
http://geekeries.de-labrusse.fr/?p=1806
https://meta.discourse.org/t/create-a-swapfile-for-your-linux-server/13880
linux sysadmin ubuntu
https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-12-04
<iframe width="100%" height="686" src="http://snipet.teknotit.com/index.php?embed=5632442eec130" type="text/html"></iframe>
Texte seul - Permalink - Snippet public posté le 29/10/2015
nombre de coeur processeur
grep processor /proc/cpuinfo | wc -l
bash linux
<iframe width="100%" height="200" src="http://snipet.teknotit.com/index.php?embed=544b51b3804c3" type="text/html"></iframe>
Texte seul - Permalink - Snippet public posté le 25/10/2014
generation cle ssh public prive sans passe
ssh-keygen -f ~/.ssh/id_rsa -q -P ""
linux ssh
<iframe width="100%" height="200" src="http://snipet.teknotit.com/index.php?embed=544aef48a2415" type="text/html"></iframe>
Texte seul - Permalink - Snippet public posté le 25/10/2014
Copie de fichier entre serveur ssh
# exemple avec une cle d'uatorisation public
scp authorized_keys root@846.126.109.15:/root/.ssh/
bash linux ssh
<iframe width="100%" height="236" src="http://snipet.teknotit.com/index.php?embed=544ae61deb0f0" type="text/html"></iframe>
Texte seul - Permalink - Snippet public posté le 24/10/2014
Copying Files Between Windows and Linux using PuTTY
set PATH=C:\Program Files\PuTTY
#The format for pscp is straight forward:
pscp [options] source destination
#To copy a Windows file to Linux system, at the DOS prompt, type
pscp c:/music.mp3 ubuntu@10.0.0.3:/home/ubuntu/Music
The reverse works as well (copy Linux file to Windows)
pscp ubuntu@10.0.0.3:/home/ubuntu/Music/music.mp3 c:/
bash linux ssh
https://community.freescale.com/thread/220596
<iframe width="100%" height="416" src="http://snipet.teknotit.com/index.php?embed=54480fc9d4aa9" type="text/html"></iframe>
Texte seul - Permalink - Snippet public posté le 24/10/2014
Créer des répertoire et sous répertoire en une commande
mkdir -p myProject/{src,doc,tools,db}
bash linux repertoire
<iframe width="100%" height="200" src="http://snipet.teknotit.com/index.php?embed=5440a717e2f1f" type="text/html"></iframe>
Texte seul - Permalink - Snippet public posté le 17/10/2014
Ftp commande "lft"
# Lorsqu'on souhaite juste mettre un fichier sur le serveur distant, c'est la fonction put qu'il faut utiliser :
lftp ftp://identifiant:mot_de_passe@site_de_connexion -e "put -O /repertoire/fichier/distant/ /chemin/local/du/fichier; quit"
#Si l'on souhaite rapatrier un fichier, c'est la fonction get :
lftp ftp://identifiant:mot_de_passe@site_de_connexion -e "get /repertoire/fichier/distant/ -o /chemin/local/du/fichier; quit"
linux sysadmin
http://doc.ubuntu-fr.org/lftp
<iframe width="100%" height="326" src="http://snipet.teknotit.com/index.php?embed=5440a5a0549b4" type="text/html"></iframe>
Texte seul - Permalink - Snippet public posté le 17/10/2014
Recherche sous linux
find . -name '*.ear' -exec ls -lh {} \;
bash linux
<iframe width="100%" height="200" src="http://snipet.teknotit.com/index.php?embed=5440a57060107" type="text/html"></iframe>
Texte seul - Permalink - Snippet public posté le 17/10/2014
Pure ftp
#Ajout d'un group et d'un utilisateur
sudo groupadd ftpgroup
useradd -g ftpgroup -d /dev/null -s /usr/sbin/nologin ftpuser
# L'utilisateur ftp (test)
pure-pw useradd test -u ftpuser -g ftpgroup -d /home/www/test
# Rgénéré la liste mot de passe après un ajout
pure-pw mkdb
#Une seule fois (création du liens symbolique
sudo ln -s /etc/pure-ftpd/conf/PureDB /etc/pure-ftpd/auth/50pure
Source :http://doc.ubuntu-fr.org/pure-ftp
http://www.webactus.net/coin-du-geek/991-installer-et-configurer-pureftpd-avec-des-utilisateurs-virtuels-et-gestion-de-quotas/
http://download.pureftpd.org/pub/pure-ftpd/doc/README.Virtual-Users
pour l'utilisateur www-data,
il faut modifier /etc/pure-ftpd/conf/MinUID, et mettre 32
Changer mot de passe / supprimer utilisateur
pure-pw passwd someuser
pure-pw mkdb
https://wiki.archlinux.org/index.php/Pure-FTPd
Lister les utilisateurs :
pure-pw list
linux sysadmin
http://www.webactus.net/coin-du-geek/991-installer-et-configurer-pureftpd-avec-des-utilisateurs-virtuels-et-gestion-de-quotas/
<iframe width="100%" height="938" src="http://snipet.teknotit.com/index.php?embed=5440a1f30113d" type="text/html"></iframe>
Texte seul - Permalink - Snippet public posté le 06/11/2019
Replacing Big Fat Bash with Dash for Scripting
apt-get install dash
dpkg-reconfigure dash
linux sysadmin ubuntu
<iframe width="100%" height="218" src="http://snipet.teknotit.com/index.php?embed=5440a1b481bb7" type="text/html"></iframe>
Texte seul - Permalink - Snippet public posté le 17/10/2014
changement time zone
dpkg-reconfigure tzdata
bash linux
<iframe width="100%" height="200" src="http://snipet.teknotit.com/index.php?embed=5440a0b089b62" type="text/html"></iframe>
Texte seul - Permalink - Snippet public posté le 17/10/2014
Speed Test Vps (download / upload)
wget dl.getipaddr.net/speedtest.sh 2>/dev/null -O- | bash
bash linux
http://lowendtalk.com/discussion/13786/coded-a-speedtest-script-that-test-your-server-s-upload-and-download-speeds
<iframe width="100%" height="200" src="http://snipet.teknotit.com/index.php?embed=54409ce489f80" type="text/html"></iframe>
Texte seul - Permalink - Snippet public posté le 17/10/2014
Créer artificiellement des fichiers d'une taille précise
#Cette commande va créer un fichier vide de 10 Mo (10 000 fois 1k).
dd if=/dev/zero of=lefichier bs=1k count=10000
bash linux
http://www.bash-linux.com/script-shell-31-creer-artificiellement-des-fichiers-une-taille-precise.html
<iframe width="100%" height="236" src="http://snipet.teknotit.com/index.php?embed=54409be937544" type="text/html"></iframe>
Texte seul - Permalink - Snippet public posté le 17/10/2014
Taille d'un répertoire
du -kh --max-depth=1 mon_repertoire/
bash linux repertoire taille
<iframe width="100%" height="200" src="http://snipet.teknotit.com/index.php?embed=544091183c11f" type="text/html"></iframe>
Texte seul - Permalink - Snippet public posté le 17/10/2014