Are general linux questions permitted here that may not be specific to Manjaro only? If so, the question follows; if not, please let me know and I’ll delete it or please do so. Thank you.
I’m trying to sort files in Tcl using glob and lsort (which works alone) and then get the mime type for all this files at once using file --brief --mime-type .... I can do it one file at a time while looping through the list from glob but that is pretty slow; around 10 seconds for a directory of 250 files. It appears quicker in the CLI to use file --brief --mime-type *. I’m trying this in Tcl which took a bit to figure out to pass file a list of files.
This example works and is fairly quick (better than running file once for each file; but it is still pretty slow when there are a lot of images, audio files, and PDFs (especially those made up of image scans rather than a “real” text PDF).
My question is, Is there any way to speed it up? I’m sure the slow point is the file command because I wrote the same code and used the extension to guess the mime type and it is almost
instantly completed, to the eye anyway, where using file can take 15 seconds.
Could using --exclude with one or more of its options help? I do not need to identify less common files types.
Dolphin appears to handle this rather quickly; so, I must be doing something wrong. I noticed also that the second time I try to load a directory–say one that took 15 or more seconds the first time–it’ll load in about 2 seconds or less thereafter. Is the type cached somewhere?
Thank you.
cd $dir
set sep " "
set l [lsort -dictionary [glob -nocomplain *]]
set m [exec file --brief --mime-type --separator $sep {*}$l]
foreach f $l t $m {
puts "$f $t"
}
You might be better off using the mimetype command, as you can run the command on a list of filenames. For example, I just ran ls > test.txt on a directory with some pictures I’ve downloaded today to create a list of file names, and then ran the following command:
❯ mimetype --help
Usage:
mimetype [options] [-] files
Options:
-a, --all
Show output of all rules that match the file.
TODO: this method now just returns one match for each method (globs,
magic, etc.).
-b, --brief
Do not prepend filenames to output lines (brief mode).
--database=mimedir:mimedir:...
Force the program to look in these directories for the shared
mime-info database. The directories specified by the basedir
specification are ignored.
-d, --describe
Print file descriptions instead of mime types, this is the default
when using "--file-compat".
-D, --debug
Print debug information about how the mimetype was determined.
-f namefile, --namefile=namefile
Read the names of the files to be examined from the file 'namefile'
(one per line) before the argument list.
--file-compat
Make mimetype behave a little more file(1) compatible. This is
turned on automatically when you call mimetype by a link called
'file'.
A single '-' won't be considered a separator between options and
filenames anymore, but becomes identical to "--stdin". ( You can
still use '--' as separator, but that is not backward compatible
with the original file command. ) Also the default becomes to print
descriptions instead of mimetypes.
-F string, --separator=string
Use string as custom separator between the file name and its
mimetype or description, defaults to ':' .
-h, --help
-u, --usage
Print a help message and exits.
-i, --mimetype
Use mime types, opposite to "--describe", this is the default when
_not_ using "--file-compat".
-L, --dereference
Follow symbolic links.
-l code, --language=code
The language attribute specifies a two letter language code, this
makes descriptions being outputted in the specified language.
-M, --magic-only
Do not check for extensions, globs or inode type, only look at the
content of the file. This is particularly useful if for some reason
you don't trust the name or the extension a file has.
-N, --noalign
Do not align output fields.
--output-format
If you want an alternative output format, you can specify a format
string containing the following escapes:
%f for the filename
%d description
%m mime type
Alignment is not available when using this, you need to post-process
the output to do that.
--stdin
Determine type of content from STDIN, less powerful then normal file
checking because it only uses magic typing. This will happen also if
the STDIN filehandle is a pipe.
To use this option IO::Scalar needs to be installed.
-v, --version
Print the version of the program and exit.
Thank you. I tried this yesterday but while still calling it for each file separately while looping through the glob results; and it appeared a little slower that file. So, I didn’t even try it this time.
However, after your post, I just tried it while passing the list of files from glob and it appears much quicker. So far, no directory has taken more than a second or two to load. That’s from the time the button is clicked in the UI until the data appears in the table.
If it remains at those times, this will work great and must far more reliable than my guessing based on the extension.
I am not proficient in bash nor tcl - but since you ask - you could try to time the commands - install the time package
The script takes a path or it starts where you saved it.
It will traverse the folder structure and sort the files by mime type and the relative path to the script
Then run the script time list-mime-types.py
import os
import sys
import mimetypes
from collections import defaultdict
def list_files_by_mime_type(folder_path: str = ".") -> None:
if not os.path.isdir(folder_path):
print(f"Error: '{folder_path}' is not a valid directory.", file=sys.stderr)
sys.exit(1)
mime_groups: dict[str, list[str]] = defaultdict(list)
for root, _, files in os.walk(folder_path):
for filename in files:
filepath = os.path.join(root, filename)
mime_type, _ = mimetypes.guess_type(filepath)
if mime_type is None:
mime_type = "application/octet-stream"
rel_path = os.path.relpath(filepath, folder_path)
mime_groups[mime_type].append(rel_path)
sorted_mime_types = sorted(mime_groups.keys())
for mime_type in sorted_mime_types:
files = mime_groups[mime_type]
print(f"\n{mime_type}:")
print("-" * len(mime_type))
for f in sorted(files):
print(f" {f}")
total_files = sum(len(files) for files in mime_groups.values())
print(f"\numFiles: {total_files}")
print(f"Unique MIME types: {len(mime_groups)}")
if __name__ == "__main__":
folder = sys.argv[1] if len(sys.argv) > 1 else "."
list_files_by_mime_type(folder)
The script is pretty fast
09:57:38 ○ [fh@tiger] (py: .venv) .../2026/sort-folder-by-mime-type
$ time python main.py /home/fh/Documents
application/epub+zip:
--------------------
Calibre Library/Entity_Framework_Core_in_Action_Second_.epub
Calibre Library/John Schember/Quick Start Guide (1)/Quick Start Guide - John Schember.epub
Calibre Library/Jon P Smith/Entity Framework Core in Action, Second Edition (2)/Entity Framework Core in Action, Second Ed - Jon P Smith.epub
Calibre Library/VAGTTARNET/Ny Verden-Oversaettelsen (nwt-D) (6)/Ny Verden-Oversaettelsen (nwt-D) - VAGTTARNET.epub
Calibre Library/nwt_D.epub
application/json:
----------------
AL/GeneratedProject1/.vscode/launch.json
AL/GeneratedProject1/app.json
Calibre Library/metadata_db_prefs_backup.json
Zettlr Tutorial/references.json
kwin-scripts/KZones.json
application/octet-stream:
------------------------
Calibre Library/.calnotes/notes.db
Calibre Library/metadata.db
Install Win11 using libvirt
brother/01.0108.9999.lbx
brother/01.0136.9999.lbx
brother/01.0635.6100.lbx
brother/linux-brprinter-installer-2.2.3-1.gz
gimp/duck-866x866.xcf
gimp/hukommelse.xcf
gimp/hundewadt-dk-header.xcf
gimp/illyria-default-main-light-corner-logo-orange.xcf
gimp/image_proxy_white_red_border.xcf
gimp/inno-demo.xcf
gimp/ko-fi-banner.xcf
gimp/ko-fi-cover.xcf
gimp/linux-aarhus-site-banner-1200x225.xcf
gimp/linux-aarhus.xcf
gimp/linux-laptops-logo.xcf
gimp/manjaro-archive-banner.xcf
gimp/manjaro-archive.xcf
gimp/manjaro-text-bright-blue.xcf
gimp/openbox-default-blue.xcf
gimp/openbox-illyria2.xcf
gimp/openbox-logo-res-300.xcf
gimp/openbox-logo-res-600-bright-blue.xcf
gimp/openbox-logo-res-600-bright-maia.xcf
gimp/openbox-logo-res-600-bright-yellow.xcf
gimp/openbox-logo-res-600-orange.xcf
gimp/openbox-logo-res-600.xcf
gimp/openbox-logo.xcf
gimp/openbox.xcf
gimp/pacbang-cover.xcf
gimp/pacbang-logo.xcf
gimp/pacbang-logo.xcf.xcf
gimp/smoke_hood_silhouette_128612_1920x1080.xcf
gimp/splash.new.xcf
gimp/ubuntu-aarhus-group-banner.xcf
kwin-scripts/floating-tiles-v7.0.kwinscript
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/nitro-min-getTrackingCode
noir-city-by-eddie-mendoza-cropped-4383x2996.xcf
ved-lunden-11/foreløbig vurdering
application/oebps-package+xml:
-----------------------------
Calibre Library/John Schember/Quick Start Guide (1)/metadata.opf
Calibre Library/Jon P Smith/Entity Framework Core in Action, Second Edition (2)/metadata.opf
Calibre Library/VAGTTARNET/Ny Verden-Oversaettelsen (nwt-D) (6)/metadata.opf
Calibre Library/Vladimir Pecanac;Marinko Spasojevic/Mastering ASP.NET Core Security (4)/metadata.opf
Calibre Library/Vladimir Pecanac;Marinko Spasojevic/The HTTP Reference Tables (5)/metadata.opf
Calibre Library/Vladimir Pecanac;Marinko Spasojevic/Ultimate ASP.NET Core Web API (3)/metadata.opf
application/pdf:
---------------
Calibre Library/Vladimir Pecanac;Marinko Spasojevic/Mastering ASP.NET Core Security (4)/Mastering ASP.NET Core Security - Vladimir Pecanac;Marinko Spasojevic.pdf
Calibre Library/Vladimir Pecanac;Marinko Spasojevic/The HTTP Reference Tables (5)/The HTTP Reference Tables - Vladimir Pecanac;Marinko Spasojevic.pdf
Calibre Library/Vladimir Pecanac;Marinko Spasojevic/Ultimate ASP.NET Core Web API (3)/Ultimate ASP.NET Core Web API - Vladimir Pecanac;Marinko Spasojevic.pdf
Calibre Library/fjernvarme-servitut.pdf
PDFs/Automation-at-the-edge-ebook-Red-Hat-Developer.pdf
PDFs/Choose-an-automation-tool-ebook-Red-Hat-Developer.pdf
PDFs/Enhance-security-with-automation-ebook-Red-Hat-Developer.pdf
PDFs/GitOps-Cookbook-Red-Hat-Developer-ebook.pdf
PDFs/Podman-in-Action-ebook-FINAL-Red-Hat-Developer.pdf
PDFs/The-Modern-Developer-ebook-Red-Hat-Developer.pdf
PDFs/The-cost-of-human-error-automation-ebook-Red-Hat-Developer.pdf
PDFs/cl-oreilly-kubernetes-operators-ebook-f21452-202001-en_2.pdf
PDFs/osdc_cheatsheet-networking-2021.4.8.pdf
Zettlr Tutorial/LaTeX Guide.pdf
frede-h-nødkontakt.pdf
radeon-ai-pro-rocm-pytorch-guide.pdf
regnskab/74aeae16-79ef-4cbf-8e99-236a3f206d5b.pdf
regnskab/Faktura 410223-2.pdf
regnskab/Frede 26.02.2026 - 26.02.2026.pdf
server-2019-essentials-2610358.pdf
ved-lunden-11/2025-08-13 08-40.pdf
ved-lunden-11/BR18 ansøgningsskema.pdf
ved-lunden-11/D2025-277320 LOVLIGGØRENDE BYGGETILLADELSE, Ved Lunden 11, 8230 Åbyhøj - Lovliggørelse af sekundært byggeri ddb383b5-c3b1-4fdd-a81e-08707a83aaa9.pdf
ved-lunden-11/D2025-277343 Erklæring vedr. det færdige byggeri 8431b8b0-f3da-48c1-b5aa-77d28d97688b.pdf
ved-lunden-11/bbr-rettelse-2023.pdf
ved-lunden-11/brev-ejendomsvurdering-24-05-31.pdf
ved-lunden-11/ved-lunden-11-lovliggørelse-af-carport-og-udhus.pdf
application/sql:
---------------
HeidiSQL/crmdb.sql
application/vnd.debian.binary-package:
-------------------------------------
brother/hll8260cdwcupswrapper-1.5.0-0.i386.deb
brother/hll8260cdwlpr-1.5.0-0.i386.deb
application/vnd.oasis.opendocument.spreadsheet:
----------------------------------------------
regnskab/bil-afgift-beregning.ods
regnskab/budget-test.ods
ved-lunden-11/ved-lunden-11-sekundære-bygninger.ods
application/vnd.oasis.opendocument.spreadsheet-template:
-------------------------------------------------------
regnskab/budget-skabelon.ots
application/vnd.oasis.opendocument.text:
---------------------------------------
doc/blinken-ligths.odt
doc/leipzig-gothic-letters.odt
regnskab/gavebrev.odt
ved-lunden-11/oversigt-13ao-aby.odt
ved-lunden-11/ægtepagt-testamente-kladde.odt
application/vnd.openxmlformats-officedocument.wordprocessingml.document:
-----------------------------------------------------------------------
Nødkontakt.docx
doc/guitar-fretboard.docx
application/x-sh:
----------------
scripted-installer.sh
application/x-tar:
-----------------
manuals/support-07AB-1681730049562.tgz
application/xhtml+xml:
---------------------
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/a.xhtml
application/zip:
---------------
Calibre Library/EfCoreinAction-SecondEdition-master.zip
forum-archive/user_archive-linux-aarhus-220307-072759-36.zip
forum-archive/user_archive-linux-aarhus-230909-142928-76.zip
forum-archive/user_archive-linux-aarhus-240526-080545-107.zip
forum-archive/user_archive-linux-aarhus-241231-051855-127.zip
manuals/N141WU_SM.zip
ved-lunden-11/Attachments-Lovliggørende byggetilladelse - Lovliggørelse af sekundært byggeri på adressen Ved Lunden 11, 8230 Åbyhøj - sagsnr. S2025-10822.zip
image/gif:
---------
bits-and-bytes-converter/bits-and-bytes-converter_files/FlaggeDe.gif
bits-and-bytes-converter/bits-and-bytes-converter_files/FlaggeUK-SW.gif
bits-and-bytes-converter/bits-and-bytes-converter_files/Pfeil03Links.gif
bits-and-bytes-converter/bits-and-bytes-converter_files/Pfeil03Rechts.gif
bits-and-bytes-converter/bits-and-bytes-converter_files/Pfeil03Top.gif
bits-and-bytes-converter/bits-and-bytes-converter_files/Tontechnik-Rechner.gif
bits-and-bytes-converter/bits-and-bytes-converter_files/background57.gif
bits-and-bytes-converter/data-transfer-calculator_files/FlaggeDe.gif
bits-and-bytes-converter/data-transfer-calculator_files/FlaggeUK-SW.gif
bits-and-bytes-converter/data-transfer-calculator_files/Pfeil03Links.gif
bits-and-bytes-converter/data-transfer-calculator_files/Pfeil03Rechts.gif
bits-and-bytes-converter/data-transfer-calculator_files/Pfeil03Top.gif
bits-and-bytes-converter/data-transfer-calculator_files/Tontechnik-Rechner.gif
bits-and-bytes-converter/data-transfer-calculator_files/background57.gif
image/jpeg:
----------
Calibre Library/John Schember/Quick Start Guide (1)/cover.jpg
Calibre Library/Jon P Smith/Entity Framework Core in Action, Second Edition (2)/cover.jpg
Calibre Library/VAGTTARNET/Ny Verden-Oversaettelsen (nwt-D) (6)/cover.jpg
Calibre Library/Vladimir Pecanac;Marinko Spasojevic/Mastering ASP.NET Core Security (4)/cover.jpg
Calibre Library/Vladimir Pecanac;Marinko Spasojevic/The HTTP Reference Tables (5)/cover.jpg
Calibre Library/Vladimir Pecanac;Marinko Spasojevic/Ultimate ASP.NET Core Web API (3)/cover.jpg
image/png:
---------
Zettlr Tutorial/zettlr.png
forum-archive/hurt-feelings-complaint-form.png
gimp/duck-512x512.png
gimp/g83.png
gimp/hukommelse.png
gimp/hundewadt-dk-header.png
gimp/inno-demo.png
gimp/innotec-servicepack-download.png
gimp/kender-du-det.png
gimp/ko-fi-banner.png
gimp/ko-fi-cover.png
gimp/linux-laptops-logo.png
gimp/locale-settings.png
gimp/makepkg-aur-pamac-cli.png
gimp/manjaro-archive-banner.png
gimp/manjaro-archive.png
gimp/openbox-matcha.png
gimp/openbox-screenshot-menu.png
gimp/pacbang-cover.png
gimp/pacbang-logo.png
gimp/pacbang.png
gimp/shadow.png
gimp/wd-nvme-256g-wds256g1x0c.png
gimp/weird-gtk-appearance.png
hurt-feeelings-report.png
secure-copy-syntax/Example syntax for Secure Copy (scp)_files/m_top.png
secure-copy-syntax/Example syntax for Secure Copy (scp)_files/mb_articles_g.png
secure-copy-syntax/Example syntax for Secure Copy (scp)_files/mb_blog_g.png
secure-copy-syntax/Example syntax for Secure Copy (scp)_files/mb_contact_g.png
secure-copy-syntax/Example syntax for Secure Copy (scp)_files/mb_gnu_g.png
secure-copy-syntax/Example syntax for Secure Copy (scp)_files/mb_index.png
secure-copy-syntax/Example syntax for Secure Copy (scp)_files/mb_links.png
secure-copy-syntax/Example syntax for Secure Copy (scp)_files/mb_photoblog.png
secure-copy-syntax/Example syntax for Secure Copy (scp)_files/mb_programming.png
secure-copy-syntax/Example syntax for Secure Copy (scp)_files/mbl_cartoons.png
secure-copy-syntax/Example syntax for Secure Copy (scp)_files/mbl_linux_documents.png
secure-copy-syntax/Example syntax for Secure Copy (scp)_files/mbl_linux_links_g.png
secure-copy-syntax/Example syntax for Secure Copy (scp)_files/ml_top.png
image/svg+xml:
-------------
gimp/pacbang-logo.svg
image/webp:
----------
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/152885d9-2b35-4c7a-a6be-1f90006aac16-1024x374.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/152885d9-2b35-4c7a-a6be-1f90006aac16-1536x561.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/152885d9-2b35-4c7a-a6be-1f90006aac16-300x110.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/152885d9-2b35-4c7a-a6be-1f90006aac16-768x280.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/152885d9-2b35-4c7a-a6be-1f90006aac16.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/1a274c47-cdf4-4d35-adf0-fde891215fdd-1024x321.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/1a274c47-cdf4-4d35-adf0-fde891215fdd-1536x481.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/1a274c47-cdf4-4d35-adf0-fde891215fdd-300x94.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/1a274c47-cdf4-4d35-adf0-fde891215fdd-768x241.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/1a274c47-cdf4-4d35-adf0-fde891215fdd.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/2b5f584c-0d92-4481-8340-fd7c32f267ff-1180x1536.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/2b5f584c-0d92-4481-8340-fd7c32f267ff-230x300.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/2b5f584c-0d92-4481-8340-fd7c32f267ff-768x1000.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/2b5f584c-0d92-4481-8340-fd7c32f267ff-786x1024.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/2b5f584c-0d92-4481-8340-fd7c32f267ff.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/44aafa9a-6af4-4de5-b0dd-017440b3d6f5-1024x582.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/44aafa9a-6af4-4de5-b0dd-017440b3d6f5-300x171.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/44aafa9a-6af4-4de5-b0dd-017440b3d6f5-768x437.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/44aafa9a-6af4-4de5-b0dd-017440b3d6f5.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/46cdec5e-18cc-4da1-af40-3a727f267712-1178x1536.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/46cdec5e-18cc-4da1-af40-3a727f267712-230x300.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/46cdec5e-18cc-4da1-af40-3a727f267712-768x1001.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/46cdec5e-18cc-4da1-af40-3a727f267712-786x1024.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/46cdec5e-18cc-4da1-af40-3a727f267712.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/65940ab4-122d-40f1-ab44-15dab582bf40-1024x363.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/65940ab4-122d-40f1-ab44-15dab582bf40-1536x545.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/65940ab4-122d-40f1-ab44-15dab582bf40-300x106.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/65940ab4-122d-40f1-ab44-15dab582bf40-768x273.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/65940ab4-122d-40f1-ab44-15dab582bf40.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/83040a10-5f0f-45bd-9a97-bd9e53d26bdc-1024x640.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/83040a10-5f0f-45bd-9a97-bd9e53d26bdc-300x188.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/83040a10-5f0f-45bd-9a97-bd9e53d26bdc-768x480.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/83040a10-5f0f-45bd-9a97-bd9e53d26bdc.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/9e072d84-dbd9-4655-ba36-ee82e52eb86c-1024x225.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/9e072d84-dbd9-4655-ba36-ee82e52eb86c-1536x338.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/9e072d84-dbd9-4655-ba36-ee82e52eb86c-300x66.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/9e072d84-dbd9-4655-ba36-ee82e52eb86c-768x169.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/9e072d84-dbd9-4655-ba36-ee82e52eb86c.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/9f1d0d73-fe8f-4281-bb42-1c69b76ed075-1024x862.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/9f1d0d73-fe8f-4281-bb42-1c69b76ed075-300x252.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/9f1d0d73-fe8f-4281-bb42-1c69b76ed075-768x646.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/9f1d0d73-fe8f-4281-bb42-1c69b76ed075.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/Certified_partner_logo-1024x324.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/Certified_partner_logo-300x95.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/Certified_partner_logo-768x243.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/Certified_partner_logo.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/HavenZone-3-black-low-res-web-300x108.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/HavenZone-3-black-low-res-web-768x276.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/HavenZone-3-black-low-res-web.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/a8f878484445130abe5c249e89c85901.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/badge-1-1024x778.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/badge-1-300x228.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/badge-1-768x583.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/badge-1.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/c9034271-c57e-4d53-b936-30dd5b29947a-1081x1536.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/c9034271-c57e-4d53-b936-30dd5b29947a-211x300.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/c9034271-c57e-4d53-b936-30dd5b29947a-721x1024.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/c9034271-c57e-4d53-b936-30dd5b29947a-768x1091.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/c9034271-c57e-4d53-b936-30dd5b29947a.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/d347a49d-042f-49a4-85d9-7cdb8b33fb4f-1024x311.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/d347a49d-042f-49a4-85d9-7cdb8b33fb4f-1536x466.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/d347a49d-042f-49a4-85d9-7cdb8b33fb4f-300x91.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/d347a49d-042f-49a4-85d9-7cdb8b33fb4f-768x233.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/d347a49d-042f-49a4-85d9-7cdb8b33fb4f.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/ubiquiti-reseller-1024x445.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/ubiquiti-reseller-1536x667.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/ubiquiti-reseller-2048x889.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/ubiquiti-reseller-300x130.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/ubiquiti-reseller-768x334.webp
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/ubiquiti-reseller.webp
text/css:
--------
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/nitro-min-noimport-08b3644b1eee19ef4656f99406ca8a84-styleshe.css
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/nitro-min-noimport-29e8603bfc59e90687802bd3f7b9498c-styleshe.css
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/nitro-min-noimport-61082610bc4c51380c14b756c2a67ae2-styleshe.css
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/nitro-min-noimport-cea370cb13a8c51cf0bc05e45b431f6d-styleshe.css
secure-copy-syntax/Example syntax for Secure Copy (scp)_files/ss.css
text/csv:
--------
regnskab/Posteringer.csv
text/Anni.csv
text/Erhvervskonto.csv
text/Fælles konto.csv
text/Untitled 1.csv
text/se-users.csv
text/html:
---------
bits-and-bytes-converter/bits-and-bytes-converter.html
bits-and-bytes-converter/data-transfer-calculator.html
forum-archive/index.html
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone.html
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/a.html
secure-copy-syntax/Example syntax for Secure Copy (scp).html
text/javascript:
---------------
bits-and-bytes-converter/bits-and-bytes-converter_files/ga.js
bits-and-bytes-converter/data-transfer-calculator_files/ga.js
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/external_forms.js
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/gtm.js
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/nitro-min-1c61ea851696d77915a6d68982090c0d.public-scripts.min.js
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/nitro-min-23d33c1839c4e249055eb7e2a66aff11.9ca3359fb2a7fc71e5.js
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/nitro-min-3a0508bb2ab18be40795a6a8d2b9c7ca.masonry.min.js
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/nitro-min-515256a13fd66d71a2887d1dc1ecc93c.designer.js
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/nitro-min-515256a13fd66d71a2887d1dc1ecc93c.infusion.js
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/nitro-min-515256a13fd66d71a2887d1dc1ecc93c.ticker.min.js
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/nitro-min-5352410e4d7e1ae7f0044bb295d19548.esf-free-popup.min.js
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/nitro-min-5352410e4d7e1ae7f0044bb295d19548.public.js
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/nitro-min-5b75144ff99e96e2917a4d2f2017e967.coblocks-animation.js
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/nitro-min-5b75144ff99e96e2917a4d2f2017e967.coblocks-lightbox.js
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/nitro-min-62ea2cc6dbce5d761ac5d058e7f599e9.jquery.fitvids.min.js
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/nitro-min-68b3cde97caa4bdbde203af1041adcfb.esf-insta-public.js
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/nitro-min-6a4d797cb2c4c163caae73cbfa55efa1.imagesloaded.min.js
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/nitro-min-6a4d797cb2c4c163caae73cbfa55efa1.imagesloaded.pkgd..js
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/nitro-min-6a4d797cb2c4c163caae73cbfa55efa1.swap.js
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/nitro-min-a03052e7c818de8fc9953862939c5874.theme.min.js
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/nitro-min-a7a06d7d6baa21c9a129aecfbec647db.jquery.min.js
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/nitro-min-ae2d0389fc49645f4f5a645b442c22c3.jquery.ba-throttle.js
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/nitro-min-ae2d0389fc49645f4f5a645b442c22c3.jquery.magnificpop.js
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/nitro-min-ae2d0389fc49645f4f5a645b442c22c3.jquery.waypoints.m.js
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/nitro-min-cb18c360fd268e2139b3af380d465c2a.custom.js
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/nitro-min-cb18c360fd268e2139b3af380d465c2a.idle-timer.min.js
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/nitro-min-cb18c360fd268e2139b3af380d465c2a.jquery.uniform.min.js
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/nitro-min-d6171631e2919215b5e490dc93564c56.jquery-migrate.min.js
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/nitro-min-tcc_l.combined.1.0.6.min.js
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/nitro-min-tccl-tti.min.js
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/nitro-min-tp.widget.bootstrap.min.js
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/poll.js
manuals/OpenVPN Setup & Configuration on UniFi Security Gateway – Step by Step Guide – HavenZone_files/poll_002.js
secure-copy-syntax/Example syntax for Secure Copy (scp)_files/ga.js
text/markdown:
-------------
De ti plager.md
NotesOnEncryptSetup.md
Zettlr Tutorial/LaTeX Guide.md
Zettlr Tutorial/citing.md
Zettlr Tutorial/helpful-links.md
Zettlr Tutorial/split-view-intro.md
Zettlr Tutorial/welcome.md
Zettlr Tutorial/zettelkasten.md
forum-archive/manjaro-finance.md
tails-how-to-find-latest-iso.md
text/plain:
----------
macarons.txt
manjaro-financial-2024-12-26.txt
nødtaske-indhold-forslag.txt
portugesisk-bagers-øje.txt
scripts/internal-ip-addresses.txt
te-blanding.txt
text/91-Hint.txt
text/Det Danske Sprog.txt
text/Mange i dag mener at man kun er virkeligt fri hvis.txt
text/Re: Wupti.com - Re: 52331740 - 842086.txt
text/Wupti.com - Re: 52331740 - 842086.txt
text/aiowps_2019-10-10_05-55.txt
text/aiowps_2019-10-10_06-19.txt
text/backup_codes_manjaro_forum.txt
text/blackduck-mailbox-org.txt
text/countries-by-area.txt
text/countries-raw.txt
text/dybstegt-kylling-ala-kentucky.txt
text/ghostdocpro-5-license.txt
text/ingefær-sirups-kager.txt
text/linksys-adgang.txt
text/linux-install-steps.txt
text/manjaro-forum-backup-codes.txt
text/mesocolumn-faq.txt
text/modulus10.txt
text/roundcubeskins-licence-number.txt
text/stats-exercise.txt
text/ten-more-countries.txt
text/tilgin-hw-info.txt
text/ubuntu-aarhus.txt
text/vmware-workstation-key.txt
text/wordpress-backup-codes.txt/fhundewadt-backup-codes.txt
text/wp-config-backup.txt
numFiles: 331
Unique MIME types: 26
real 0m0,025s
user 0m0,021s
sys 0m0,004s
@linux-aarhus
Thank you. That is pretty quick. Although I’ve used Tcl’s command to test performance that runs as many times as possible for the duration you pass it, I don’t know if that would be accurate since the first time seemed very slow compared to subsequent runs.
But that was for the version file --brief --mime-type ...; and the mimetype --brief ... is a fraction of that time. (I know very little but could not find anything in the documentation to explain why. Strange, too, now the mime types are much closer to what Dolphin displays.)
If I try the Tcl timerate , the results are as below. Not sure what it means but it is not as good as your 0.025 seconds.
cd $dir
proc GetTable {} {
set sep " "
set l [lsort -dictionary [glob -nocomplain *]]
# set m [exec file --brief --mime-type --separator $sep {*}$l]
set m [exec mimetype --brief --separator $sep {*}$l]
foreach f $l t $m {
puts "$f $t"
}
}
puts [ timerate {GetTable} 30000 ]
# For 219 mp3 files. Two runs.
# A little under 0.11 seconds; 280 runs in 30 seconds.
107484.2 µs/# 280 # 9.304 #/sec 30095.581 net-ms
106081.8 µs/# 283 # 9.427 #/sec 30021.143 net-ms
# For 479 jpeg image scans. Two runs.
# Over 1.2 seconds each run, compelting 25 in 30-31 seconds.
1224116 µs/# 25 # 0.817 #/sec 30602.918 net-ms
1247326 µs/# 25 # 0.802 #/sec 31183.151 net-ms
# For 254 files,mostyl different types of text files like HTML, CSS, JS, SQL,
# a couple images, and a few multi-GiB SQLite databases.
# About 0.16-0.17 seconds.
160017.7 µs/# 188 # 6.249 #/sec 30083.328 net-ms
168649.4 µs/# 178 # 5.929 #/sec 30019.586 net-ms
@scotty65
Would you know if it is possible to get both the -i and -d options in the same run? Thanks.
Mod edit:Merged consecutive posts and added @mentions to keep things tidier.
Speed is determined by a lot of factors and it is not fair to compare your execution times with mine, we are likely using very different systems - see my workstation spec in my profile - so I can’t say if your time is good or bad - it depends… on the system, the folder complexity and possibly other factors I have not thought of…
It is well-known that the Linux kernel will cache everything - thus any subsequent run of the same command will result in a faster execution time.
If you want to measure directly you will need to drop cache.
As root run
echo 3 > /proc/sys/vm/drop_caches
As for the sample python script - the mimetype is guessed from extension.
If you want to get mime type from file content, sync the package python-magic
Plus the storage hardware will likely have internal caching, meaning that getting accurate results is tricky. Sometimes copying the data to a ram disk and running the commands on that allows you to compare the tools, not the hardware.
And /tmp is sometimes configured as a ram disk, which avoids having to create one just for testing.
Not sometimes, but almost always in distributions using systemd — one notable exception being openSUSE.
Also, it’s not a ramfs but a tmpfs. Its contents can be paged out to swap if need be, while the contents of a ramfs will always remain in RAM — unless they are deleted or the ramfs is unmounted, of course.