agedu(1)

๐Ÿ“ฆ
version 20211129.8cd63c5 ยท 4 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

Okay bestie, this is the manual page for agedu (section 1 ๐ŸŽ€), written by Simon Tatham ๐Ÿฆ‹. Let's get into it โœจ

๐Ÿ’– NAME ๐Ÿ’–

agedu, which correlates disk usage with last-access times so you can identify large and disused data ๐Ÿ”ฅ

๐ŸŒธ SYNOPSIS ๐ŸŒธ

agedu [ options ] action [action...]

โœจ DESCRIPTION โœจ

okay so agedu scans a directory tree and gives you reports on how much disk space each directory and subdirectory is eating ๐Ÿ’…, AND how that usage lines up with files that were last accessed a long time ago ๐Ÿ™ˆ

In other words, agedu is basically your best friend for freeing up disk space ๐Ÿงน. It lets you see which directories are taking up the most room, just like du does. But unlike du, it also tells apart big piles of data that are still in use from the ones nobody has touched in months or years ๐Ÿ’€. Think huge archives that got downloaded, unpacked, used once, and then never cleaned up. Where du helps you find what's using your disk space, agedu helps you find what's wasting your disk space ๐Ÿ‘‘.

agedu has several operating modes ๐Ÿงš. In one mode, it scans your disk and builds an index file holding a data structure that lets it efficiently retrieve any info it might need. Usually you'd use that mode first, and then run it in one of a number of query modes to display a report of the disk space usage for a particular directory and its subdirectories. Those reports can come out as plain text (much like du) or as HTML. And agedu can even run as a miniature web server ๐ŸŒˆ, showing each directory's HTML report with hyperlinks so you can click around the file system to similar reports for other directories.

So you'd typically start by telling it to scan a directory tree and build an index. This is done with a command such as:

$ agedu -s /home/fred

