loadkeys fr keyboard in FR  
lsb_release -a display linux version   
uname -a, cat /etc/redhat-release show system version all  
df -h disk status in thousand bytes  
du -kxm fs size in Mo  
top or htop display daemon,memory, swap htop for muliprocessor
free -m memory status  
ps -ef | grep [daemon] list deamon  
strace -p [pid], losf -p [pid] trace process pid  
rcpinfo -p    
nohup [command] & launch command in backend  
rm -f [filename] force to delete a file  
mv [oldfilename] [newfilename], cp
move or rename filename, copy  
mkdir -p [fs], rm -P [fs] create filesystem with all path, remove a fs  
ln -s [path] [linkname] create a link to path  
touch [filename] create filename empty  
tail [filename]  display last 10 lines of filename -n [nblines] -f display permanently
cat filename to print content like cat /proc/meminfo, cat /proc/cpuinfo  
grep -v "^#" to avoid any comment line -v to except string
grep -e pattern1 -e pattern2 -e etc...
grep "pattern1\|pattern2\|etc..."
to display line content of several pattern  
sed -i '/patern/d' filename delete line within patern from filename  -i for inplace
sed 's/patern1/patern2/g' filename1 > filename2 Replace patern1 by patern2 keep filename1  
ls -la list blank files S sort size, r reverse sort
find directory -name filename    
locate [text], updatedb  find text, update database of locate  
 chkconfig --list  list deamon started at boot level
 
chkconfig [deamon] on|off  enble/disable deamon on start  
useradd -g [group], userdel  add a user / remove  
netstat -paunt list open ports  
ifconfig -a list network interfaces  

mdadm --assemble --run /dev/md0 /dev/sdn
mount /dev/md0 /mnt/test

To mount a foreign raid  
     

Cache / memory
Pour libérer pagecache:
> sync; echo 1 > /proc/sys/vm/drop_caches

Pour libérer dentries et inodes:
> sync; echo 2 > /proc/sys/vm/drop_caches

Pour libérer pagecache, dentries et inodes:
> sync; echo 3 > /proc/sys/vm/drop_caches

Remise Par défaut :
> sync; echo 0 > /proc/sys/vm/drop_caches

mem -m
free -l ou free -m pour infos en Mb
ps aux --sort -rss

sudo -s [user] login as user, user empty to login as root

rpcinfo: makes an RPC call to an RPC server and reports what it finds. rpcinfo -p [host] lsb_release -a to display linux version foremost: Recover files using their headers, footers, and data structures sudo foremost [-h][-V][-d][-vqwQT][-b<blocksize>][-o<dir>][-t<type>][-s<num>][-i<file>]

Logrotate

