i v1.2 - get a lot of info about a file

Moderator: Forum moderators

Post Reply
User avatar
JakeSFR
Posts: 276
Joined: Wed Jul 15, 2020 2:23 pm
Been thanked: 159 times

i v1.2 - get a lot of info about a file

Post by JakeSFR »

A new toy.
This is a simple shell script to get a lot of info about files. But also dirs, why not.

i_cli.gif
i_cli.gif (518.18 KiB) Viewed 873 times

i can utilize the following commands:

  • file

  • xdg-mime

  • rox

  • df

  • lsblk

  • mountpoint

  • findmnt

  • losetup

  • find

  • ls

  • du

  • stat

  • getfacl

  • chacl

  • getfattr

  • lsattr

  • fatattr

  • exfatattrib

  • ntfssecaudit

  • lsof

  • smartctl

  • udevadm

  • fdisk

  • cryptsetup

  • dumpe2fs

  • btrfs

  • dosfsck

  • dump.exfat

  • dumpexfat

  • ntfscluster

  • ntfsinfo

  • xfs_info

  • dump.f2fs

  • qemu-img

  • filefrag

  • wc

  • feh

  • rdjpgcom

  • exiv2

  • gifsicle

  • tiffinfo

  • webpng

  • webpinfo

  • xcfinfo

  • xcur2png

  • fc-scan

  • ftdump

  • ogginfo

  • metaflac

  • sndfile-info

  • ffprobe

  • ctorrent

  • pdfinfo

  • pdfimages

  • pdffonts

  • pdfdetach

  • unzip

  • isoinfo

  • udfinfo

  • dpkg-deb

  • rpm

  • unsquashfs

  • wiminfo

  • btrfs-compsize

  • upx

  • gzip

  • xz

  • zstd

  • zipinfo

  • sqlite3

  • pgpdump

  • modinfo

  • readelf

  • objdump

  • ldd

i was meant as a pure CLI utility, but, as a measure of convenience, it also installs itself as a ROX and/or Thunar (needs to be restarted with thunar -q) right-click option.
When invoked this way, it uses a simple YAD GUI; otherwise a terminal will be used, as a fallback:

i_gui.gif
i_gui.gif (143 KiB) Viewed 873 times

Btw, the YAD GUI may freeze occasionally after clicking Close or X button.
In such a case, just give it 10 sec. or so, and it should go away eventually.

Program icon, as per usual, was created using @vovchik's excellent Pikona.
___________

Attached packages:

  • PET - for regular Puppies

  • XBPS - for Void-based Pups that use it (KLV, maybe others)

___________

Changelog

Version 1.2:
- added pgpdump (info about PGP signatures (.sig), keys (.asc, .pgp) and encrypted files (.gpg))
- added losetup (shows loop device(s) associated with a file)
- added udevadm (info about /dev devices)
- added qemu-img (info about QCOW(2)/VMDK/VDI images)
- added dumpe2fs (info about EXT partitions/images)
- added btrfs (info about BTRFS partitions/images)
- added dosfsck (info about FAT partitions/images)
- added dump.exfat and dumpexfat (info about EXFAT partitions/images)
- added ntfscluster and ntfsinfo (info about NTFS partitions/images - works only on unmounted devices!)
- added xfs_info (info about XFS partitions/images)
- added dump.f2fs (info about F2FS partitions/images)
- added smartclt (S.M.A.R.T. info from physical disks)
- bugfixes, improvements, refactoring

Version 1.1:
- added feh (basic info about images)
- added fdisk (info about disk images)
- added unzip (meta from ODF/OOXML documents)
- bugfixes, improvements, refactoring

Version 1.0:
- initial release

Have fun &
Greetings!