which builds a large data file called agedu.dat in your current directory. (If that current directory is inside /home/fred, don't stress ๐Ÿซถ. agedu is smart enough to discount its own index file.)

Having built the index, you'd now query it for disk usage reports. If you have a graphical web browser, the simplest and nicest way to query the index is web server mode:

$ agedu -w

which will print (among other messages) a URL on its standard output, along the lines of:

URL: http://127.0.0.1:48638/

(That URL will always begin with 127., meaning it's in the localhost address space. So only processes running on the same computer can even try to connect ๐Ÿ”’, and there's access control to stop other users from seeing it. See below for more detail.)

Now paste that URL into your web browser and boom โœจ, you get a graphical representation of the disk usage in /home/fred and its immediate subdirectories. Different colours show the difference between disused and recently-accessed data ๐ŸŒˆ. Click any subdirectory to descend into it and see a report for its subdirectories in turn. Click parts of the pathname at the top of any page to return to higher-level directories. When you're done browsing, just press Ctrl-D to send an end-of-file indication to agedu, and it'll shut down ๐Ÿ‘‹.

After that, you probably want to delete the data file agedu.dat, since it's pretty large ๐Ÿ’€. Good news: the command agedu -R will do this for you ๐Ÿงน. You can also chain agedu commands on the same command line, so instead of the above you could have done:

$ agedu -s /home/fred -w -R

That's one self-contained run of agedu that builds its index, serves web pages from it, and cleans it up when it's finished ๐Ÿ’….

Sometimes you want to scan the directory structure of one computer but run agedu's user interface on another ๐Ÿ‘€. In that case, use the agedu -S option in place of agedu -s. That makes agedu skip building an index file and instead just write out its scan results in plain text on standard output. Then you can funnel that output to the other machine using SSH (or whatever technique you prefer). There, run agedu -L to load in the textual dump and turn it into an index file. For example, you might run a command like this (plus any ssh options you need) on the machine you want to scan:

$ agedu -S /home/fred | ssh indexing-machine agedu -L

or, equivalently, run something like this on the other machine:

$ ssh machine-to-scan agedu -S /home/fred | agedu -L

Either way, the agedu -L command will create an agedu.dat index file, which you can then use with agedu -w just as above ๐ŸŽ€.

(Another way to do this might be to build the index file on the first machine as normal, and then copy it to the other machine once it's complete. However, for efficiency, the index file is formatted differently depending on the CPU architecture that agedu is compiled for ๐Ÿค“. So if that doesn't match between the two machines, e.g. if one is a 32-bit machine and one 64-bit, then agedu.dat files written on one machine will not work on the other. The technique described above using -S and -L should work between any two machines ๐Ÿ’œ.)

If you don't have a graphical web browser, no stress. You can do text-based queries instead of using agedu's web interface ๐Ÿฆ‹. Having scanned /home/fred in any of the ways suggested above, you might run:

$ agedu -t /home/fred

which again gives a summary of the disk usage in /home/fred and its immediate subdirectories. This time agedu prints it on standard output, in much the same format as du. If you then want to find out how much old data is hiding in there, add the -a option to show only files last accessed a certain length of time ago. For example, to show only files which haven't been looked at in six months or more:

$ agedu -t /home/fred -a 6m

That's the essence of what agedu does ๐Ÿ’–. It has other modes of operation for more complex situations, plus the usual array of configurable options. The following sections contain a complete reference for all its functionality ๐Ÿ“š.

โœจ OPERATING MODES โœจ

okay so this section is all about the operating modes agedu supports ๐Ÿ’… Each one is a command-line option, sometimes with an argument attached. You can stack multiple modes in one command line, and agedu will do them one after another. Like, we already saw that you might scan a disk and immediately launch a web server showing reports from that scan. Main character energy ๐Ÿ‘‘

  • -s directory, --scan directory โ€” okay this is the scanning mode ๐Ÿ” agedu walks the file system starting at the directory you give it, then indexes everything into a big data file that other modes can query. It's giving organized chaos ๐ŸŒˆ

By default the scan stays inside a single file system. This makes sense because you're probably doing this since a particular disk partition is running low on space ๐Ÿ™ˆ You can lift that restriction with --cross-fs. Other config options let you include or exclude files or whole subdirectories from the scan, and the next section has all the details on those ๐ŸŽ€

The index file gets created with restrictive permissions, just in case the file system you're scanning has confidential info hiding in its structure ๐Ÿ”’

Index files depend on the CPU architecture you made them on, so don't expect to move one to a different type of computer and have it keep working ๐Ÿ’€ If you need to transfer disk scan results to a different kind of computer, check out -D and -L below ๐Ÿฆ‹

  • -w, --web โ€” this mode expects an index file that's already been written ๐ŸŒธ agedu grabs a network port and starts a web server on it, serving reports generated from the index. By default it invents its own URL and prints it out for you.

The web server keeps running until agedu gets an end-of-file event on its standard input. The vibe is: run it from the command line, browse the pages until you're satisfied, then press Ctrl-D โœจ If you want to turn that EOF behaviour off, use --no-eof.

If the index file has confidential info about your file system, the web server protects the pages from other people ๐Ÿซถ On Linux this happens automatically: it checks the owner of each incoming connection using /proc/net/tcp. If that doesn't work, the server requires a password to view the reports, and agedu prints the password it invented on standard output along with the URL ๐Ÿ”

Configurable options for this mode let you pick your own address and port to listen on, choose your own authentication method (including turning authentication off completely), and set a username and password of your choice ๐Ÿ’–

  • -t directory, --text directory โ€” in this mode agedu spits out a textual report on standard output, listing disk usage for the directory you specify and all its subdirectories down to a certain depth ๐Ÿ“ By default that depth is 1, so you get a report for the directory itself plus all its immediate subdirectories. Want a different depth, or no depth limit at all? Use -d, which we'll cover in the next section ๐Ÿงš

Used on its own, -t just lists the total disk usage in each subdirectory. agedu's extra ability to tell unused data apart from recently-used data isn't switched on yet ๐Ÿ˜ญ To activate it, use the -a option to specify a minimum age.

The directory structure stored in the index file is treated as a set of literal strings, which means you can't refer to directories by synonyms ๐Ÿ™…โ€โ™€๏ธ So if you ran agedu -s ., every path you later pass to -t has to be either . or start with ./. Symbolic links inside the directory you scanned won't be followed either, so you need to refer to each directory by its canonical, symlink-free pathname ๐Ÿ”—

  • -R, --remove โ€” this mode deletes the index file ๐Ÿ—‘๏ธ Running just agedu -R on its own is literally the same as typing rm agedu.dat. But you can also tack -R onto the end of a command line, which tells agedu to delete the index file after it finishes everything else ๐Ÿ’…
  • -S directory, --scan-dump directory โ€” this one scans a directory tree and converts the results straight into a textual dump on standard output ๐ŸŒˆ No index file gets generated at all. The dump data is meant for agedu -L to read ๐ŸŽ€
  • -L, --load โ€” in this mode agedu reads a dump produced by -S from its standard input ๐Ÿฅน It builds an index file from that dump, exactly as if it had read the same data from a disk scan in -s mode. Literally identical results, no notes โœจ
  • -D, --dump โ€” this mode reads an existing index file and produces a dump of its contents on standard output, in the same format used by -S and -L ๐Ÿ“ค This is the move if you want to convert an existing index file into a format a different kind of computer can handle. Dump it with -D, then load the dump back in on the other machine using -L. Bestie logic ๐Ÿง 

(Heads up: the output of agedu -D on an existing index file won't be exactly identical to what agedu -S would have originally produced ๐Ÿ™ˆ That's because of a difference in how last-access times on directories are treated. It should still be effectively equivalent for most purposes. See the documentation of the --dir-atime option in the next section for more tea on that.)

  • -H directory, --html directory โ€” agedu generates an HTML report of disk usage in the directory you specify and its immediate subdirectories ๐Ÿ’œ It's the same form that the web server serves in -w mode, so it's giving familiar vibes. By default you get one single HTML report, written straight to standard output, with no hyperlinks pointing to other pages. If you also specify -d (see the next section), agedu writes out a whole collection of HTML files linked to each other instead, and the top-level file is called index.html ๐Ÿฆ‹
  • --cgi โ€” okay this one is for web servers ๐ŸŒ In this mode agedu runs as the bulk of a CGI script, providing the same set of web pages the built-in web server would. It reads the usual CGI environment variables and writes CGI-style data to its standard output ๐Ÿ’–

The actual CGI program should be a tiny wrapper around agedu that passes it the --cgi option, and probably -f too so it can find the index file. agedu handles everything else. For example, your script might look like this:

#!/bin/sh
/some/path/to/agedu --cgi -f /some/other/path/to/agedu.dat
Important tea โ˜•: agedu produces the entire CGI output, including the status code, HTTP headers and the full HTML document. If you try to wrap the agedu --cgi call in code that adds your own HTML header and footer, you won't get the results you want, and agedu's HTTP-level features (like auto-redirecting to canonical versions of URIs) will stop working ๐Ÿ˜ญ

No access control happens in this mode, so restricting access to CGI scripts is assumed to be the web server's job ๐Ÿ”

  • --presort, --postsort โ€” in these two modes, agedu expects to read a textual data dump from standard input, of the form produced by -S (and -D) ๐Ÿงฉ It transforms the data into a different version of its text dump format, then writes the transformed version to standard output.

The ordinary dump format is reasonably readable, but loading it into an index file with agedu -L requires it to be sorted in a specific order. That order is complicated to describe and really hard to pull off with ordinary Unix sorting tools ๐Ÿ’€ So if you want to build your own dump from a source that agedu doesn't know how to scan, you'll need to make sure it's sorted in the right order.

To help with that, agedu provides a secondary dump format called sortable. It's sortable in the sense that plain sort(1) with no arguments will arrange it into the right order โœจ The catch is that the sortable format is much more unreadable and also twice the size, so you definitely wouldn't want to write it directly ๐Ÿ™ƒ

So the recommended procedure is: generate dump data in the ordinary format, pipe it through agedu --presort to turn it into the sortable format, sort it, then pipe it into agedu -L (which can accept either the normal or the sortable format as input). For example:

generate_custom_data.sh | agedu --presort | sort | agedu -L

If you ever need to transform the sorted dump file back into the ordinary format, agedu --postsort can do that for you ๐Ÿ”„ But since agedu -L accepts either format as input, you might not even need it ๐Ÿ’…

  • -h, --help โ€” makes agedu print some help text and terminate immediately ๐Ÿ†˜
  • -V, --version โ€” makes agedu print its version number and terminate immediately ๐Ÿ”ข

โœจ OPTIONS โœจ

okay this section covers the various configuration options that affect how agedu operates in one mode or another ๐ŸŽ€ Some of them are super specific, some are basically universal, so let's start with the big one.

The following option affects nearly all modes (except -S):

  • -f filename, --file filename โ€” this sets the location of the index file that agedu creates, reads or removes, depending on what mode it's in ๐Ÿ“ By default it's simply agedu.dat, sitting in whatever the current working directory is when you run agedu ๐ŸŒธ

The following options affect the disk-scanning modes, -s and -S:

  • --cross-fs and --no-cross-fs โ€” okay so these decide whether the scan is allowed to cross between different file systems ๐ŸŒธ The default is not to, so agedu will normally skip over subdirectories that have a different file system mounted on them ๐Ÿ™…โ€โ™€๏ธ That's super handy when a drive is running low and you only want to free up space on that one file system ๐Ÿ’–

But sometimes you want the big picture no matter which file system the data lives on โœจ Like, if your real worry is your backup media running out of space, and your backups don't treat different file systems any differently, then use --cross-fs ๐Ÿซถ

(Note that this default is the opposite way round from the corresponding option in du. ๐Ÿ™ƒ)

  • --prune wildcard and --prune-path wildcard โ€” these are the bouncers ๐Ÿšซ They cause particular files or directories to be left out of the scan completely. If agedu runs into a file or directory whose name matches the wildcard you gave --prune, it won't put that file in its index, and if it's a directory, it skips right over it and doesn't scan what's inside ๐Ÿ’€

Heads up: in most Unix shells you'll probably need to escape wildcards on the command line ๐Ÿ™ˆ Otherwise the shell expands the wildcard before agedu ever sees it.

--prune-path is basically the same energy, except the wildcard gets matched against the entire pathname instead of just the filename at the very end ๐Ÿ›ฃ๏ธ So --prune *a*b* matches any file whose actual name has an a somewhere before a b. But --prune-path *a*b* will also catch a file whose name contains a b and which sits inside a directory containing an a, or any file inside a directory of that form, and so on ๐ŸŒ€

  • --exclude wildcard and --exclude-path wildcard โ€” these hide things from the index, but NOT from the scan ๐Ÿ‘€ If agedu finds a file or directory whose name matches the wildcard given to --exclude, that item won't be in the index. BUT, unlike --prune, if it's a directory, agedu will still scan its contents and index them, as long as they aren't ruled out by --exclude options themselves ๐Ÿงš

Same deal as before with --exclude-path: it works like --exclude, except the wildcard is matched against the entire pathname ๐Ÿฆ‹

  • --include wildcard and --include-path wildcard โ€” the redemption arc ๐Ÿ’… These bring particular files or directories back into the index and the scan, if they'd previously been ruled out by one of the exclude or prune options. You can mix include, exclude and prune options in whatever order you like on the command line ๐ŸŽ€ If more than one of them applies to the same file, the last one wins ๐Ÿ‘‘

For example, if you only wanted to see how much disk space your MP3 files are taking up, you could run:

$ agedu -s . --exclude '*' --include '*.mp3'

That omits everything from the scan first, and then puts the MP3 files back in ๐ŸŽถ If you then only wanted a subset of those MP3s, you could exclude some of them again by adding, say, --exclude-path './queen/*'' (or, more efficiently, --prune ./queen) to the end of that command ๐Ÿ‘ธ

Just like the previous two, --include-path is similar to --include, except the wildcard is matched against the entire pathname ๐ŸŒˆ

  • --progress, --no-progress and --tty-progress โ€” the progress vibe check ๐Ÿ“Š When agedu is scanning a directory tree, it'll usually print a one-line progress report every second showing where it's got to, so you have some idea of how much longer it's gonna take โณ (It can't predict exactly how long, though, since it doesn't know which unscanned directories are secretly huge ๐Ÿ™ƒ)

By default, those reports show up on agedu's standard error channel, but only if that channel is pointing at a terminal device ๐Ÿ’ป If you want to take manual control, these three are your girls: --progress turns the reports on unconditionally, --no-progress turns them off unconditionally, and --tty-progress puts you back on the default behaviour, which depends on standard error being a terminal โœจ

  • --dir-atime and --no-dir-atime โ€” the directory atime drama ๐ŸŽญ In normal operation, agedu ignores the atimes (last access times) on the directories it scans. It only pays attention to the atimes of the files inside those directories ๐Ÿ“ Why? Because directory atimes get reset constantly by all sorts of admin stuff, like cron jobs that scan the file system for one reason or another, or even other runs of agedu itself, though it tries really hard not to modify any atimes if it can ๐Ÿ˜ค So the literal atimes on directories usually aren't a true reflection of how long ago the data was last accessed with real intent to use it ๐Ÿ’ญ

Instead, agedu makes up a fake atime for every directory it scans. It's equal to the newest atime of any file in or below that directory (or the directory's last modification time, whichever is newest) ๐Ÿง  The logic is that all the important accesses to directories are really accesses to the files inside them, so whenever a file is accessed, every directory on the path leading to it should count as accessed too ๐Ÿ›ค๏ธ

