.\" agedu version 20211129.8cd63c5 .ie \n(.g .ds Aq \(aq .el .ds Aq ' .TH "agedu" "1" "2008\(hy11\(hy02" "Simon\ Tatham" "Simon\ Tatham" .SH "NAME" .PP \fBagedu\fP - correlate disk usage with last-access times to identify large and disused data .SH "SYNOPSIS" .PP .nf \fBagedu\fP\ [\ \fIoptions\fP\ ]\ \fIaction\fP\ [\fIaction\fP...] .fi .SH "DESCRIPTION" .PP \fBagedu\fP scans a directory tree and produces reports about how much disk space is used in each directory and subdirectory, and also how that usage of disk space corresponds to files with last-access times a long time ago. .PP In other words, \fBagedu\fP is a tool you might use to help you free up disk space. It lets you see which directories are taking up the most space, as \fBdu\fP does; but unlike \fBdu\fP, it also distinguishes between large collections of data which are still in use and ones which have not been accessed in months or years - for instance, large archives downloaded, unpacked, used once, and never cleaned up. Where \fBdu\fP helps you find what\*(Aqs using your disk space, \fBagedu\fP helps you find what\*(Aqs \fIwasting\fP your disk space. .PP \fBagedu\fP has several operating modes. In one mode, it scans your disk and builds an index file containing a data structure which allows it to efficiently retrieve any information it might need. Typically, you would use it in this mode first, and then run it in one of a number of `query' modes to display a report of the disk space usage of a particular directory and its subdirectories. Those reports can be produced as plain text (much like \fBdu\fP) or as HTML. \fBagedu\fP can even run as a miniature web server, presenting each directory\*(Aqs HTML report with hyperlinks to let you navigate around the file system to similar reports for other directories. .PP So you would typically start using \fBagedu\fP by telling it to do a scan of a directory tree and build an index. This is done with a command such as .PP .nf $\ \fBagedu\ \-s\ /home/fred\fP .fi .PP which will build a large data file called \fBagedu.dat\fP in your current directory. (If that current directory is \fIinside\fP \fB/home/fred\fP, don\*(Aqt worry - \fBagedu\fP is smart enough to discount its own index file.) .PP Having built the index, you would now query it for reports of disk space usage. If you have a graphical web browser, the simplest and nicest way to query the index is by running \fBagedu\fP in web server mode: .PP .nf $\ \fBagedu\ \-w\fP .fi .PP which will print (among other messages) a URL on its standard output along the lines of .PP .nf URL:\ http://127.0.0.1:48638/ .fi .PP (That URL will always begin with `\fB127.\fP', meaning that it\*(Aqs in the \fBlocalhost\fP address space. So only processes running on the same computer can even try to connect to that web server, and also there is access control to prevent other users from seeing it - see below for more detail.) .PP Now paste that URL into your web browser, and you will be shown a graphical representation of the disk usage in \fB/home/fred\fP and its immediate subdirectories, with varying colours used to show the difference between disused and recently-accessed data. Click on any subdirectory to descend into it and see a report for its subdirectories in turn; click on parts of the pathname at the top of any page to return to higher-level directories. When you\*(Aqve finished browsing, you can just press Ctrl-D to send an end-of-file indication to \fBagedu\fP, and it will shut down. .PP After that, you probably want to delete the data file \fBagedu.dat\fP, since it\*(Aqs pretty large. In fact, the command \fBagedu -R\fP will do this for you; and you can chain \fBagedu\fP commands on the same command line, so that instead of the above you could have done .PP .nf $\ \fBagedu\ \-s\ /home/fred\ \-w\ \-R\fP .fi .PP for a single self-contained run of \fBagedu\fP which builds its index, serves web pages from it, and cleans it up when finished. .PP In some situations, you might want to scan the directory structure of one computer, but run \fBagedu\fP\*(Aqs user interface on another. In that case, you can do your scan using the \fBagedu -S\fP option in place of \fBagedu -s\fP, which will make \fBagedu\fP not bother building an index file but 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 other technique you prefer), and there, run \fBagedu -L\fP to load in the textual dump and turn it into an index file. For example, you might run a command like this (plus any \fBssh\fP options you need) on the machine you want to scan: .PP .nf $\ \fBagedu\ \-S\ /home/fred\ |\ ssh\ indexing\-machine\ agedu\ \-L\fP .fi .PP or, equivalently, run something like this on the other machine: .PP .nf $\ \fBssh\ machine\-to\-scan\ agedu\ \-S\ /home/fred\ |\ agedu\ \-L\fP .fi .PP Either way, the \fBagedu -L\fP command will create an \fBagedu.dat\fP index file, which you can then use with \fBagedu -w\fP just as above. .PP (Another way to do this might be to build the index file on the first machine as normal, and then just 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 \fBagedu\fP is compiled for. So if that doesn\*(Aqt match between the two machines - e.g. if one is a 32-bit machine and one 64-bit - then \fBagedu.dat\fP files written on one machine will not work on the other. The technique described above using \fB-S\fP and \fB-L\fP should work between any two machines.) .PP If you don't have a graphical web browser, you can do text-based queries instead of using \fBagedu\fP\*(Aqs web interface. Having scanned \fB/home/fred\fP in any of the ways suggested above, you might run .PP .nf $\ \fBagedu\ \-t\ /home/fred\fP .fi .PP which again gives a summary of the disk usage in \fB/home/fred\fP and its immediate subdirectories; but this time \fBagedu\fP will print it on standard output, in much the same format as \fBdu\fP. If you then want to find out how much \fIold\fP data is there, you can add the \fB-a\fP option to show only files last accessed a certain length of time ago. For example, to show only files which haven\*(Aqt been looked at in six months or more: .PP .nf $\ \fBagedu\ \-t\ /home/fred\ \-a\ 6m\fP .fi .PP That's the essence of what \fBagedu\fP does. It has other modes of operation for more complex situations, and the usual array of configurable options. The following sections contain a complete reference for all its functionality. .SH "OPERATING MODES" .PP This section describes the operating modes supported by \fBagedu\fP. Each of these is in the form of a command-line option, sometimes with an argument. Multiple operating-mode options may appear on the command line, in which case \fBagedu\fP will perform the specified actions one after another. For instance, as shown in the previous section, you might want to perform a disk scan and immediately launch a web server giving reports from that scan. .IP "\fB-s\fP \fIdirectory\fP or \fB--scan\fP \fIdirectory\fP" In this mode, \fBagedu\fP scans the file system starting at the specified directory, and indexes the results of the scan into a large data file which other operating modes can query. .RS .PP By default, the scan is restricted to a single file system (since the expected use of \fBagedu\fP is that you would probably use it because a particular disk partition was running low on space). You can remove that restriction using the \fB--cross-fs\fP option; other configuration options allow you to include or exclude files or entire subdirectories from the scan. See the next section for full details of the configurable options. .PP The index file is created with restrictive permissions, in case the file system you are scanning contains confidential information in its structure. .PP Index files are dependent on the characteristics of the CPU architecture you created them on. You should not expect to be able to move an index file between different types of computer and have it continue to work. If you need to transfer the results of a disk scan to a different kind of computer, see the \fB-D\fP and \fB-L\fP options below. .RE .IP "\fB-w\fP or \fB--web\fP" In this mode, \fBagedu\fP expects to find an index file already written. It allocates a network port, and starts up a web server on that port which serves reports generated from the index file. By default it invents its own URL and prints it out. .RS .PP The web server runs until \fBagedu\fP receives an end-of-file event on its standard input. (The expected usage is that you run it from the command line, immediately browse web pages until you\*(Aqre satisfied, and then press Ctrl-D.) To disable the EOF behaviour, use the \fB--no-eof\fP option. .PP In case the index file contains any confidential information about your file system, the web server protects the pages it serves from access by other people. On Linux, this is done transparently by means of using \fB/proc/net/tcp\fP to check the owner of each incoming connection; failing that, the web server will require a password to view the reports, and \fBagedu\fP will print the password it invented on standard output along with the URL. .PP Configurable options for this mode let you specify your own address and port number to listen on, and also specify your own choice of authentication method (including turning authentication off completely) and a username and password of your choice. .RE .IP "\fB-t\fP \fIdirectory\fP or \fB--text\fP \fIdirectory\fP" In this mode, \fBagedu\fP generates a textual report on standard output, listing the disk usage in the specified directory and all its subdirectories down to a given depth. By default that depth is 1, so that you see a report for \fIdirectory\fP itself and all of its immediate subdirectories. You can configure a different depth (or no depth limit) using \fB-d\fP, described in the next section. .RS .PP Used on its own, \fB-t\fP merely lists the \fItotal\fP disk usage in each subdirectory; \fBagedu\fP\*(Aqs additional ability to distinguish unused from recently-used data is not activated. To activate it, use the \fB-a\fP option to specify a minimum age. .PP The directory structure stored in \fBagedu\fP\*(Aqs index file is treated as a set of literal strings. This means that you cannot refer to directories by synonyms. So if you ran \fBagedu -s .\fP, then all the path names you later pass to the \fB-t\fP option must be either `\fB.\fP' or begin with `\fB./\fP'. Similarly, symbolic links within the directory you scanned will not be followed; you must refer to each directory by its canonical, symlink-free pathname. .RE .IP "\fB-R\fP or \fB--remove\fP" In this mode, \fBagedu\fP deletes its index file. Running just \fBagedu -R\fP on its own is therefore equivalent to typing \fBrm agedu.dat\fP. However, you can also put \fB-R\fP on the end of a command line to indicate that \fBagedu\fP should delete its index file after it finishes performing other operations. .IP "\fB-S\fP \fIdirectory\fP or \fB--scan-dump\fP \fIdirectory\fP" In this mode, \fBagedu\fP will scan a directory tree and convert the results straight into a textual dump on standard output, without generating an index file at all. The dump data is intended for \fBagedu -L\fP to read. .IP "\fB-L\fP or \fB--load\fP" In this mode, \fBagedu\fP expects to read a dump produced by the \fB-S\fP option from its standard input. It constructs an index file from that dump, exactly as it would have if it had read the same data from a disk scan in \fB-s\fP mode. .IP "\fB-D\fP or \fB--dump\fP" In this mode, \fBagedu\fP reads an existing index file and produces a dump of its contents on standard output, in the same format used by \fB-S\fP and \fB-L\fP. This option could be used to convert an existing index file into a format acceptable to a different kind of computer, by dumping it using \fB-D\fP and then loading the dump back in on the other machine using \fB-L\fP. .RS .PP (The output of \fBagedu -D\fP on an existing index file will not be exactly \fIidentical\fP to what \fBagedu -S\fP would have originally produced, due to a difference in treatment of last-access times on directories. However, it should be effectively equivalent for most purposes. See the documentation of the \fB--dir-atime\fP option in the next section for further detail.) .RE .IP "\fB-H\fP \fIdirectory\fP or \fB--html\fP \fIdirectory\fP" In this mode, \fBagedu\fP will generate an HTML report of the disk usage in the specified directory and its immediate subdirectories, in the same form that it serves from its web server in \fB-w\fP mode. .RS .PP By default, a single HTML report will be generated and simply written to standard output, with no hyperlinks pointing to other similar pages. If you also specify the \fB-d\fP option (see below), \fBagedu\fP will instead write out a collection of HTML files with hyperlinks between them, and call the top-level file \fBindex.html\fP. .RE .IP "\fB--cgi\fP" In this mode, \fBagedu\fP will run as the bulk of a CGI script which provides the same set of web pages as the built-in web server would. It will read the usual CGI environment variables, and write CGI-style data to its standard output. .RS .PP The actual CGI program itself should be a tiny wrapper around \fBagedu\fP which passes it the \fB--cgi\fP option, and also (probably) \fB-f\fP to locate the index file. \fBagedu\fP will do everything else. For example, your script might read .PP .nf #!/bin/sh \fI/some/path/to/\fPagedu\ \-\-cgi\ \-f\ \fI/some/other/path/to/\fPagedu.dat .fi .PP (Note that \fBagedu\fP will produce the \fIentire\fP CGI output, including status code, HTTP headers and the full HTML document. If you try to surround the call to \fBagedu --cgi\fP with code that adds your own HTML header and footer, you won\*(Aqt get the results you want, and \fBagedu\fP\*(Aqs HTTP-level features such as auto-redirecting to canonical versions of URIs will stop working.) .PP No access control is performed in this mode: restricting access to CGI scripts is assumed to be the job of the web server. .RE .IP "\fB--presort\fP and \fB--postsort\fP" In these two modes, \fBagedu\fP will expect to read a textual data dump from its standard input of the form produced by \fB-S\fP (and \fB-D\fP). It will transform the data into a different version of its text dump format, and write the transformed version on standard output. .RS .PP The ordinary dump file format is reasonably readable, but loading it into an index file using \fBagedu -L\fP requires it to be sorted in a specific order, which is complicated to describe and difficult to implement using ordinary Unix sorting tools. So if you want to construct your own data dump from a source of your own that \fBagedu\fP itself doesn\*(Aqt know how to scan, you will need to make sure it\*(Aqs sorted in the right order. .PP To help with this, \fBagedu\fP provides a secondary dump format which is `sortable', in the sense that ordinary \fBsort\fP(\fI1\fP) without arguments will arrange it into the right order. However, the sortable format is much more unreadable and also twice the size, so you wouldn\*(Aqt want to write it directly! .PP So the recommended procedure is to generate dump data in the ordinary format; then pipe it through \fBagedu --presort\fP to turn it into the sortable format; then sort it; \fIthen\fP pipe it into \fBagedu -L\fP (which can accept either the normal or the sortable format as input). For example: .PP .nf \fIgenerate_custom_data.sh\fP\ |\ agedu\ \-\-presort\ |\ sort\ |\ agedu\ \-L .fi .PP If you need to transform the sorted dump file back into the ordinary format, \fBagedu --postsort\fP can do that. But since \fBagedu -L\fP can accept either format as input, you may not need to. .RE .IP "\fB-h\fP or \fB--help\fP" Causes \fBagedu\fP to print some help text and terminate immediately. .IP "\fB-V\fP or \fB--version\fP" Causes \fBagedu\fP to print its version number and terminate immediately. .SH "OPTIONS" .PP This section describes the various configuration options that affect \fBagedu\fP\*(Aqs operation in one mode or another. .PP The following option affects nearly all modes (except \fB-S\fP): .IP "\fB-f\fP \fIfilename\fP or \fB--file\fP \fIfilename\fP" Specifies the location of the index file which \fBagedu\fP creates, reads or removes depending on its operating mode. By default, this is simply `\fBagedu.dat\fP', in whatever is the current working directory when you run \fBagedu\fP. .PP The following options affect the disk-scanning modes, \fB-s\fP and \fB-S\fP: .IP "\fB--cross-fs\fP and \fB--no-cross-fs\fP" These configure whether or not the disk scan is permitted to cross between different file systems. The default is not to: \fBagedu\fP will normally skip over subdirectories on which a different file system is mounted. This makes it convenient when you want to free up space on a particular file system which is running low. However, in other circumstances you might wish to see general information about the use of space no matter which file system it\*(Aqs on (for instance, if your real concern is your backup media running out of space, and if your backups do not treat different file systems specially); in that situation, use \fB--cross-fs\fP. .RS .PP (Note that this default is the opposite way round from the corresponding option in \fBdu\fP.) .RE .IP "\fB--prune\fP \fIwildcard\fP and \fB--prune-path\fP \fIwildcard\fP" These cause particular files or directories to be omitted entirely from the scan. If \fBagedu\fP\*(Aqs scan encounters a file or directory whose name matches the wildcard provided to the \fB--prune\fP option, it will not include that file in its index, and also if it\*(Aqs a directory it will skip over it and not scan its contents. .RS .PP Note that in most Unix shells, wildcards will probably need to be escaped on the command line, to prevent the shell from expanding the wildcard before \fBagedu\fP sees it. .PP \fB--prune-path\fP is similar to \fB--prune\fP, except that the wildcard is matched against the entire pathname instead of just the filename at the end of it. So whereas \fB--prune *a*b*\fP will match any file whose actual name contains an \fBa\fP somewhere before a \fBb\fP, \fB--prune-path *a*b*\fP will also match a file whose name contains \fBb\fP and which is inside a directory containing an \fBa\fP, or any file inside a directory of that form, and so on. .RE .IP "\fB--exclude\fP \fIwildcard\fP and \fB--exclude-path\fP \fIwildcard\fP" These cause particular files or directories to be omitted from the index, but not from the scan. If \fBagedu\fP\*(Aqs scan encounters a file or directory whose name matches the wildcard provided to the \fB--exclude\fP option, it will not include that file in its index - but unlike \fB--prune\fP, if the file in question is a directory it will still scan its contents and index them if they are not ruled out themselves by \fB--exclude\fP options. .RS .PP As above, \fB--exclude-path\fP is similar to \fB--exclude\fP, except that the wildcard is matched against the entire pathname. .RE .IP "\fB--include\fP \fIwildcard\fP and \fB--include-path\fP \fIwildcard\fP" These cause particular files or directories to be re-included in the index and the scan, if they had previously been ruled out by one of the above exclude or prune options. You can interleave include, exclude and prune options as you wish on the command line, and if more than one of them applies to a file then the last one takes priority. .RS .PP For example, if you wanted to see only the disk space taken up by MP3 files, you might run .PP .nf $\ \fBagedu\ \-s\ .\ \-\-exclude\ \*(Aq*\*(Aq\ \-\-include\ \*(Aq*.mp3\*(Aq\fP .fi .PP which will cause everything to be omitted from the scan, but then the MP3 files to be put back in. If you then wanted only a subset of those MP3s, you could then exclude some of them again by adding, say, `\fB--exclude-path \*(Aq./queen/*\*(Aq\fP' (or, more efficiently, `\fB--prune ./queen\fP') on the end of that command. .PP As with the previous two options, \fB--include-path\fP is similar to \fB--include\fP except that the wildcard is matched against the entire pathname. .RE .IP "\fB--progress\fP, \fB--no-progress\fP and \fB--tty-progress\fP" When \fBagedu\fP is scanning a directory tree, it will typically print a one-line progress report every second showing where it has reached in the scan, so you can have some idea of how much longer it will take. (Of course, it can\*(Aqt predict \fIexactly\fP how long it will take, since it doesn\*(Aqt know which of the directories it hasn\*(Aqt scanned yet will turn out to be huge.) .RS .PP By default, those progress reports are displayed on \fBagedu\fP\*(Aqs standard error channel, if that channel points to a terminal device. If you need to manually enable or disable them, you can use the above three options to do so: \fB--progress\fP unconditionally enables the progress reports, \fB--no-progress\fP unconditionally disables them, and \fB--tty-progress\fP reverts to the default behaviour which is conditional on standard error being a terminal. .RE .IP "\fB--dir-atime\fP and \fB--no-dir-atime\fP" In normal operation, \fBagedu\fP ignores the atimes (last access times) on the \fIdirectories\fP it scans: it only pays attention to the atimes of the \fIfiles\fP inside those directories. This is because directory atimes tend to be reset by a lot of system administrative tasks, such as \fBcron\fP jobs which scan the file system for one reason or another - or even other invocations of \fBagedu\fP itself, though it tries to avoid modifying any atimes if possible. So the literal atimes on directories are typically not representative of how long ago the data in question was last accessed with real intent to use that data in particular. .RS .PP Instead, \fBagedu\fP makes up a fake atime for every directory it scans, which is equal to the newest atime of any file in or below that directory (or the directory\*(Aqs last \fImodification\fP time, whichever is newest). This is based on the assumption that all \fIimportant\fP accesses to directories are actually accesses to the files inside those directories, so that when any file is accessed all the directories on the path leading to it should be considered to have been accessed as well. .PP In unusual cases it is possible that a directory itself might embody important data which is accessed by reading the directory. In that situation, \fBagedu\fP\*(Aqs atime-faking policy will misreport the directory as disused. In the unlikely event that such directories form a significant part of your disk space usage, you might want to turn off the faking. The \fB--dir-atime\fP option does this: it causes the disk scan to read the original atimes of the directories it scans. .PP The faking of atimes on directories also requires a processing pass over the index file after the main disk scan is complete. \fB--dir-atime\fP also turns this pass off. Hence, this option affects the \fB-L\fP option as well as \fB-s\fP and \fB-S\fP. .PP (The previous section mentioned that there might be subtle differences between the output of \fBagedu -s /path -D\fP and \fBagedu -S /path\fP. This is why. Doing a scan with \fB-s\fP and then dumping it with \fB-D\fP will dump the fully faked atimes on the directories, whereas doing a scan-to-dump with \fB-S\fP will dump only \fIpartially\fP faked atimes - specifically, each directory\*(Aqs last modification time - since the subsequent processing pass will not have had a chance to take place. However, loading either of the resulting dump files with \fB-L\fP 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.) .RE .IP "\fB--mtime\fP" This option causes \fBagedu\fP to index files by their last modification time instead of their last access time. You might want to use this if your last access times were completely useless for some reason: for example, if you had recently searched every file on your system, the system would have lost all the information about what files you hadn\*(Aqt recently accessed before then. Using this option is liable to be less effective at finding genuinely wasted space than the normal mode (that is, it will be more likely to flag things as disused when they\*(Aqre not, so you will have more candidates to go through by hand looking for data you don\*(Aqt need), but may be better than nothing if your last-access times are unhelpful. .RS .PP Another use for this mode might be to find \fIrecently created\fP large data. If your disk has been gradually filling up for years, the default mode of \fBagedu\fP will let you find unused data to delete; but if you know your disk had plenty of space recently and now it\*(Aqs suddenly full, and you suspect that some rogue program has left a large core dump or output file, then \fBagedu --mtime\fP might be a convenient way to locate the culprit. .RE .IP "\fB--logicalsize\fP" This option causes \fBagedu\fP to consider the size of each file to be its `logical' size, rather than the amount of space it consumes on disk. (That is, it will use \fBst_size\fP instead of \fBst_blocks\fP in the data returned from \fBstat\fP(\fI2\fP).) This option makes \fBagedu\fP less accurate at reporting how much of your disk is used, but it might be useful in specialist cases, such as working around a file system that is misreporting physical sizes. .RS .PP For most files, the physical size of a file will be larger than the logical size, reflecting the fact that filesystem layouts generally allocate a whole number of blocks of the disk to each file, so some space is wasted at the end of the last block. So counting only the logical file size will typically cause under-reporting of the disk usage (perhaps \fIlarge\fP under-reporting in the case of a very large number of very small files). .PP On the other hand, sometimes a file with a very large logical size can have `holes' where no data is actually stored, in which case using the logical size of the file will \fIover\fP-report its disk usage. So the use of logical sizes can give wrong answers in both directions. .RE .PP The following option affects all the modes that generate reports: the web server mode \fB-w\fP, the stand-alone HTML generation mode \fB-H\fP and the text report mode \fB-t\fP. .IP "\fB--files\fP" This option causes \fBagedu\fP\*(Aqs reports to list the individual files in each directory, instead of just giving a combined report for everything that\*(Aqs not in a subdirectory. .PP The following option affects the text report mode \fB-t\fP. .IP "\fB-a\fP \fIage\fP or \fB--age\fP \fIage\fP" This option tells \fBagedu\fP to report only files of at least the specified age. An age is specified as a number, followed by one of `\fBy\fP' (years), `\fBm\fP' (months), `\fBw\fP' (weeks) or `\fBd\fP' (days). (This syntax is also used by the \fB-r\fP option.) For example, \fB-a 6m\fP will produce a text report which includes only files at least six months old. .PP The following options affect the stand-alone HTML generation mode \fB-H\fP and the text report mode \fB-t\fP. .IP "\fB-d\fP \fIdepth\fP or \fB--depth\fP \fIdepth\fP" This option controls the maximum depth to which \fBagedu\fP recurses when generating a text or HTML report. .RS .PP In text mode, the default is 1, meaning that the report will include the directory given on the command line and all of its immediate subdirectories. A depth of two includes another level below that, and so on; a depth of zero means \fIonly\fP the directory on the command line. .PP In HTML mode, specifying this option switches \fBagedu\fP from writing out a single HTML file to writing out multiple files which link to each other. A depth of 1 means \fBagedu\fP will write out an HTML file for the given directory and also one for each of its immediate subdirectories. .PP If you want \fBagedu\fP to recurse as deeply as possible, give the special word `\fBmax\fP' as an argument to \fB-d\fP. .RE .IP "\fB-o\fP \fIfilename\fP or \fB--output\fP \fIfilename\fP" This option is used to specify an output file for \fBagedu\fP to write its report to. In text mode or single-file HTML mode, the argument is treated as the name of a file. In multiple-file HTML mode, the argument is treated as the name of a directory: the directory will be created if it does not already exist, and the output HTML files will be created inside it. .PP The following option affects only the stand-alone HTML generation mode \fB-H\fP, and even then, only in recursive mode (with \fB-d\fP): .IP "\fB--numeric\fP" This option tells \fBagedu\fP to name most of its output HTML files numerically. The root of the whole output file collection will still be called \fBindex.html\fP, but all the rest will have names like \fB73.html\fP or \fB12525.html\fP. (The numbers are essentially arbitrary; in fact, they\*(Aqre indices of nodes in the data structure used by \fBagedu\fP\*(Aqs index file.) .RS .PP This system of file naming is less intuitive than the default of naming files after the sub-pathname they index. It's also less stable: the same pathname will not necessarily be represented by the same filename if \fBagedu -H\fP is re-run after another scan of the same directory tree. However, it does have the virtue that it keeps the filenames \fIshort\fP, so that even if your directory tree is very deep, the output HTML files won\*(Aqt exceed any OS limit on filename length. .RE .PP The following options affect the web server mode \fB-w\fP, and in some cases also the stand-alone HTML generation mode \fB-H\fP: .IP "\fB-r\fP \fIage range\fP or \fB--age-range\fP \fIage range\fP" The HTML reports produced by \fBagedu\fP use a range of colours to indicate how long ago data was last accessed, running from red (representing the most disused data) to green (representing the newest). By default, the lengths of time represented by the two ends of that spectrum are chosen by examining the data file to see what range of ages appears in it. However, you might want to set your own limits, and you can do this using \fB-r\fP. .RS .PP The argument to \fB-r\fP consists of a single age, or two ages separated by a minus sign. An age is a number, followed by one of `\fBy\fP' (years), `\fBm\fP' (months), `\fBw\fP' (weeks) or `\fBd\fP' (days). (This syntax is also used by the \fB-a\fP option.) The first age in the range represents the oldest data, and will be coloured red in the HTML; the second age represents the newest, coloured green. If the second age is not specified, it will default to zero (so that green means data which has been accessed \fIjust now\fP). .PP For example, \fB-r 2y\fP will mark data in red if it has been unused for two years or more, and green if it has been accessed just now. \fB-r 2y-3m\fP will similarly mark data red if it has been unused for two years or more, but will mark it green if it has been accessed three months ago or later. .RE .IP "\fB--address\fP \fIaddr\fP[\fB:\fP\fIport\fP]" Specifies the network address and port number on which \fBagedu\fP should listen when running its web server. If you want \fBagedu\fP to listen for connections coming in from any source, specify the address as the special value \fBANY\fP. If the port number is omitted, an arbitrary unused port will be chosen for you and displayed. .RS .PP If you specify this option, \fBagedu\fP will not print its URL on standard output (since you are expected to know what address you told it to listen to). .RE .IP "\fB--auth\fP \fIauth-type\fP" Specifies how \fBagedu\fP should control access to the web pages it serves. The options are as follows: .RS .IP "\fBmagic\fP" This option only works on Linux, and only when the incoming connection is from the same machine that \fBagedu\fP is running on. On Linux, the special file \fB/proc/net/tcp\fP contains a list of network connections currently known to the operating system kernel, including which user id created them. So \fBagedu\fP will look up each incoming connection in that file, and allow access if it comes from the same user id under which \fBagedu\fP itself is running. Therefore, in \fBagedu\fP\*(Aqs 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. .IP "\fBbasic\fP" In this mode, \fBagedu\fP will use HTTP Basic authentication: the user will have to provide a username and password via their browser. \fBagedu\fP will normally make up a username and password for the purpose, but you can specify your own; see below. .IP "\fBnone\fP" In this mode, the web server is unauthenticated: anyone connecting to it has full access to the reports generated by \fBagedu\fP. Do not do this unless there is nothing confidential at all in your index file, or unless you are certain that nobody but you can run processes on your computer. .IP "\fBdefault\fP" This is the default mode if you do not specify one of the above. In this mode, \fBagedu\fP will attempt to use Linux magic authentication, but if it detects at startup time that \fB/proc/net/tcp\fP is absent or non-functional then it will fall back to using HTTP Basic authentication and invent a user name and password. .RE .IP "\fB--auth-file\fP \fIfilename\fP or \fB--auth-fd\fP \fIfd\fP" When \fBagedu\fP is using HTTP Basic authentication, these options allow you to specify your own user name and password. If you specify \fB--auth-file\fP, these will be read from the specified file; if you specify \fB--auth-fd\fP they will instead be read from a given file descriptor which you should have arranged to pass to \fBagedu\fP. In either case, the authentication details should consist of the username, followed by a colon, followed by the password, followed \fIimmediately\fP by end of file (no trailing newline, or else it will be considered part of the password). .IP "\fB--title\fP \fItitle\fP" Specify the string that appears at the start of the \fB\fP section of the output HTML pages. The default is `\fBagedu\fP'. This title is followed by a colon and then the path you\*(Aqre viewing within the index file. You might use this option if you were serving \fBagedu\fP reports for several different servers and wanted to make it clearer which one a user was looking at. .IP "\fB--launch\fP \fIshell-command\fP" Specify a command to be run with the base URL of the web user interface, once the web server has started up. The command will be interpreted by \fB/bin/sh\fP, and the base URL will be appended to it as an extra argument word. .RS .PP A typical use for this would be `\fB--launch=browse\fP', which uses the XDG `\fBbrowse\fP' command to automatically open the \fBagedu\fP web interface in your default browser. However, other uses are possible: for example, you could provide a command which communicates the URL to some other software that will use it for something. .RE .IP "\fB--no-eof\fP" Stop \fBagedu\fP in web server mode from looking for end-of-file on standard input and treating it as a signal to terminate. .SH "LIMITATIONS" .PP The data file is pretty large. The core of \fBagedu\fP is the tree-based data structure it uses in its index in order to efficiently perform the queries it needs; this data structure requires \fBO(N log N)\fP storage. This is larger than you might expect; a scan of my own home directory, containing 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 \fIreally\fP big filesystem may need to be indexed on a 64-bit computer. (This is one reason for the existence of the \fB-D\fP and \fB-L\fP 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.) .PP The data structure also does not usefully permit access control within the data file, so it would be difficult - even given the willingness to do additional coding - to run a system-wide \fBagedu\fP scan on a \fBcron\fP job and serve the right subset of reports to each user. .PP In certain circumstances, \fBagedu\fP 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 \fIread\fP. Typically this occurs when a program checks whether the file\*(Aqs mtime has changed and only bothers re-reading it if it has; programs which do this include \fBrsync\fP(\fI1\fP) and \fBmake\fP(\fI1\fP). Such programs will fail to update the atime of unmodified files despite depending on their continued existence; a directory full of such files will be reported as disused by \fBagedu\fP even in situations where deleting them will cause trouble. .PP Finally, of course, \fBagedu\fP\*(Aqs 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\*(Aqs `\fBnoatime\fP' option, or the equivalent on any other OS, will not give useful results! (However, the Linux mount option `\fBrelatime\fP', 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\*(Aqre looking for files that have been unused for months or years, that\*(Aqs not a problem.) .SH "LICENCE" .PP \fBagedu\fP is free software, distributed under the MIT licence. Type \fBagedu --licence\fP to see the full licence text.