892 private links
If you want to run or update a task when certain files are updated, the
make
utility can come in handy. Themake
utility requires a file,Makefile
(ormakefile
), which defines set of tasks to be executed. You may have usedmake
to compile a program from source code. Most open source projects usemake
to compile a final executable binary, which can then be installed usingmake install
.In this article, we'll explore
make
andMakefile
using basic and advanced examples. Before you start, ensure thatmake
is installed in your system.
J'ai régulièrement le besoin d'écrire des scripts shell un peu évolués. Il y a quelques mois, j'ai commencé à travailler sur un modèle que je met régulièrement à jour. Aujourd'hui, j'ai travaillé sur la couche pour gérer les logs et c'est pourquoi j'écris cet article.
Ce modèle contient les fonctions
usage
ethelp
pour décrire le fonctionnement du programme. La fonctionon_interrupt
permet de gérer le signalSIGINT
quand le programme est interrompu.La fonction
main
est la fonction qui contient le code principal du script. Elle contient la gestion des paramètres passés au script. Par défaut, plusieurs y sont déjà intégrés :-l
pour définir le niveau de log désiré et-h
pour afficher l'aide.Enfin, il y a la fonction
log
pour afficher des messages de debug avec différents niveaux de criticité. Cela permet de générer des messages qui seront affichés ou pas selon les besoins. Les messages sont colorés selon le niveau de criticité et ils sont redirigés versstderr
. Il est Ă©galement possible d'ajouter la date.
neutre='\e[0;m'
noir='\e[0;30m'
gris='\e[1;30m'
rougefonce='\e[0;31m'
rose='\e[1;31m'
vertfonce='\e[0;32m'
vertclair='\e[1;32m'
orange='\e[0;33m'
jaune='\e[1;33m'
bleufonce='\e[0;34m'
bleuclair='\e[1;34m'
violetfonce='\e[0;35m'
violetclair='\e[1;35m'
cyanfonce='\e[0;36m'
cyanclair='\e[1;36m'
grisclair='\e[0;37m'
blanc='\e[1;37m'
normal='\033[0m'
gras='\033[1m'
fin='\033[2m'
italic='\033[3m'
souligne='\033[4m'
flash='\033[5m'
inverse='\033[7m'
invisible='\033[8m'
echo -e "${rougefonce}Hello${neutre} ${jaune}World${neutre}"
echo -e "${gras}Hello${normal} ${flash}World${normal}"
Create a custom PS1 variable for your Bash
On trouvera dans ce chapitre une initiation pratique au scripting Bash.
Les sections qui suivent dans ce chapitre s’inspirent notamment du livre Scripts shell Linux et Unix de Christophe Blaess qu’il est conseillé d’acquérir. L’ouvrage est orienté embarqué mais convient parfaitement pour un apprentissage précis, rapide, intéressant et dynamique.
Mise à jours en 07/2023 de mon installation d'Arch Linux avec quelques nouveautés en particulier la prise en charge de snapshot avec BTRFS, modification container luks2, ajout kernel linux-zen, bureau hyprland.
Voila sur quoi je travail sur ma nouvelle installation d'Arch Linux en mode dev dans une VM sous Proxmox, avant de déployer sur mon thinkpad Helix. Tout fonctionne pour l'instant jusqu'à l'installation du bureau hyprland.
An A-Z Index of the Apple macOS command line (macOS bash)
The AWK command dates back to the early Unix days. It is part of the POSIX standard and should be available on any Unix-like system. And beyond.
While sometimes discredited because of its age or lack of features compared to a multipurpose language like Perl, AWK remains a tool I like to use in my everyday work. Sometimes for writing relatively complex programs, but also because of the powerful one-liners you can write to solve issues with your data files.
This document is a collection of Unix/Linux/BSD commands and tasks which are useful for IT work or for advanced users. This is a practical guide with concise explanations, however the reader is supposed to know what s/he is doing.
The Bash
read
command is a built-in utility that reads text from standard input. The tool offers many functionalities for reading user input, helping make Bash scripts interactive.
A Shell script usually needs to test if a command succeeds or a condition is met. In Bash, this test can be done with a Bash if statement. As with any other programming language, Bash comes with conditional expressions that allow you to test for conditions and alter the control flow if the condition is satisfied or not.
This post covers the bash if statement and the related clauses then, else if (elif), and else.
The .bashrc is a standard file located in your Linux home directory.
In this article I will show you useful .bashrc options, aliases, functions, and more.
nmcli dev status
nmcli radio wifi
nmcli radio wifi on
nmcli dev wifi list
sudo nmcli dev wifi connect network-ssid password "network-password"
sudo nmcli --ask dev wifi connect network-ssid
nmcli con show
nmcli con down ssid/uuid
nmcli con up ssid/uuid
From this article you’ll learn how to measure an input/output performance of a file system on such devices as HDD, SSD, USB Flash Drive etc.
mpv --ao=null --vo=image --start=0:1:44.25 --end=0:1:46.6 GUEZCxBcM78.mp4
i=1
for f in 000*.jpg; do
convert -evaluate-sequence Min ${a[@]} $f $f
[[ $((i%7)) == 0 ]] && a=(${a[@]} $f)
i=$((i+1))
l=$f
done
echo 0001{00..50}.jpg |xargs -n1 ln -s $l
cat 000*.jpg |ffmpeg -y -f mjpeg -i - -c:v libx264 -r 24 -pix_fmt yuv420p skier.mp4
If you have burned a live Linux image that must be bootable
drutil -drive 1 erase full
Expanding files, parameters, or the history using Zsh is the fastest way to get quickly what you want, without writing boring scripts.
Character | File Type |
---|---|
- |
Regular file |
b |
Block special file |
c |
Character special file |
C |
High performance ("contiguous data") file |
d |
Directory |
D |
Door (special IPC file in Solaris 2.5+ only) |
l |
Symbolic link |
M |
Off-line ("migrated") file (Cray DMF) |
n |
Network special file (HP-UX) |
p |
FIFO (named pipe) |
P |
Port (special system file in Solaris 10+ only) |
s |
Socket |
? |
Some other file type |
Le Mongo Shell permet d'effectuer des opérations sur sa base de données MongoDB plus rapidement Découvrez les commandes Mongo Shell à connaître
Bash contains features that appear in other popular shells, and some features that only appear in Bash. Some of the shells that Bash has borrowed concepts from are the Bourne Shell (sh), the Korn Shell (ksh), and the C-shell (csh and its successor, tcsh). The following menu breaks the features up into categories, noting which features were inspired by other shells and which are specific to Bash.
This manual is meant as a brief introduction to features found in Bash. The Bash manual page should be used as the definitive reference on shell behavior.