In unusual cases, a directory might actually hold important data that's accessed by reading the directory itself ๐Ÿฅบ In that situation, agedu's atime-faking will misreport that directory as disused. If those directories make up a significant chunk of your disk usage, you might want to turn the faking off. That's what --dir-atime does: it makes the disk scan read the original atimes of the directories it scans ๐Ÿ”

The faking of directory atimes also needs an extra processing pass over the index file once the main disk scan is done. --dir-atime turns that pass off too ๐Ÿ™…โ€โ™€๏ธ So this option affects the -L option as well as -s and -S.

(The previous section mentioned that there might be subtle differences between the output of agedu -s /path -D and agedu -S /path. This is why. Doing a scan with -s and then dumping it with -D will dump the fully faked atimes on the directories, whereas doing a scan-to-dump with -S will dump only partially faked atimes, specifically each directory's last modification time, since the subsequent processing pass won't have had a chance to happen. However, loading either of the resulting dump files with -L will perform the atime-faking processing pass, leading to the same data in the index file in each case. In normal usage it should be safe to ignore all of this complexity. ๐Ÿค“)

  • --mtime โ€” index files by their last modification time instead of their last access time ๐Ÿ—“๏ธ You might want this if your last access times are totally useless for some reason. For example, if you recently searched every file on your system, the system would have lost all the info about which files you hadn't touched recently before that ๐Ÿ˜ญ Using this is likely to be less effective at finding genuinely wasted space than the normal mode. It'll be more likely to flag things as disused when they're not, so you'll have more candidates to sift through by hand looking for data you don't need ๐Ÿฅฒ But it may be better than nothing if your last-access times are unhelpful ๐Ÿซ 

