Analisi struttura directory

[root@localhost ~]# tree -dugp /etc/systemd/ /etc/systemd/ ├── [drwxr-xr-x root     root    ]  system │   ├── [drwxr-xr-x root     root    ]  basic.target.wants │   ├── [drwxr-xr-x root     root    ]  default.target.wants │   ├── [drwxr-xr-x root     root    ]  dev-virtio\\x2dports-org.qemu.guest_agent.0.device.wants │   ├── [drwxr-xr-x root     root    ]  getty.target.wants …
Continua a leggere Analisi struttura directory

Trovare file con nome differente da pattern

Per trovare tutti i file in una data directory con nome differente da un certo pattern usare il seguente comando: find . -not -name *.txt L’esempio cercherà nella directory corrente, ed in tutte le sottodirectory, tutti i file che non terminano con *.txt

Percentuale occupazione filesystem

Per estrapolare la percentuale di occupazione di un filesystem ed il relativo mountpoint usare il comando: df | grep -vE ‘^Filesystem|tmpfs|fileserver|devtmpfs’ | awk ‘{print $5 ” ” $1}’ Bozza di sctipt per il controllo automatizzato della percentuale di uso del fs: #!/bin/sh df -H | grep -vE ‘^Filesystem|tmpfs|fileserver|devtmpfs|cdrom’ | awk ‘{ print $5 ” ” …
Continua a leggere Percentuale occupazione filesystem

Trovare file creati prima di n giorni

Per trovare tutti i file creati prima di un certo numero di giorni usare il comando: find . -type f -ctime <n giorni> -ls More than 30 days ago: -ctime +30 Less than 30 days ago: -ctime -30 Exactly 30 days ago: -ctime 30 Nota dalla pagina man di find: “n*24 hours ago. When find figures out how …
Continua a leggere Trovare file creati prima di n giorni