The blog post argues against using generic, top-level directories like .cache
, .local
, and .config
for application caching and configuration in Unix-like systems. These directories quickly become cluttered, making it difficult to manage disk space, identify relevant files, and troubleshoot application issues. The author advocates for application developers to use XDG Base Directory Specification compliant paths within $HOME/.cache
, $HOME/.local/share
, and $HOME/.config
, respectively, creating distinct subdirectories for each application. This structured approach improves organization, simplifies cleanup by application or user, and prevents naming conflicts. The lack of enforcement mechanisms for this specification and inconsistent adoption by applications are acknowledged as obstacles.
Shunpo is a minimalist Bash tool designed to streamline directory navigation. It learns frequently visited directories and allows users to quickly jump to them using short, custom aliases. By storing these aliases and their corresponding paths in a simple text file, Shunpo avoids complex databases and remains lightweight and portable. It offers basic commands for adding, removing, listing, and navigating to saved locations, simplifying the process of moving between commonly accessed folders within the terminal.
Hacker News users discussed Shunpo's utility and potential drawbacks. Some found its core functionality—quickly jumping to frequently used directories—appealing, especially combined with tools like fzf. Others questioned its value proposition over existing solutions like autojump, z, or fasd, particularly given its reliance on find
. Concerns were raised about performance in large directory trees and the security implications of executing arbitrary commands generated from find
results. Some suggested improvements, including leveraging shell builtins for better performance and integrating more advanced selection mechanisms. The project's minimalism was both praised and criticized, with some appreciating its simplicity and others desiring more features like directory tracking or the ability to ignore certain paths.
/etc/glob
was an early Unix mechanism (predating regular expressions) allowing users to create named patterns representing sets of filenames, simplifying command-line operations. These patterns, using globbing characters like *
and ?
, were stored in /etc/glob
and could be referenced by name prefixed with g
. While conceptually powerful, /etc/glob
suffered from limited wildcard support and was eventually superseded by more powerful and flexible tools like shell globbing and regular expressions. Its existence offers a glimpse into the evolution of filename pattern matching and Unix's pursuit of concise yet powerful user interfaces.
HN commenters discuss the blog post's exploration of /etc/glob
in early Unix. Several highlight the post's clarification of the mechanism's purpose, not as filename expansion (handled by the shell), but as a way to store user-specific command aliases predating aliases and shell functions. Some commenters share anecdotes about encountering this archaic feature, while others express fascination with this historical curiosity and the evolution of Unix. The overall sentiment is appreciation for the post's shedding light on a forgotten piece of Unix history and prompting reflection on how modern systems have evolved. Some debate the actual impact and usage prevalence of /etc/glob
, with some suggesting it was likely rarely used even in early Unix.
Summary of Comments ( 41 )
https://news.ycombinator.com/item?id=42945109
HN commenters largely agree that standardized cache directories are a good idea in principle but messy in practice. Several point out inconsistencies in how applications actually use
$XDG_CACHE_HOME
, leading to wasted space and difficulty managing caches. Some suggest tools likebcache
could help, while others advocate for more granular control, like per-application cache directories or explicit opt-in/opt-out mechanisms. The lack of clear guidelines on cache eviction policies and the potential for sensitive data leakage are also highlighted as concerns. A few commenters mention that directories starting with a dot (.
) are annoying for interactive shell users.The Hacker News post "The practical (Unix) problems with .cache and its friends" (https://news.ycombinator.com/item?id=42945109) has generated several comments discussing the merits and drawbacks of the XDG Base Directory Specification, particularly concerning the
.cache
directory.Several commenters agree with the author of the linked blog post that while the specification is well-intentioned, its implementation has created practical issues. One commenter points out the annoyance of having numerous hidden directories cluttering their home directory, making navigation and management more cumbersome. They argue for a simpler, less fragmented approach to storing application data.
Another commenter echoes this sentiment, suggesting that the proliferation of these directories complicates tasks like backups and disk space analysis. They wish for a more consolidated approach, perhaps allowing applications to store cache data within their own installation directories, provided appropriate permissions are managed. This approach is countered by another user who highlights the security implications, stating that allowing applications write access to their installation directories could create vulnerabilities if those directories are shared by multiple users or if the application itself is compromised.
The discussion also touches upon the inconsistent adoption of the standard across different applications. Some commenters note that many applications still create their own application-specific directories within the home directory, rendering the XDG specification somewhat ineffective. They suggest that stronger enforcement or clearer guidelines are needed for developers to adhere to the standard.
One commenter offers a practical workaround by using symbolic links to relocate the
.cache
directory to a dedicated partition or directory, allowing them to manage cache data separately. Another user suggests employing a tool liketrash-cli
to easily purge the contents of these directories when necessary.Some users express skepticism about the overall benefit of the standard, questioning whether the complexity introduced outweighs the advantages. They argue that the original intent – separating different types of application data – hasn't been fully realized, leading to a situation where users are burdened with managing a multitude of hidden directories without significant practical gain.
A few commenters suggest alternative solutions, such as utilizing a dedicated
/var/cache
directory for all applications or leveraging more advanced filesystem features for managing temporary data. The idea of having package managers automatically clean up cache directories associated with uninstalled applications is also raised.In essence, the comments reflect a mixed reaction to the XDG Base Directory Specification and its implementation. While acknowledging the theoretical benefits of separating application data, many commenters express frustration with the practical implications of the standard, particularly the proliferation of hidden directories and inconsistent adoption across applications. Several workarounds and alternative approaches are suggested, highlighting a desire for a simpler, more streamlined approach to managing application data on Unix-like systems.