Another use for this mode is finding recently created large data ๐Ÿ”Ž If your disk has been slowly filling up for years, the default mode will help you find unused data to delete. But if you know your disk had plenty of room recently and now it's suddenly full, and you suspect some rogue program left a big core dump or output file behind, then agedu --mtime might be a convenient way to track down the culprit ๐Ÿ•ต๏ธโ€โ™€๏ธ

  • --logicalsize โ€” this tells agedu to treat each file's size as its logical size, rather than the amount of space it actually eats up on disk ๐Ÿ“ (In other words, it uses st_size instead of st_blocks from the data returned by stat(2).) This makes agedu less accurate at reporting how much of your disk is used, but it might be useful in specialist cases, like working around a file system that's misreporting physical sizes ๐Ÿง

For most files, the physical size is bigger than the logical size, because file system layouts generally allocate a whole number of disk blocks to each file, so some space gets wasted at the end of the last block ๐Ÿงฑ That means counting only the logical size will usually under-report disk usage, sometimes by a lot if you've got a huge pile of very small files ๐Ÿ“‰

On the other hand, a file with a very large logical size can sometimes have "holes" where no data is actually stored. In that case, using the logical size will over-report its disk usage ๐Ÿ“ˆ So logical sizes can give wrong answers in both directions. Chaotic, I know ๐ŸŒช๏ธ

