msgbartop
Blog di Bernardino (Dino) Ciuffetti
msgbarbottom

10 Dic 19 How to view files and directory name representration as a tree on linux

There is a cool command on linux that can be used to view directories and files in a cool tree way, this is called tree.

Try this one:

tree -shugaDFC --du

You hopefully get something formatted like this:

.
├── [root     root       40 Dec 10 11:38]  .font-unix/
├── [root     root       80 Dec 10 11:39]  .ICE-unix/
│   ├── [Debian-gdm Debian-gdm    0 Dec 10 11:38]  2040=
│   └── [dino     dino        0 Dec 10 11:39]  2530=
├── [dino     dino        0 Dec 10 11:51]  opensc-debug.log
├── [root     root       40 Dec 10 11:38]  pulse-PKdhtXMmr18n/
├── [root     root        0 Dec 10 11:38]  SemFetchAndIncSem
├── [dino     dino       60 Dec 10 11:39]  ssh-Lu1SMknjwYCh/
│   └── [dino     dino        0 Dec 10 11:39]  agent.2530=
├── [root     root      140 Dec 10 11:38]  systemd-private-6ca1b00e83794d86a258dafff95a5ade-apache2.service-LGtMHO/
│   └── [root     root       80 Dec 10 11:38]  tmp/
│       ├── [root     root        0 Dec 10 11:38]  access_log
│       └── [root     root        0 Dec 10 11:38]  error_log
├── [root     root      100 Dec 10 11:39]  systemd-private-6ca1b00e83794d86a258dafff95a5ade-bolt.service-uuY7ay/
│   └── [root     root       40 Dec 10 11:39]  tmp/
├── [root     root      100 Dec 10 11:38]  systemd-private-6ca1b00e83794d86a258dafff95a5ade-colord.service-8gsnRd/
│   └── [root     root       40 Dec 10 11:38]  tmp/
├── [root     root      100 Dec 10 11:39]  systemd-private-6ca1b00e83794d86a258dafff95a5ade-fwupd.service-6puu9X/
│   └── [root     root       40 Dec 10 11:39]  tmp/
├── [root     root      100 Dec 10 11:38]  systemd-private-6ca1b00e83794d86a258dafff95a5ade-minissdpd.service-BJBYoN/
│   └── [root     root       40 Dec 10 11:38]  tmp/
├── [root     root      100 Dec 10 11:38]  systemd-private-6ca1b00e83794d86a258dafff95a5ade-ModemManager.service-T2ih67/
│   └── [root     root       40 Dec 10 11:38]  tmp/
├── [root     root      100 Dec 10 11:38]  systemd-private-6ca1b00e83794d86a258dafff95a5ade-ntp.service-DWl6NV/
│   └── [root     root       40 Dec 10 11:38]  tmp/
├── [root     root      100 Dec 10 11:38]  systemd-private-6ca1b00e83794d86a258dafff95a5ade-rtkit-daemon.service-B5JIPO/
│   └── [root     root       40 Dec 10 11:38]  tmp/
├── [root     root      100 Dec 10 11:38]  systemd-private-6ca1b00e83794d86a258dafff95a5ade-systemd-resolved.service-N3OP1K/
│   └── [root     root       40 Dec 10 11:38]  tmp/
├── [root     root      100 Dec 10 11:38]  systemd-private-6ca1b00e83794d86a258dafff95a5ade-upower.service-1MLpQa/
│   └── [root     root       40 Dec 10 11:38]  tmp/
├── [dino     dino       40 Dec 10 12:38]  Temp-78a83a1b-0d23-4bb2-b176-e7ae54b4b2d6/
├── [dino     dino       40 Dec 10 12:38]  Temp-897559cc-50ea-4ac1-b4da-780a5864e32c/
├── [dino     dino       40 Dec 10 11:52]  Temp-a7dd7308-8df0-42b3-9188-6ce51c3da1de/
├── [root     root       40 Dec 10 11:38]  .Test-unix/
├── [dino     dino       40 Dec 10 11:39]  tracker-extract-files.1000/
├── [root     root       80 Dec 10 11:39]  .X11-unix/
│   ├── [Debian-gdm Debian-gdm    0 Dec 10 11:38]  X0=
│   └── [dino     dino        0 Dec 10 11:39]  X1=
└── [root     root       40 Dec 10 11:38]  .XIM-unix/

 2.0K used in 31 directories, 9 files

If you get an error like command not found: tree then you have to install the tree package. For example, on debian/ubuntu:

apt install tree

You can experiment with tree alone or using different switches.

Lascia un commento

*