Attachments
i-1.2.pet
235d8795931507cc2de909e7aedd2ca5 i-1.2.pet
(13.04 KiB) Downloaded 21 times
i-1.2_1.noarch.xbps
35b0bcd57a824a23ace46906d9a138a6 i-1.2_1.noarch.xbps
(14.49 KiB) Downloaded 14 times
[O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
User avatar
Jasper
Posts: 2067
Joined: Wed Sep 07, 2022 1:20 pm
Has thanked: 854 times
Been thanked: 480 times

Re: i v1.0 - get a lot of info about a file

Post by Jasper »

@JakeSFR

Thanks for this :thumbup:

I tried to install the Xbps offering on VoidPup64 but my OS only gave me the option to 'extract' the application, so had to use the supplied Pet instead.

I was wondering if could view checksums (not all of them!!) too in a future update?

The attachment testing.jpg is no longer available
testing.jpg
testing.jpg (48.67 KiB) Viewed 745 times
User avatar
JakeSFR
Posts: 276
Joined: Wed Jul 15, 2020 2:23 pm
Been thanked: 159 times

Re: i v1.0 - get a lot of info about a file

Post by JakeSFR »

Jasper wrote: Sun Sep 15, 2024 12:14 pm

@JakeSFR

Thanks for this :thumbup:

Hey @Jasper, you're welcome!

I tried to install the Xbps offering on VoidPup64 but my OS only gave me the option to 'extract' the application, so had to use the supplied Pet instead.

Yeah, although VoidPup64 has xbps utilities pre-installed, apparently it doesn't use them for package management, unlike e.g. KLV-Airedale.

I was wondering if could view checksums (not all of them!!) too in a future update?

I was briefly considering checksums, but processing big files, like ISOs and videos, especially on HDD, would be painfully slow (times the number of checksums).
Besides, I'm not sure if it can be considered an info about a file, it's more like reductive scrambling of file's data.
So, it's not only for practical, but also philosophical reasons. ;)

Greetings!

[O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
User avatar
Jasper
Posts: 2067
Joined: Wed Sep 07, 2022 1:20 pm
Has thanked: 854 times
Been thanked: 480 times

Re: i v1.0 - get a lot of info about a file

Post by Jasper »

No worries :lol: ........... already installed and in using it.

Another simple and effective tool :thumbup2:

User avatar
rockedge
Site Admin
Posts: 6547
Joined: Mon Dec 02, 2019 1:38 am
Location: Connecticut,U.S.A.
Has thanked: 2749 times
Been thanked: 2626 times
Contact:

Re: i v1.0 - get a lot of info about a file

Post by rockedge »

@JakeSFR

Excellent work!

This is a good utility script so I will install i into KLV-Airedale and KLV-Spectr as a default utility during the next upgrade cycle. After short time of using it in KLV-Boxer, and after getting used it being available, I realized it is quite a handy tool to have onboard.

Thanks :thumbup:

User avatar
wiak
Posts: 4082
Joined: Tue Dec 03, 2019 6:10 am
Location: Packing - big job
Has thanked: 65 times
Been thanked: 1208 times
Contact:

Re: i v1.0 - get a lot of info about a file

Post by wiak »

Very nice utility

Wish my never-ending house build issues would finish so I could get back into all this in even partly focussed way. But been sick with fever for a week and was in middle of two back to back major tropical cyclones so landslides and floods all around and every roof leaking. Didnt help that I accidentally left car window open after driving through flood one rainy night... Clearly I need a wee Linux box in the car and another few on our property with sensors and detectors for all potential issues including security. So much to do that could be done using specially crafted forum distros... Yad makes great front ends. I also need to figure out how to connect everything up when plot is more than 100m long and sometimes 50m wide and is more like a lake with various small rivers running through it at the moment. Relying a lot on solar but no sun means lithium device batteries long discharged. Interesting project scenarios, but too busy just surviving the loss of municipal water supply, often whole day electricity brownouts, and the countless leaks and flooded access roads. Funnily enough the fibre internet strung on flimsy poles through trees continues to work with help of lead acid battery based UPS with AVR connected to the modem... Back now to my coffee - like an ostrich I am hiding my head in the sandy surrounds of a nearby beach resort cafe that has reliable facilities including diesel backup generators and Elon Musk Starlink...

I should get stemsee to help me build an Ark instead of the house.

https://www.tinylinux.info/
DOWNLOAD wd_multi for hundreds of 'distros' at your fingertips: viewtopic.php?p=99154#p99154
Αξίζει να μεταφραστεί;

User avatar
JakeSFR
Posts: 276
Joined: Wed Jul 15, 2020 2:23 pm
Been thanked: 159 times

Re: i v1.0 - get a lot of info about a file

Post by JakeSFR »

Thanks guys, glad you like it!
I wasn't entirely sure myself if it's actually useful, or if it's just a gimmick, but as it turned out, I've also been using it quite often since the inception.

@wiak: oh man... Hope the bad streak is over soon, and good luck with your future endeavours. :thumbup:

Greetings!

[O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
User avatar
JakeSFR
Posts: 276
Joined: Wed Jul 15, 2020 2:23 pm
Been thanked: 159 times

Re: i v1.1 - get a lot of info about a file

Post by JakeSFR »

Version 1.1:

- added feh (basic info about images)
- added fdisk (info about disk images)
- added unzip (meta from ODF/OOXML documents)
- bugfixes, improvements, refactoring

First post updated.

Greetings!

[O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
User avatar
rockedge
Site Admin
Posts: 6547
Joined: Mon Dec 02, 2019 1:38 am
Location: Connecticut,U.S.A.
Has thanked: 2749 times
Been thanked: 2626 times
Contact:

Re: i v1.1 - get a lot of info about a file

Post by rockedge »

JakeSFR wrote: Fri Sep 20, 2024 6:27 pm

Version 1.1:

- added feh (basic info about images)
- added fdisk (info about disk images)
- added unzip (meta from ODF/OOXML documents)
- bugfixes, improvements, refactoring

First post updated.

Greetings!

After just assembling KLV-Airedale-sr15 I see these great additions so now I will add this in and repackage the entire distro. Good stuff..... :geek: :thumbup:

User avatar
JakeSFR
Posts: 276
Joined: Wed Jul 15, 2020 2:23 pm
Been thanked: 159 times

Re: i v1.2 - get a lot of info about a file

Post by JakeSFR »

Thanks @rockedge. :)
___________

Version 1.2:

- added pgpdump (info about PGP signatures (.sig), keys (.asc, .pgp) and encrypted files (.gpg))
- added losetup (shows loop device(s) associated with a file)
- added udevadm (info about /dev devices)
- added qemu-img (info about QCOW(2)/VMDK/VDI images)
- added dumpe2fs (info about EXT partitions/images)
- added btrfs (info about BTRFS partitions/images)
- added dosfsck (info about FAT partitions/images)
- added dump.exfat and dumpexfat (info about EXFAT partitions/images)
- added ntfscluster and ntfsinfo (info about NTFS partitions/images - works only on unmounted devices!)
- added xfs_info (info about XFS partitions/images)
- added dump.f2fs (info about F2FS partitions/images)
- added smartclt (S.M.A.R.T. info from physical disks)
- bugfixes, improvements, refactoring

First post updated.

Greetings!

[O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
User avatar
MochiMoppel
Posts: 1236
Joined: Mon Jun 15, 2020 6:25 am
Location: Japan
Has thanked: 21 times
Been thanked: 439 times

Re: i v1.2 - get a lot of info about a file

Post by MochiMoppel »

@JakeSFR Maybe OT here but I ask anyway because I'm curious about your comment in line 260:
# BB tr doesn't support [[:array:]], but (BB) sed does (needs LANG=C to also weed out Unicode, though)

Yes, BB tr doesn't support character classes but it supports range expressions within bracket expressions, so instead of
magic="$(head -c 12 -- "$1" 2>/dev/null | tr '\0' ' ' | LANG=C sed 's/[^[:print:]]/ /g')"

this also seems to work:
magic="$(head -c 12 -- "$1" 2>/dev/null | tr -c '[^ -~]' ' ')"
May even work without setting the locale to C (as the Bash manual recommends) because tr might use C as default
As in your code in case of Unicode each byte is replaced by a space.

User avatar
JakeSFR
Posts: 276
Joined: Wed Jul 15, 2020 2:23 pm
Been thanked: 159 times

Re: i v1.2 - get a lot of info about a file

Post by JakeSFR »

@MochiMoppel:

Code: Select all

# for i in {0..1023}; do printf "\U$(printf %x $i)" | tr '\0' ' ' | LANG=C sed 's/[^[:print:]]/ /g'; done | hd
00000000  20 20 20 20 20 20 20 20  20 20 0a 20 20 20 20 20  |          .     |
00000010  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000020  20 21 22 23 24 25 26 27  28 29 2a 2b 2c 2d 2e 2f  | !"#$%&'()*+,-./|
00000030  30 31 32 33 34 35 36 37  38 39 3a 3b 3c 3d 3e 3f  |0123456789:;<=>?|
00000040  40 41 42 43 44 45 46 47  48 49 4a 4b 4c 4d 4e 4f  |@ABCDEFGHIJKLMNO|
00000050  50 51 52 53 54 55 56 57  58 59 5a 5b 5c 5d 5e 5f  |PQRSTUVWXYZ[\]^_|
00000060  60 61 62 63 64 65 66 67  68 69 6a 6b 6c 6d 6e 6f  |`abcdefghijklmno|
00000070  70 71 72 73 74 75 76 77  78 79 7a 7b 7c 7d 7e 20  |pqrstuvwxyz{|}~ |
00000080  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00000780

Code: Select all

# for i in {0..1023}; do printf "\U$(printf %x $i)" |  tr -c '[^ -~]' ' '; done | hd
00000000  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00000020  20 21 22 23 24 25 26 27  28 29 2a 2b 2c 2d 2e 2f  | !"#$%&'()*+,-./|
00000030  30 31 32 33 34 35 36 37  38 39 3a 3b 3c 3d 3e 3f  |0123456789:;<=>?|
00000040  40 41 42 43 44 45 46 47  48 49 4a 4b 4c 4d 4e 4f  |@ABCDEFGHIJKLMNO|
00000050  50 51 52 53 54 55 56 57  58 59 5a 5b 5c 5d 5e 5f  |PQRSTUVWXYZ[\]^_|
00000060  60 61 62 63 64 65 66 67  68 69 6a 6b 6c 6d 6e 6f  |`abcdefghijklmno|
00000070  70 71 72 73 74 75 76 77  78 79 7a 7b 7c 7d 7e 20  |pqrstuvwxyz{|}~ |
00000080  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00000780

Yep, seems to work identical, except that it also weeds out newlines, which is good.

Nice find, I'll use it in next version, thanks!

Greetings!

[O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
Post Reply

Return to “Utilities”