The following option affects all the modes that generate reports: the web server mode -w, the stand-alone HTML generation mode -H and the text report mode -t ๐Ÿ“ฃ

  • --files โ€” this makes agedu's reports list the individual files in each directory, instead of just giving one combined report for everything that isn't in a subdirectory ๐Ÿ“‚โœจ

The following option affects the text report mode -t ๐Ÿ“

  • -a age or --age age โ€” this tells agedu to only report files of at least the specified age ๐Ÿ•ฐ๏ธ An age is written as a number followed by one of y (years), m (months), w (weeks) or d (days). This same syntax is also used by the -r option ๐Ÿ” For example, -a 6m will produce a text report that only includes files at least six months old ๐ŸŽ€

okay so this next batch is for the stand-alone HTML generation mode -H and the text report mode -t ๐Ÿ“โœจ these ones are lowkey the main character options ๐Ÿ’…

  • -d depth, --depth depth โ€” this is the depth dial ๐ŸŽš๏ธ It controls how far down agedu digs when it makes a text or HTML report ๐ŸŒŠ
    • In text mode the default is 1, so your report includes the directory you gave on the command line plus all of its immediate subdirectories ๐Ÿ“‚ A depth of two adds another level below that, and so on ๐Ÿชœ A depth of zero means only the directory on the command line ๐Ÿซถ
    • In HTML mode, using this option switches agedu from making one single HTML file to making a bunch of files that link to each other ๐Ÿ•ธ๏ธ A depth of 1 means agedu writes an HTML file for the directory you gave plus one for each of its immediate subdirectories ๐Ÿฆ‹
    • Want agedu to recurse as deep as humanly possible? Give the special word max' as the argument to -d ๐Ÿ‘‘
  • -o filename, --output filename โ€” this is where agedu drops its report ๐Ÿ“ฌ In text mode or single-file HTML mode, the argument is a file name ๐Ÿ“„ In multiple-file HTML mode, the argument is a directory name instead ๐Ÿ—‚๏ธ agedu makes that directory if it doesn't already exist, and the output HTML files go inside it ๐Ÿ 