create a configuration file in /etc/logrotate.d/exemple
/path/path/filename.log*{
dateext
dateformat %Y%m%d
daily,weekly,monthly
compress or nocompress
ifempty or notifempty #With this, the log file is rotated even if it is empty. This is the default for logrotate.
copytruncate or nocoytruncate #This is used when processes are still writing information to open log files. This option copies the active log file to a backup and truncates the active log file.
create mode owner group or nocreate #This rotates the log file and creates a new log file with the specified permissions, owner, and group. The default is to use the same mode, owner, and group as the original file.
rotate count
prerotate
command
command
endscript
postrotate
command
command
endscript


Ubuntu
Network:

netstat: état du réseau sudo nano /etc/network/interfaces auto eth0 iface eth0 inet static         address 192.168.10.2         netmask 255.255.255.0         gateway 192.168.10.1 dns-nameservers 8.8.8.8 8.8.4.4 sudo /etc/init.d/networking restart sudo service networking {restart/stop/start}

Centos /RedHat
yum install net-tools pour avoir ifconfig

Modification du nom des interfaces … eno .. vers ethx
1.Edit /etc/default/grub
2.At the end of GRUB_CMDLINE_LINUX line append "net.ifnames=0 biosdevname=0
Taper : grub2-mkconfig -o /boot/grub2/grub.cfg
Renommer le nom de l’interface /etc/sysconfig/network-scripts/ifcfg-enoxxx par ifcfg-eth0 ainsi que le name=enoxxx apr name=eth0

/etc/sysconfig/network-scripts/ifcfg-ethx fichier config NIC
/etc/sysconfig/network-scripts/route-ethx pour fixer les routes

Rename server name:

sudo nano /etc/hostname sudo nano /etc/hosts

Packets

: Télécharger des packages du web: wget url

Installer des packages en mode ligne: apt-get install package
Enlever des packages en mode ligne: apt-get remove package
List des packages installés: dpkg --get-selections | grep package
Mettre à jour la liste des fichiers disponibles: sudo apt-get update
Mettre à jour tous les paquets installés sur le système: sudo apt-get upgrade
Mettre à jour tous les paquets installés vers les dernières versions en installant de nouveaux paquets si nécessaire: sudo apt-get dist-upgrade
Mettre à jour la version installée: sudo do-release-upgrade, -d to beta version

Server:

Arrêter le serveur: shutdown -h now
Rebooter le serveur: shutdown -r now, init 6

Configurer le réseau:
sudo nano /etc/network/interfaces
Relancer le réseau: sudo /etc/init.d/networking restart
Afficher les utilisateurs: who ou ps -ef|grep tty
Editeur avacancé: nano filename,
afficher un fichier cat filename

The login screen uses a different configuration script to the main part.
To change the keyboard layout it uses you have to edit the configuration file. (I had the same issue changing to dvorak).
To get the gdm login screen to recognise the your layout: sudo gedit or nano /etc/default/console-setup gksudo gedit /etc/X11/xorg.conf
List of running process ps aux | grep -i process_name firewall https://help.ubuntu.com/community/IptablesHowTo http://ubuntuforums.org/showthread.php?t=159661
display tables: sudo iptables -L
erase tables: sudo iptables -F
save rules: sudo iptables-save > /etc/iptables.rules

FTP allow

sudo iptables -A INPUT -i eth0 -p tcp -m tcp --sport 21 -m state --state ESTABLISHED -j ACCEPT sudo iptables -A INPUT -i eth0 -p tcp -m tcp --sport 20 -m state --state ESTABLISHED,RELATED -j ACCEPT sudo iptables -A INPUT -i eth0 -p tcp -m tcp --sport 1024:65535 --dport 1024:65535 -m state --state ESTABLISHED -j ACCEPT sudo iptables -A OUTPUT -o eth0 -p tcp -m tcp --dport 21 -m state --state NEW,ESTABLISHED -j ACCEPT sudo iptables -A OUTPUT -o eth0 -p tcp -m tcp --dport 20 -m state --state ESTABLISHED -j ACCEPT sudo iptables -A OUTPUT -o eth0 -p tcp -m tcp --sport 1024:65535 --dport 1024:65535 -m state --state ESTABLISHED,RELATED -j ACCEPT

Support NTFS sudo aptitude install ntfs-3g ntfsprogs ntfstools
Files system to share should be in /etc/exports
exemple: /path/FilesSystem */IP/server (rw,no_root_squash,,fsid=0)

Partitionner les disques apt-get install gparted

Convert RAID1 backup to RAID 0
Run fdisk -l. This will tell you how many and which arrays you have. In following steps, I'm assuming you only have /dev/md0.
Run mdadm --detail /dev/md0. This will give you information about which physical disks are in use.
Run umount -l /dev/md0, which will allow you to later stop your RAID. The -l flag will do the following, as per its man page:

-l Lazy unmount. Detach the filesystem from the filesystem hierarchy now, and cleanup all references to the filesystem as soon as it is not busy anymore. (Requires kernel 2.4.11 or later.)
Run mdadm --stop /dev/md0. This will stop your RAID array.
Erase the superblock on each device in the RAID (should be detailed in the command run in step 2).

mdadm --zero-superblock /dev/sda
mdadm --zero-superblock /dev/sdb

Mozilla Thunderbird

Personnal folder is $home/.thunderbird/xxxxxxxx.default/

Mozilla Firefox

Pour ajouter le plugin 'java' dans firefox:
1/ Installer la version de jre adéquate:
yum install jre-xuxx-linux-x64.rpm
ex: yum install jre-8u161-linux-64.rpm

2/ Rechercher le fichier libnpjp2.so:
find /usr/java/ -name *p2.so
ex: /usr/java/jre1.8.0_161/lib/amd64/libnpjp2.so

3/ Ajouter un lien symbolic dans les plugins de mozzila:
cd /usr/lib64/mozilla/plugins
ln -fs /usr/java/jre1.8.0_161/lib/amd64/libnpjp2.so

4/ Lancer firefox vous devriez voir java/jre dans l'onglet about:plugins

Open SSH
sudo apt-get install openssh-server
sudo service ssh {restart/stop/start}