DD
Bench IO disk via dd :
Write :1
time dd if=/dev/zero of=testfile bs=1024k count=1000 && sync
Read :1
time dd if=testfile of=/dev/null bs=1024k
Bench IO disk via dd :
Write :1
time dd if=/dev/zero of=testfile bs=1024k count=1000 && sync
Read :1
time dd if=testfile of=/dev/null bs=1024k
1 | # atq |
Liste les taches plannifiées
1 | atrm 13 |
Efface une tache
1 | at 17:33 |
at + la date souhaitée
ensuite, une liste de commande (enter entre chaque)
et “Ctrl-d” pour sortir
1 | rsync --delete-before -a -H /tmp/EMPTY/ TODELETE/ |
1 | perl -e 'for(<*>){((stat)[9]<(unlink))}' |
shred -vfuz -n 10 file
shred –verbose –random-source=/dev/urandom -n 1 /dev/sda
scrub -p dod /dev/sda
scrub -p dod -r file
badblocks -s -w -t random -v /dev/sda
badblocks -c 10240 -s -w -t random -v /dev/sda
srm -vz /tmp/file
sfill -vz /local
sdmem -v
swapoff /dev/sda5 && sswap -vz /dev/sda5
Depuis mysql 5.6 on peut multi threader la repli
Nombre de thread1
slave_parallel_workers
Mémoire par thread1
slave_pending_jobs_size_max
defaut 16M
/!\ The value for this option must not be less than the master’s value for max_allowed_packet
Conf le daemon
1 | cat /etc/default/atop |
Lire le resultat1
2atop -r /var/log/atop.log.1
atop -r /var/log/atop.log.1 -b 13:00 -e 13:30
ou atop pour le regarder en live facons top (ensuite ‘z’ permettra de mettre en pause)
Ne pas faire logguer postfix dans syslog en plus de mail.log, ainsi que virer cron de syslog
1 | *.*;mail.none;mail.error;auth,cron,authpriv.none -/var/log/syslog |
Disable mail.info qui double mail.log1
2
3#mail.info -/var/log/mail.info
#mail.warn -/var/log/mail.warn
#mail.err /var/log/mail.err
1 | cron.* /var/log/cron.log |
1 | Apr 11 16:17:46 myserver rsyslogd-2177: imuxsock lost 99 messages from pid 3607 due to rate-limiting |
1 | root@myserver/:# vi /etc/rsyslog.conf |
1 | # echo "test" | logger -s -p auth.notice -t youpee <37>Oct 28 15:41:08 youpee: test # tail -1 /var/log/auth.log Oct 28 15:41:08 thcol-exp-logs-01 youpee: test |
Minuscule à majuscule :
1 | echo "EEdddzZ" | tr '[:lower:]' '[:upper:]' |
Supprime les sauts de ligne
1 | tr -d '\r\n' |
Demande de pass interactive :
1 | echo -n Password: ; read -s pass ; for i in ` ls access.log*` ; do echo $pass | scp --stdin access.log* root@10.0.0.1:/toto ; done |
Affiche sans les commentaires
1 | sed -e '/^[ ]*#/d' -e '/^$/d' |
exec a partir de awk
1 | cat /etc/hosts | awk '{ system("echo " $2" "$1)}' |
Append 2 files in columns1
paste -d " " fileliste1 fileliste2
Dos2unix1
$ cat mon_fichier.txt | tr -d '\r' > mon_nouveau_fichier.txt
Kill un process zombi1
gdb -p <zombi_pid>
Affiche de 1 à 51
for i in {1..5} ; do echo $i ; done
Compare 2 lists1
$ comm list1.txt list2.txt
Chmod +x only directory1
$ chmod -R +X dir/
Random sleep max 10s1
sleep $(( RANDOM % 10 ))
Proxy tcp1
mkfifo /tmp/fifo.socket
nc -lk -p 8080 </tmp/fifo.socket | nc www.unvrai.info 80 >/tmp/fifo.socket
Close shell keeping all subprocess running1
disown -a && exit
Edit a file on a remote host using vim1
vim scp://user@host//etc/fstab
Find duplicate files (based on MD5 hash)1
find -type f -exec md5sum '{}' ';' | sort | uniq --all-repeated=separate -w 33
Show current working directory of a process1
pwdx <pid>
Limit the cpu usage of a process1
cpulimit -p pid -l 50
Start a command on only one CPU core1
taskset -c 0 <command>
Find which directory in one filesystem that contains most inodes or files.1
find / -xdev -printf '%h\n' | sort | uniq -c | sort -k 1 -n | tail │
Ctrl + a Go to the beginning of the line (Home)
Ctrl + e Go to the End of the line (End)
Ctrl + p Previous command (Up arrow)
Ctrl + n Next command (Down arrow)
Alt + b Back (left) one word
Alt + f Forward (right) one word
Ctrl + f Forward one character
Ctrl + b Backward one character
Ctrl + xx Toggle between the start of line and current cursor position
Editing:
Ctrl + L Clear the Screen, similar to the clear command
Alt + Del Delete the Word before the cursor.
Alt + d Delete the Word after the cursor.
Ctrl + d Delete character under the cursor
Ctrl + h Delete character before the cursor (Backspace)
Ctrl + w Cut the Word before the cursor to the clipboard.
Ctrl + k Cut the Line after the cursor to the clipboard.
Ctrl + u Cut/delete the Line before the cursor to the clipboard.
Alt + t Swap current word with previous
Ctrl + t Swap the last two characters before the cursor (typo).
Esc + t Swap the last two words before the cursor.
ctrl + y Paste the last thing to be cut (yank)
Alt + u UPPER capitalize every character from the cursor to the end of the current word.
Alt + l Lower the case of every character from the cursor to the end of the current word.
Alt + c Capitalize the character under the cursor and move to the end of the word.
Alt + r Cancel the changes and put back the line as it was in the history (revert).
ctrl + _ Undo
Ctrl+I = Tab
Ctrl+J = Newline
Ctrl+M = Enter
Ctrl+[ = Escape
Ctrl + r Recall the last command including the specified character(s)
searches the command history as you type.
Equivalent to : vim ~/.bash_history.
Ctrl + p Previous command in history (i.e. walk back through the command history)
Ctrl + n Next command in history (i.e. walk forward through the command history)
Ctrl + s Go back to the next most recent command.
(beware to not execute it from a terminal because this will also launch its XOFF).
Ctrl + o Execute the command found via Ctrl+r or Ctrl+s
Ctrl + g Escape from history searching mode
!! Repeat last command
!abc Run last command starting with abc
!abc:p Print last command starting with abc
!$ Last argument of previous command
ALT + . Last argument of previous command
!* All arguments of previous command
^abc^def Run previous command, replacing abc with def
Ctrl + C Interrupt/Kill whatever you are running (SIGINT)
Ctrl + l Clear the screen
Ctrl + s Stop output to the screen (for long running verbose commands)
Then use PgUp/PgDn for navigation
Ctrl + q Allow output to the screen (if previously stopped using command above)
Ctrl + D Send an EOF marker, unless disabled by an option, this will close the current shell (EXIT)
Ctrl + Z Send the signal SIGTSTP to the current task, which suspends it.
To return to it later enter fg ‘process name’ (foreground).