The following option affects only the stand-alone HTML generation mode -H, and even then, only in recursive mode (with -d):

  • --numeric โ€” this one tells agedu to give most of its HTML files number names ๐Ÿ”ข The root of the whole output collection is still index.html, but everything else gets names like 73.html or 12525.html ๐Ÿงš The numbers are basically arbitrary; they're actually indices of nodes in the data structure used by agedu's index file ๐Ÿค“
    • This naming style is less intuitive than the default of naming files after the sub-pathname they index ๐Ÿ™ˆ It's also less stable: the same pathname won't necessarily get the same filename if you re-run agedu -H after another scan of the same directory tree ๐Ÿ’€ However, it keeps filenames short, so even if your directory tree is super deep, the output HTML files won't go over any OS limit on filename length โœจ

The following options affect the web server mode -w, and in some cases also the stand-alone HTML generation mode -H:

  • -r age range, --age-range age range โ€” this is the colour scale for how long ago stuff was last touched ๐ŸŒˆ HTML reports use a range of colours to show how long ago data was last accessed, running from red (the most disused data) to green (the newest) ๐Ÿ”ด๐ŸŸข
    • By default, agedu picks the two ends of that spectrum by checking the data file to see what range of ages is in it ๐Ÿ” But if you want your own limits, this is where -r comes in ๐ŸŽ€
    • The argument is a single age, or two ages separated by a minus sign ๐Ÿซถ An age is a number followed by one of y (years), m (months), w (weeks) or d (days) ๐Ÿ“… This syntax is also used by the -a option ๐Ÿ’œ
    • The first age is the oldest data and gets coloured red in the HTML ๐Ÿ”ด The second age is the newest and gets coloured green ๐ŸŸข If you don't give a second age, it defaults to zero, so green means data accessed just now โฐ
    • Examples: -r 2y marks data red if it's been unused for two years or more, and green if it was accessed just now ๐Ÿ“ -r 2y-3m marks data red if it's been unused for two years or more, but marks it green if it was accessed three months ago or later ๐ŸŒธ
  • --address addr[:port] โ€” the network address and port number agedu listens on when it's running its web server ๐ŸŒ If you want agedu to take connections from any source, give the address as the special value ANY ๐ŸŒ If you leave off the port number, agedu picks an arbitrary unused port for you and shows it ๐ŸŽฒ
    • If you use this option, agedu won't print its URL on standard output, since you're expected to already know the address you told it to listen on ๐Ÿ™ˆ
  • --auth auth-type โ€” how agedu controls access to the web pages it serves ๐Ÿ” Your options are:
    • magic โ€” this one only works on Linux, and only when the connection comes from the same machine agedu is running on ๐Ÿ’ป On Linux, the special file /proc/net/tcp lists the network connections the kernel currently knows about, including which user id created them ๐Ÿ‘€ So agedu looks up each incoming connection in that file and allows access if it comes from the same user id agedu itself is running under ๐Ÿซถ That means in normal web server mode you can safely run it on a multi-user machine, and no other user will be able to read data out of your index file ๐Ÿ”’
    • basic โ€” uses HTTP Basic authentication, so the user has to provide a username and password via their browser ๐Ÿ—๏ธ agedu normally makes one up, but you can specify your own; see below ๐Ÿ‘‡
    • none โ€” no authentication at all: anyone connecting has full access to the reports generated by agedu ๐Ÿ˜ญ Don't do this unless there's nothing confidential in your index file, or you're certain nobody but you can run processes on your computer ๐Ÿšซ
    • default โ€” the default if you don't pick one of the above ๐ŸŽ€ agedu tries to use Linux magic authentication, but if it detects at startup that /proc/net/tcp is absent or non-functional, it falls back to HTTP Basic authentication and invents a user name and password ๐Ÿช„
  • --auth-file filename, --auth-fd fd โ€” when agedu is using HTTP Basic authentication, these let you pick your own user name and password ๐Ÿ”‘ With --auth-file, they're read from the file you specify; with --auth-fd, they're read from a given file descriptor that you should have arranged to pass to agedu ๐Ÿ“Ž Either way, the details should be the username, then a colon, then the password, followed immediately by end of file ๐Ÿ›‘ No trailing newline, or it'll be counted as part of the password ๐Ÿ˜ฑ
  • --title title โ€” sets the string at the start of the <title> section of the output HTML pages ๐Ÿท๏ธ The default is agedu, and it's followed by a colon and then the path you're viewing within the index file ๐Ÿ“ This is handy if you're serving agedu reports for several different servers and want it to be clear which one someone is looking at ๐Ÿ–ฅ๏ธ
  • --launch shell-command โ€” a command to run with the base URL of the web user interface, once the web server has started up ๐Ÿš€ It's interpreted by /bin/sh, and the base URL gets appended to it as an extra argument word โž•
    • A typical use is --launch=browse, which uses the XDG browse command to automatically open the agedu web interface in your default browser ๐ŸŒ Other uses are possible too: for example, you could provide a command that passes the URL to some other software that will use it for something ๐Ÿงš
  • --no-eof โ€” stops agedu in web server mode from looking for end-of-file on standard input and treating it as a signal to terminate ๐Ÿ›‘

