397 liens privés
Un peu de philosophie sur les "pipes" Unix :
That is the beauty of the
|
it allows for solving problems by combining small, simple programs together.I love software design that enables creativity, values simplicity, and doesn’t put users in a box. The pipe, is a key element for keeping programs simple while enabling extensibility. A simple program in combination with a
|
becomes so much more than what the original author could have dreamed of.
The TTY subsystem is central to the design of Linux, and UNIX in general. Unfortunately, its importance is often overlooked, and it is difficult to find good introductory articles about it. I believe that a basic understanding of TTYs in Linux is essential for the developer and the advanced user.
"""
No no no. Don't use kill -9.
It doesn't give the process a chance to cleanly:
1) shut down socket connections
2) clean up temp files
3) inform its children that it is going away
4) reset its terminal characteristics
and so on and so on and so on.
Generally, send 15, and wait a second or two, and if that doesn't
work, send 2, and if that doesn't work, send 1. If that doesn't,
REMOVE THE BINARY because the program is badly behaved!
Don't use kill -9. Don't bring out the combine harvester just to tidy
up the flower pot.
"""
rappel sur les signaux: http://www.tutorialspoint.com/unix/unix-signals-traps.htm
"""
SIGHUP 1 Hang up detected on controlling terminal or death of controlling process
SIGINT 2 Issued if the user sends an interrupt signal (Ctrl + C).
SIGQUIT 3 Issued if the user sends a quit signal (Ctrl + D).
SIGFPE 8 Issued if an illegal mathematical operation is attempted
SIGKILL 9 If a process gets this signal it must quit immediately and will not perform any clean-up operations
SIGALRM 14 Alarm Clock signal (used for timers)
SIGTERM 15 Software termination signal (sent by kill by default).
"""
à lire
"""
That’s it! $(cat) is a shorthand for $(cat /dev/stdin), so presumably you can use this to read from stderr by pointing it at /dev/stderr.
"""
éditeur qui supporte bien l'édition de fichiers de taille énorme.
il n'essaye pas de charger en RAM tout le fichier mais il fait un memory map dessus.
l'outil du pauvre (quand on a pas la chance d'avoir mis en place un logstash, elastic, kibana) pour faire des stats en live sur des logs.
dans un genre un peu similaire, il y a peco: https://github.com/peco/peco
cet outil, codé en go, permet de filtrer les résultats d'une commande avec une facilité déconcertante. Voir les gifs sur le github.
petit hack pour éviter d'avoir à trifouiller les droits de /dev/pts/0 :
su - <user>
script /dev/null
screen
- chronic: runs a command quietly unless it fails
- combine: combine the lines in two files using boolean operations
- errno: look up errno names and descriptions
- ifdata: get network interface info without parsing ifconfig output
- ifne: run a program if the standard input is not empty
- isutf8: check if a file or standard input is utf-8
- lckdo: execute a program with a lock held
- mispipe: pipe two commands, returning the exit status of the first
- parallel: run multiple jobs at once
- pee: tee standard input to pipes
- sponge: soak up standard input and write to a file
- ts: timestamp standard input
- vidir: edit a directory in your text editor
- vipe: insert a text editor into a pipe
- zrun: automatically uncompress arguments to command
chronic est pratique, notamment pour les crons et la (non-)notification par mail
"Une introduction plaisante aux principes de base d’UNIX, avec des exemples et tout, pour amener plus de gens du côté clair de la force."
via http://www.gcu-squad.org/2014/04/unix-do-you-teach-it-motherfucker/