[HN Gopher] Sloth - A Mac app that shows all open files, directo...
       ___________________________________________________________________
        
       Sloth - A Mac app that shows all open files, directories, sockets,
       etc.
        
       Author : kruuuder
       Score  : 693 points
       Date   : 2023-02-16 23:09 UTC (23 hours ago)
        
 (HTM) web link (github.com)
 (TXT) w3m dump (github.com)
        
       | vram22 wrote:
       | Haven't used them for a while, but IIRC, the combination of lsof
       | (which Sloth is based on) and fuser (including with the -k
       | option) can be useful.
       | 
       | In fact I first found lsof when working on HP-UX servers. IIRC,
       | it was written by an Indian-named guy who may have worked at HP.
        
       | 29athrowaway wrote:
       | lsof provides this information
        
         | amelius wrote:
         | Yeah, but I always forget the relevant flags.
        
           | 29athrowaway wrote:
           | man lsof
        
             | lepapillon wrote:
             | Gotta love that guy
        
               | 29athrowaway wrote:
               | Right? He is the "man"
        
             | jbverschoor wrote:
             | You seem to have forgotten your usual HN username ;)
        
               | 29athrowaway wrote:
               | If commands and manpages make you angry enough to
               | threaten people online, it's time to take a little break
               | from the Internet.
        
         | nkrisc wrote:
         | > Sloth is essentially a friendly, exploratory graphical user
         | interface built on top of the lsof command line tool. The
         | output of lsof is parsed and shown in a sortable, searchable
         | outline view with all sorts of convenient additional
         | functionality.
        
         | [deleted]
        
       | boopmaster wrote:
       | Love this, reminds me of the BeOS process controller that
       | permitted killing individual threads IIRC. useful when you need
       | to unfreeze an app without losing your work in that app!
       | 
       | Ref image here:
       | 
       | http://www.lucidelectricdreams.com/2010/10/haiku-remember-wh...
        
         | joshspankit wrote:
         | All this time, and BeOS _still_ schools modern operating
         | systems
        
       | hparadiz wrote:
       | Something like this should be a standard tool in every operating
       | system no different from a task manager application.
        
         | wingi wrote:
         | lsof ?
        
           | alchemist1e9 wrote:
           | Exactly.
           | 
           | lsof | fzf
        
             | sgtnasty wrote:
             | This is it right here. Works fantastic and its just a pipe
             | of 2 commands.
        
         | neilalexander wrote:
         | The built-in Activity Monitor in macOS also has the ability to
         | show open descriptors for a process. Double-click a process and
         | go into the "Open Files and Ports" tab.
        
           | quenix wrote:
           | That leaves lots to be desired
        
       | sva_ wrote:
       | It would be cool if this was platform independent, since lsof
       | exists on many UNIX-like platforms.
        
         | nottorp wrote:
         | You mean an Electron 'app' that takes 30 Gb of ram? :)
        
       | guessmyname wrote:
       | They also develop an app for that I have used for years to open
       | Burp Suite on Mac called Platypus --
       | https://github.com/sveinbjornt/Platypus
       | 
       | Platypus allows you to create a Mac [dot]app wrapper around any
       | type of scripts.
        
         | arunc wrote:
         | Reminds me of the awesome Gnome2 widgets that were so simple
         | and elegant.
        
         | djhn wrote:
         | Love Platypus, but can I ask how and why do you use burp suite
         | through it instead of installing burp suite on macos normally?
        
           | guessmyname wrote:
           | Burp Suite does not create a [dot]app folder, so every time I
           | want to start it I have to open the Terminal and run "java
           | -jar /path/to/burpsuite.jar", which is not a big problem but
           | I very much prefer to press Cmd+Space, quickly type "burp"
           | and then press the Return key to start the Platypus wrapper.
        
             | djhn wrote:
             | Community edition must be different then? It seems I have a
             | .app folder and I don't remember having to do anything
             | special for that to happen.
        
               | boston_clone wrote:
               | I have both community and professional editions installed
               | (trial expired), and would always open via spotlight or
               | the dock shortcut... not sure what's going on with the
               | parent comment's application.
        
             | oscargullberg wrote:
             | This can also be done using Automator. Application -> Run
             | shellscript
        
       | evasb wrote:
       | One things I envy about the macOS users is how obstinate they are
       | to better macOS for free to Apple. While Linux users with the
       | time tend to just be satisfied with the CLI tools and ignore GUI.
       | At best, you would have a curses app to this.
        
         | macintux wrote:
         | That's a rather backhanded compliment, but yes, when you use
         | slick tools on a daily basis there's a halo effect. Mac
         | developers have, for decades now, taken pride in writing native
         | applications that run well and look clean.
        
           | nerdponx wrote:
           | I suspect this also has to do with the presence of a native
           | first-party GUI toolkit and app framework that deeply
           | integrates with the rest of the system.
           | 
           | There are plenty of developers who also take pride in
           | developing native applications on Linux that run well and
           | look good, but from what little I know about GUI app dev,
           | it's harder to do that in a way that runs well and looks good
           | on the wide range of Linux-based systems that exist out
           | there.
        
             | freedomben wrote:
             | What would "first-party" even mean on Linux?
        
             | macintux wrote:
             | That's an excellent point, Linux is definitely hampered,
             | but Windows doesn't seem to have benefited much from having
             | a first-party toolkit and framework.
        
               | wtallis wrote:
               | Windows doesn't have a first-party toolkit and framework.
               | They have a multitude of them, with a new one every few
               | years--each one bringing conflicting philosophies and
               | design patterns.
               | 
               | The fragmentation is almost as bad as on Linux: an admin
               | tool that looks at home alongside Microsoft Management
               | Console will never fit in with the Windows 10 or Windows
               | 11 Settings applications.
        
             | rswail wrote:
             | Exactly the problem that Android has compared to iOS. There
             | isn't a "wide range of iOS-based systems" that are
             | different enough that you invent your own way of doing
             | things.
             | 
             | Allows for greater control over your own expression, while
             | having to support many possible platforms.
        
         | [deleted]
        
       | KingLancelot wrote:
       | [dead]
        
       | vegasbrianc wrote:
       | Cool app, is this essentially a visual representation of the
       | 'lsof' command?
        
         | karaterobot wrote:
         | > Nice GUI for lsof.
         | 
         | Yep!
        
         | bdcravens wrote:
         | Name probably comes from rearranging the letters (slof)
        
         | techwizrd wrote:
         | I believe you're correct according to the linked Github repo:
         | 
         | > Sloth is essentially a friendly, exploratory graphical user
         | interface built on top of the lsof command line tool. The
         | output of lsof is parsed and shown in a sortable, searchable
         | outline view with all sorts of convenient additional
         | functionality.
        
           | [deleted]
        
         | wellthisisgreat wrote:
         | They should have rolled with "Slof" and use the "f" as a
         | phonetic writing of "th"
        
         | 1vuio0pswjnm7 wrote:
         | BSD userland has fstat. Arguably no need for lsof but I guess
         | some people might prefer lsof.
        
         | antegamisou wrote:
         | This was my exact thought too. How is it any different from it?
        
           | dopidopHN wrote:
           | It's says on their page it's a GUI for lsof.
        
             | aa-jv wrote:
             | There should be more GUI's for the command line tools,
             | imho. Imagine if we could get a parsable json from the cmd
             | line tools that allows for a standard UI to be built ..
        
               | black3r wrote:
               | There's a cli/python utility called jc, which can parse
               | some cmd line tool outputs (including lsof) and convert
               | them to JSON (can also convert many file formats to
               | JSON..)
               | 
               | https://kellyjonbrazil.github.io/jc/
        
       | [deleted]
        
       | 1101010010 wrote:
       | Ah, yes, nothing like running an unaudited application as root
       | for security! Especially love the part where the developer signs
       | with a 1024-bit DSA key and then uses ssh as root to deploy to a
       | public webserver the sparkle updates:
       | 
       | > scp SlothAppcast.xml root@sveinbjorn.org:/www/sveinbjorn/html/f
       | iles/appcasts/SlothAppcast.xml
       | 
       | The references to "Mac OS X" (now over 10 years old) are the
       | cherry on top.
        
       | fatcat500 wrote:
       | No offense but the logo looks disgusting.
        
         | imgabe wrote:
         | Disgusting is harsh, but it does look weird. It makes me think
         | of some kind of single-celled organism or maybe an upside down
         | turkey head and neck.
        
         | ChickenNugger wrote:
         | I thought it was a bloodworm at first:
         | https://www.youtube.com/watch?v=o7aM5gU8mFY
         | 
         | Somebody needs Cayce Pollard
         | (https://www.goodreads.com/en/book/show/22320) to have a look.
        
           | gre wrote:
           | It reminds me of a white grub.
           | 
           | https://extension.entm.purdue.edu/fieldcropsipm/insects/corn.
           | ...
        
         | h0l0cube wrote:
         | Some constructive advice to the author, if they're lurking:
         | "Good" logos economize on details to maximize impression and
         | versatility. Use fewer and simpler shapes to communicate
         | better. Or maybe let an AI tool have at it?
        
           | h0l0cube wrote:
           | Another note to the author if they see this. I don't find the
           | logo offensive like the sibling commenters. I love the
           | creative process and wasted days making logos which other
           | people found unpalatable. People have visceral responses to
           | logos for better or worse, which is why logos have become so
           | boring over time - it's just safer. But I do not hate the
           | sloth
        
         | makeitdouble wrote:
         | Sharing the sentiment.
         | 
         | The logo looks competently drawn and is better at bigger scales
         | where the details are clearer, but from a distance it caused me
         | a visceral rejection reaction.
         | 
         | A sloth drawn with less fur detail would be simply cute, for
         | instance: https://media.tenor.com/yypYI980ipUAAAAC/sloth-
         | animal.gif
        
         | [deleted]
        
         | qumpis wrote:
         | Agreed. The style looks nice and idea clear. But the details
         | make this look unsettling, like early versions of AI generated
         | human faces, resulting in creepy output
        
         | jonpurdy wrote:
         | Posting a reply since there is validity to the terse comment.
         | 
         | I clicked out of curiosity and my trypophobia was definitely
         | triggered. Probably due to the numerous "holes" around the
         | edges of the sloth.
         | 
         | Those who don't have trypophobia understandably would think
         | it's ridiculous. But as someone who feels it for whatever
         | reason, it's totally real.
        
           | azangru wrote:
           | > Probably due to the numerous "holes" around the edges of
           | the sloth.
           | 
           | Isn't it sort of the point? Since the app is showing you all
           | the ports (i.e. "holes") that are open?
        
           | graeme wrote:
           | I don't have trypophobia, but the logo reminds me of some
           | sort of hideous alien slug
        
         | detrites wrote:
         | Not sure if it still works, but on macOS previously you could
         | Command-I (Info) on two files, click the icon in one info
         | window (highlighting it), and copy-paste on the other.
         | 
         | Quick fix for ugly app icons.
        
         | mdni007 wrote:
         | Definitely one of the ugliest looking logos I've seen in a long
         | time
        
         | verteu wrote:
         | As a simple alternative, I had good results using Craiyon with
         | prompts like "cute sloth, company logo, vector art, simple".
        
       | ridiculous_fish wrote:
       | This is wonderful! Thank you for writing this.
        
       | chrisledet wrote:
       | Looks good from what I see in the screenshots. I'd like to find
       | something similar for Windows.
        
         | kritr wrote:
         | Sysinternal's Process Explorer might be what you're looking
         | for. https://learn.microsoft.com/en-
         | us/sysinternals/downloads/pro...
        
           | miles wrote:
           | Process Monitor ("an advanced monitoring tool for Windows
           | that shows real-time file system, Registry and process/thread
           | activity") may be the closer parallel:
           | 
           | https://learn.microsoft.com/en-
           | us/sysinternals/downloads/pro...
        
         | grishka wrote:
         | The thing you want to google is "sysinternals".
        
         | rejectfinite wrote:
         | Not similar, but look into the Microsoft Powertoys tool for
         | other cool utilities on Windows. There is a Spotlight search
         | tool, OCR text, Zones etc.
         | 
         | As others have said, Sysinternals Process Explorer and Process
         | Monitor.
         | 
         | https://helpdeskgeek.com/windows-10/how-to-use-process-monit...
        
         | DominoTree wrote:
         | System Informer (formerly Process Hacker) might also have what
         | you're looking for
         | 
         | https://systeminformer.sourceforge.io/
        
         | buzzier wrote:
         | Press Windows+R to show Run, input resmon.exe and hit OK.
        
       | amjd wrote:
       | For those looking for a way to filter open ports, check "IP
       | sockets" and type "listen" in the search bar.
        
       | bb88 wrote:
       | lsof for linux was awesome when I discovered that.
        
       | renewiltord wrote:
       | This is definitely something that benefits from a UI. I can
       | always `lsof` and `fzf` my way to it, but this helps. Thanks.
        
       | francois_h wrote:
       | Isn't this just a glorified lsof?
        
         | pqdbr wrote:
         | It's literally right there in the first line of the
         | description, yes.
        
         | bbrks wrote:
         | There's a fine line between glorified and shoulder-standing.
         | 
         | This project gives full credit to the giant it stands upon.
         | 
         | README.md:
         | 
         | > Sloth is essentially a friendly, exploratory graphical user
         | interface built on top of the lsof command line tool. The
         | output of lsof is parsed and shown in a sortable, searchable
         | outline view with all sorts of convenient additional
         | functionality.
        
       | rswail wrote:
       | great little app. I had to approve it specifically in System
       | Preferences > Security & Privacy > General because it's not
       | signed, but that's a minor detail.
        
       | mcoliver wrote:
       | Very cool. One of the things I would love to be able to do is to
       | track all file reads and writes that traverse a network
       | connection. You can kind of do this using a combination of
       | fs_usage/iftop/lsof in the moment but it's rough. Can Sloth or
       | something like little snitch do it?
       | 
       | Sometimes I'll see my network spike via menumeters but I have no
       | idea what caused it. Was it Google drive syncing something?
       | Something else? What files were accessed?
        
         | danielvaughn wrote:
         | This is one of those no-brainer features that really should
         | ship by default with any machine.
         | 
         | As it happens, there are GUIs that _kinda_ do this, though not
         | intentionally. Charles Proxy comes close, though the interface
         | was a bit rough the last time I used it (2016).
        
           | janpio wrote:
           | Charles Web Proxy will still feel a bit like 2016, not that
           | much changed unter last few years. But it still works and
           | does all the things it needs.
        
           | cmason wrote:
           | Does istat menus not show this? Is it just not detailed
           | enough? I guess some stuff like backups show up under
           | "kernel"...
        
         | Etheryte wrote:
         | Not quite what you were describing, but perhaps Netiquette [0]
         | would be of help here?
         | 
         | [0] https://objective-see.org/products/netiquette.html
        
       | 314 wrote:
       | I guess that I'm not the target audience for this - I like grep
       | as UI on top of lsof, maybe in combination with less, and I've
       | always found it fast and easy to use.
       | 
       | For people that are the target audience of this, I'm curious -
       | what do you like about putting the information into a gui and
       | using a mouse instead of a keyboard?
        
         | kruuuder wrote:
         | >what do you like about putting the information into a gui and
         | using a mouse instead of a keyboard?
         | 
         | I don't have to remember anything to use it, I just click self-
         | explaining buttons and the thing works. The search function is
         | also very nice, and navigating an outline view with the arrow
         | keys, quickly collapsing subtrees as needed, is a very useful
         | tool. Also, drag and drop.
        
         | timbeccue wrote:
         | For guis in general, I like how the actions available to me are
         | much easier to learn, and therefore use. The information
         | conveyed through the layout often provides context for related
         | actions.
         | 
         | In my experience, CLIs are great for efficiency, if I am doing
         | a task so often that it becomes rote behavior and learning the
         | tool is no longer helpful, or if I want to automate it. I find
         | my real world need for either of these to be relatively slim,
         | but I am not surprised that it is common for others.
        
         | nicky0 wrote:
         | What do you like about having to remember and execute a series
         | of precise and arcane text commands instead of seeing everying
         | comfortably and accessibly presented to you in a graphical
         | form?
        
           | nottorp wrote:
           | Speed.
        
           | 314 wrote:
           | It's ok to like different things - there is no need to attack
           | a different approach. If you find the visual layout
           | comfortable and accessible then thank you for answering the
           | question.
        
       | anonfunction wrote:
       | Would be nice to have a dedicated "ports" view as this is what I
       | most commonly use lsof for.
        
       | simonw wrote:
       | Opening this and then searching for "\\.db$" reveals all of the
       | processes that are (probably) using SQLite, which is fun for
       | finding things you can poke around in.
       | 
       | Try "\\.sqlite" too.
       | 
       | This is fun:                   brew install datasette
       | datasette ~/Library/Calendars/Calendar.sqlitedb
        
         | saltypal wrote:
         | Oh wow, thank you!
         | 
         | I'd been poking through them with plain old `sqlite3` and then
         | deserializing all the plist data with something like `pbpaste |
         | xxd -r -p > foo.plist` for examination, but had no idea
         | datasette existed and https://datasette.io/plugins/datasette-
         | bplist#user-content-t... seems like the ticket for browsing
         | these.
         | 
         | For others: all the Caches.db files are the per-process HTTP
         | cache that NSURLRequest/NSURLSession keeps, so if you peek at
         | it you can see (partially) a history of network requests that
         | process has made. Most of them seem to pull feature flag
         | configuration from https://bag.itunes.apple.com/bag.xml, but
         | others do more interesting things.
        
         | Dachande663 wrote:
         | Probably find *.etilqs files as well (believe Firefox uses
         | that). It's sqlite backwards to avoid rampant google hordes
         | descending on the developer.
        
         | graderjs wrote:
         | I think because Core data is SQL lite?
        
           | JKCalhoun wrote:
           | I believe you can choose the kind of store you want for Core
           | Data. (SQL is probably the most popular though.)
        
             | tl wrote:
             | You can choose between:
             | 
             | 1. XML-based (the entire database is one xml file)
             | 
             | 2. SQLite-based
             | 
             | 3. Roll your own (by providing an implemention)
             | 
             | #1 is terribly slow for most cases and not publicly
             | available on iOS.
             | 
             | #3 was released early in the ioS lifecycle (iOS 3 or iOS 5,
             | depending which piece we're talking about)
             | 
             | SQL is, for most purposes, the _only_ implementation,
             | except for iTunes which used #1 for a decade after #2
             | clearly won.
        
           | simonw wrote:
           | Yup - as a result, there's usually a TON of interesting
           | SQLite files on any Mac (and iPhone too if you can get at
           | them).
        
             | dunham wrote:
             | Sometimes you can pull the phone ones out of backups. You
             | used to be able to mount an application's full directory
             | tree, but Apple killed that API years ago.
        
         | CSDude wrote:
         | Example for Photos.app https://medium.com/@mustafaakin/how-to-
         | organize-your-messy-a...
        
           | nerdponx wrote:
           | You can also use this for things like exporting your notes
           | and imessage history to plain text.
        
             | mittermayr wrote:
             | Didn't know that, had to look into it immediately! Looks
             | like a lot of the stuff in the Notes sqlite file is
             | encrypted, though. Will need to look into this some more,
             | would be nice to make a nice little exporter.
        
               | dunham wrote:
               | Last I checked it was not encrypted (unless you
               | explicitly asked it to encrypt a note). Just gzipped
               | protobuf data. I wrote an extractor about six years ago,
               | maybe it'll help:
               | 
               | https://github.com/dunhamsteve/notesutils
               | 
               | It seems to still work for text. It looks like it doesn't
               | dump tables anymore, so that bit may have changed (it was
               | pretty convoluted). I think the extraction of drawing
               | information doesn't work anymore, but they provide a
               | fallback PNG file.
               | 
               | I wanted it to be self-contained, so it has a little
               | hand-rolled protobuf decoder and might be a little code-
               | golfy.
        
               | mittermayr wrote:
               | That's fantastic, thanks for sharing this! I'll give it a
               | spin on the weekend and see what I can get out of it.
        
       | matthewhartmans wrote:
       | This is awesome! Well done OP!
        
       | TheRealDunkirk wrote:
       | This is the beauty of a non-walled-garden, general-purpose
       | computer. I really hope that Apple keeps macOS this way, and
       | doesn't try to close it off like iOS. There are many worrisome
       | trends...
        
         | joshspankit wrote:
         | macOS is already a walled garden in many ways
        
       | Kukumber wrote:
       | Nice desktop UI, simple yet effective!
        
       | johtso wrote:
       | I wish there was a way to see which files were being actively
       | written to sorted by amount of data written. Various times I've
       | seen my disk space rapidly dwindling with no way of know what
       | file was responsible..
        
         | miles wrote:
         | FSMonitor[0] is similar to the old FileMon[1] but for macOS.
         | 
         | In the default tree view, as new data is written, the entries
         | are highlighted and sort of throb, so it's easy to track what's
         | going on.
         | 
         | [0] https://fsmonitor.com/
         | 
         | [1] https://learn.microsoft.com/en-
         | us/sysinternals/downloads/fil...
        
         | yehaaa wrote:
         | Check out rwsnoop, included in macOS. It use Dtrace to trace
         | the read/write syscalls. You need to turn off SIP for Dtrace
         | though afaik.
        
         | [deleted]
        
         | brigandish wrote:
         | Happened to me this morning, something filled up my drive in
         | minutes. I used dust[1] to look for large files while it was
         | happening but knowing what was doing it would've been a big
         | help.
         | 
         | [1] https://github.com/bootandy/dust
        
         | [deleted]
        
         | pram wrote:
         | Activity monitor shows what's being written and the
         | accumulative R/W by process. Wouldn't be too hard to look at
         | lsof and figure it out.
        
         | jalcazar wrote:
         | iotop ?
        
         | sva_ wrote:
         | On Linux, this can be done using BPF (Berkley Packet Filter).
         | In fact there is a tool in BCC[0] called filetop, which lists
         | reads/writes by process and file[1].
         | 
         | 0. https://github.com/iovisor/bcc
         | 
         | 1. https://github.com/iovisor/bcc/blob/master/tools/filetop.py
        
         | krono wrote:
         | If you'd rather spend some of your time than your money on
         | this, you can use the built-in fs_usage terminal command and
         | filter its output (e.g. with grep). Works even with SIP
         | enabled, but will then obviously only return information that
         | SIP doesn't cover.
         | 
         | More info:                 man fs_usage
         | 
         | Example showing pathname-only events but otherwise unfiltered:
         | sudo fs_usage -ew -f pathname
        
           | Jakob wrote:
           | I used this incantation in the past to get the hottest file
           | paths                 $ sudo fs_usage -w -t 5 -f filesys |
           | tee fs_usage.log | egrep -o '(/.+?) {3}' | sed -e
           | 's/\/dev\/disk[^ ]+  //' | sort | uniq -c | sort -nr
           | 
           | From https://www.jakobstoeck.de/2017/ramdisk-for-faster-
           | applicati...
        
             | colonCapitalDee wrote:
             | I'm going to start calling command line commands
             | "incantations"
        
               | jcynix wrote:
               | And as (American?) English speakers tend to abbreviate
               | almost everything ("app", "fridge" ...) we might end at
               | "cantos" then.
               | 
               | https://en.wikipedia.org/wiki/Canto ... I'm currently
               | reading Dan Simmons' Hyperion/Endymion again, which might
               | have pushed that into my mind.
        
               | codetrotter wrote:
               | I think you might enjoy this poster then: https://www.red
               | dit.com/r/linux/comments/ifmoua/ive_finally_f...
               | 
               | Have a look at the writings on the books, the pots, etc,
               | in that picture and I think you will see what I mean ;)
               | 
               | You might have to open the picture on a laptop or desktop
               | computer to get a good look at it. On mobile it might be
               | more difficult to see it proper.
               | 
               | It's my favorite poster that I have ever seen. One of
               | these days I will get myself a nice physical copy of it.
        
               | colonCapitalDee wrote:
               | I have a copy of that poster hanging on my wall!!
        
               | codetrotter wrote:
               | Even better!
        
       | r2222 wrote:
       | What would be the use cases for such tool? If I need to ask, I
       | won't need it?
        
       ___________________________________________________________________
       (page generated 2023-02-17 23:02 UTC)