โœจ LIMITATIONS โœจ

okay so the data file is pretty chunky ๐Ÿ˜ The core of agedu is the tree-based data structure it uses in its index to efficiently perform the queries it needs, and this data structure requires O(N log N) storage ๐Ÿงฎ That's bigger than you might expect: a scan of my own home directory, with half a million files and directories and about 20Gb of data, produced an index file over 60Mb in size ๐Ÿ˜ณ Furthermore, since the data file must be memory-mapped during most processing, it can never grow larger than available address space, so a really big filesystem may need to be indexed on a 64-bit computer ๐Ÿ’ป (This is one reason for the existence of the -D and -L options: you can do the scanning on the machine with access to the filesystem, and the indexing on a machine big enough to handle it ๐Ÿง )

The data structure also doesn't usefully permit access control within the data file, so it would be difficult, even with a willingness to do additional coding, to run a system-wide agedu scan on a cron job and serve the right subset of reports to each user ๐Ÿ˜ต

In certain circumstances, agedu can report false positives (reporting files as disused which are in fact in use) as well as the more benign false negatives (reporting files as in use which are not) ๐Ÿ‘ป This arises when a file is, semantically speaking, read' without actually being physically read ๐Ÿ™ƒ Typically this happens when a program checks whether the file's mtime has changed and only bothers re-reading it if it has; programs which do this include rsync(1) and make(1) ๐Ÿ” Such programs fail to update the atime of unmodified files despite depending on their continued existence, so a directory full of such files will be reported as disused by agedu even in situations where deleting them will cause trouble ๐Ÿšจ

Finally, of course, agedu's normal usage mode depends critically on the OS providing last-access times which are at least approximately right ๐ŸŽฏ

๐Ÿšซ So a file system mounted with Linux's noatime option, or the equivalent on any other OS, will not give useful results!

(However, the Linux mount option relatime, which distributions now tend to use by default, should be fine for all but specialist purposes: it reduces the accuracy of last-access times so that they might be wrong by up to 24 hours, but if you're looking for files that have been unused for months or years, that's not a problem ๐ŸŒ™)

โœจ LICENCE โœจ

okay bestie, let's talk legal stuff ๐Ÿ’… agedu is free software ๐ŸŽ€, and it's distributed under the MIT licence ๐Ÿ’œ. If you want to read the full licence text, just type agedu --licence ๐Ÿ“œโœจ


And that's the whole page, bestie! ๐Ÿซถ Huge shoutout to Simon Tatham ๐Ÿ‘‘, who wrote this one on 2008-11-02 ๐ŸŒธ, for agedu(1) ๐Ÿฆ‹ It's giving well-documented energy, periodt ๐Ÿ’–

๐Ÿ“ฆ where this page comes from