AUGTOOL(1)
π NAME π
okay so this is augtool, straight out of the AUGTOOL(1) manual β Augeas, bestie, we're literally in it π
. It inspects and modifies configuration files, and that's the whole vibe.
πΈ SYNOPSIS πΈ
augtool [OPTIONS] [COMMAND]
π¦ DESCRIPTION π¦
Augeas is a configuration editing tool. It parses configuration files in their native formats and transforms them into a tree. Configuration changes are made by manipulating this tree and saving it back into native config files. No cap, that's the whole magic trick β¨.
augtool provides a command line interface to the generated tree. COMMAND can be a single command as described under COMMANDS. When called with no COMMAND, it reads commands from standard input until an end-of-file is encountered.
β¨ OPTIONS β¨
-c,--typecheckβ typecheck lenses, bestie. This can be very slow, and is therefore not done by default, but it's highly recommended during development. fr fr, turn it on while you're building stuff.-b,--backupβ when files are changed, preserve the originals in a file with extension.augsave. Your old files get to live another day π«Ά.-n,--newβ save changes in files with extension.augnew, and do not modify the original files. It's giving "new copy, no touchy" π .-r,--root=ROOTβ use directoryROOTas the root of the filesystem. Takes precedence over a root set with theAUGEAS_ROOTenvironment variable.-I,--include=DIRβ addDIRto the module loadpath. Can be given multiple times. The directories set here are searched before any directories specified in theAUGEAS_LENS_LIBenvironment variable, and before the default directories/usr/share/augeas/lensesand/usr/share/augeas/lenses/dist.-t,--transform=XFMβ add a file transform; uses thetransformcommand syntax, e.g."-t 'Fstab incl /etc/fstab.bak'".-l,--load-file=FILEβ load an individualFILEinto the tree. The lens to use is determined automatically, based on autoload information in the lenses, and will be the same that is used for this file when the entire tree is loaded. The option can be specified multiple times to load several files, e.g.-l /etc/fstab -l /etc/hosts. This lens implies--noload, so that only the files specified with this option will be loaded.-f,--file=FILEβ read commands fromFILE.-i,--interactiveβ read commands from the terminal. When combined with-for redirection of stdin, drop into an interactive session after executing the commands from the file.-e,--echoβ when reading commands from a file via stdin, echo the commands before printing their output.-s,--autosaveβ automatically save all changes at the end of the session. Set it and forget it, iconic behavior π.-S,--nostdincβ do not search any of the default directories for modules. When this option is set, only directories specified explicitly with-Ior specified inAUGEAS_LENS_LIBwill be searched for modules.-L,--noloadβ do not load any files on startup. This is generally used to fine-tune which files to load by modifying the entries in/augeas/loadand then issuing aloadcommand.-A,--noautoloadβ do not load any lens modules, and therefore no files, on startup. This creates no entries under/augeas/loadwhatsoever; to read any files, they need to be set up manually and loading must be initiated with aloadcommand. Using this option gives the fastest startup.--spanβ load span positions for nodes in the tree, as they relate to the original file. Enables the use of thespancommand to retrieve position data.--timingβ after executing each command, print how long, in milliseconds, executing the command took. This makes it easier to spot slow queries, usually throughmatchcommands, and allows exploring alternative queries that yield the same result but might be faster.--versionβ print version information and exit. The version is also in the tree under/augeas/version.
π COMMANDS π
In interactive mode, commands and paths can be completed by pressing TAB. Slay.
The paths accepted as arguments by commands use a small subset of XPath path expressions. A path expression consists of a number of segments, separated by /. In each segment, the character * can be used to match every node regardless of its label. Sibling nodes with identical labels can be distinguished by appending [N] to their label to match the N-th sibling with such a label. The last sibling with a specific label can be reached as [last()]. See EXAMPLES for some examples of this.
π ADMIN COMMANDS π
The following commands control the behavior of Augeas and augtool itself.
helpβ print this help text.loadβ load files according to the transforms in/augeas/load.quitβ exit the program.retrieve <LENS> <NODE_IN> <PATH> <NODE_OUT>β transform tree atPATHback into text using lensLENSand store the resulting string atNODE_OUT. Assume that the tree was initially read in with the same lens and the string stored atNODE_INas input.saveβ save all pending changes to disk. Unless either the-bor-ncommand line options are given, files are changed in place.store <LENS> <NODE> <PATH>β parseNODEusingLENSand store the resulting tree atPATH.transform <LENS> <FILTER> <FILE>β add a transform forFILEusingLENS. TheLENSmay be a module name or a full lens name. If a module name is given, thenlnswill be the lens assumed. TheFILTERmust be eitherinclorexcl. If the filter isincl, theFILEwill be parsed by theLENS. If the filter isexcl, theFILEwill be excluded from theLENS.FILEmay contain wildcards.load-file <FILE>β load a specificFILE, automatically determining the proper lens from the information in/augeas/load; without further intervention, the lens that would oridnarily be used for this file will be used.
π READ COMMANDS π
The following commands are used to retrieve data from the Augeas tree.
dump-xml [<PATH>]β print entries in the tree as XML. IfPATHis given, printing starts there, otherwise the whole tree is printed.get <PATH>β print the value associated withPATH.label <PATH>β get and print the label associated withPATH.ls <PATH>β list the direct children ofPATH.match <PATTERN> [<VALUE>]β find all paths that matchPATTERN. IfVALUEis given, only the matching paths whose value equalsVALUEare printed.print [<PATH>]β print entries in the tree. IfPATHis given, printing starts there, otherwise the whole tree is printed.span <PATH>β print the name of the file from which the nodePATHwas generated, as well as information about the positions in the file corresponding to the label, the value, and the entire node.PATHmust match exactly one node.
You need to run set /augeas/span enable prior to loading files to enable recording of span information. It is disabled by default. Do not forget, bestie π.
π¦ WRITE COMMANDS π¦
The following commands are used to modify the Augeas tree.
clear <PATH>β set the value forPATHtoNULL. IfPATHis not in the tree yet, it and all its ancestors will be created.clearm <BASE> <SUB>β clear multiple nodes values in one operation. Find or create a node matchingSUBby interpretingSUBas a path expression relative to each node matchingBASE. IfSUBis., the nodes matchingBASEwill be modified.ins <LABEL> <WHERE> <PATH>β insert a new node with labelLABELright before or afterPATHinto the tree.WHEREmust be eitherbeforeorafter.insert <LABEL> <WHERE> <PATH>β alias ofins.mv <SRC> <DST>β move nodeSRCtoDST.SRCmust match exactly one node in the tree.DSTmust either match exactly one node in the tree, or may not exist yet. IfDSTexists already, it and all its descendants are deleted. IfDSTdoes not exist yet, it and all its missing ancestors are created.move <SRC> <DST>β alias ofmv.cp <SRC> <DST>β copy nodeSRCtoDST.SRCmust match exactly one node in the tree.DSTmust either match exactly one node in the tree, or may not exist yet. IfDSTexists already, it and all its descendants are deleted. IfDSTdoes not exist yet, it and all its missing ancestors are created.copy <SRC> <DST>β alias ofcp.rename <SRC> <LBL>β rename the label of all nodes matchingSRCtoLBL.rm <PATH>β deletePATHand all its children from the tree.set <PATH> <VALUE>β associateVALUEwithPATH. IfPATHis not in the tree yet, it and all its ancestors will be created.setm <BASE> <SUB> [<VALUE>]β set multiple nodes in one operation. Find or create a node matchingSUBby interpretingSUBas a path expression relative to each node matchingBASE. IfSUBis., the nodes matchingBASEwill be modified.touch <PATH>β createPATHwith the valueNULLif it is not in the tree yet. All its ancestors will also be created. These new tree entries will appear last amongst their siblings.
π§ PATH EXPRESSION COMMANDS π§
The following commands help when working with path expressions.
defnode <NAME> <EXPR> [<VALUE>]β define the variableNAMEto the result of evaluatingEXPR, which must be a nodeset. If no node matchingEXPRexists yet, one is created andNAMEwill refer to it. IfVALUEis given, this is the same asset EXPR VALUE; ifVALUEis not given, the node is created as if withclear EXPRwould, andNAMErefers to that node.defvar <NAME> <EXPR>β define the variableNAMEto the result of evaluatingEXPR. The variable can be used in path expressions as$NAME. Note thatEXPRis evaluated when the variable is defined, not when it is used.
π ENVIRONMENT VARIABLES π
AUGEAS_ROOTβ the file system root, defaults to/. Can be overridden with the-rcommand line option.AUGEAS_LENS_LIBβ colon separated list of directories with lenses. Directories specified here are searched after any directories set with the-Icommand line option, but before the default directories/usr/share/augeas/lensesand/usr/share/augeas/lenses/dist.
π©Ί DIAGNOSTICS π©Ί
Normally, exit status is 0. If one or more commands fail, the exit status is set to a non-zero value.
Note though that failure to load some of the files specified by transforms in /augeas/load is not considered a failure. If it is important to know that all files were loaded, you need to issue a match /augeas//error after loading to find out details about what files could not be loaded and why.
β¨ EXAMPLES β¨
Okay bestie, this is the part where it all clicks. Real commands, real output, let's go π
Command line mode vs. interactive mode π
Two whole vibes. You can yeet a single command at augtool and dip, or you can hang out in the interactive prompt and chat with it like it's your group chat.
# command line mode
augtool print /files/etc/hosts/
# interactive mode
augtool
augtool> help
augtool> print /files/etc/hosts/
See the difference? In command line mode you just pass the command straight after augtool. In interactive mode you open augtool first, get an augtool> prompt, and then type your commands one at a time β help included, because we love a built-in support system π«Ά
Indexing into indexed things π¦
# Print the third entry from the second AcceptEnv line
augtool print '/files/etc/ssh/sshd_config/AcceptEnv[2]/3'
Not me putting a [2] and then a /3 back to back π This one is highkey the path-expression flex: AcceptEnv[2] grabs the second AcceptEnv line, and then /3 grabs the third entry inside it. Nested indexing, main character energy, periodt β¨
Matching on a value π₯
# Find the entry in inittab with action 'initdefault'
augtool> match /files/etc/inittab/*/action initdefault
The match command with a wildcard * for the entry name, then /action, and initdefault as the value to hunt for. It's giving "find me the one specific thing in this whole file" and honestly? Slay πΈ
Last-element selects π
# Print the last alias for each entry in /etc/hosts
augtool> print /files/etc/hosts/*/alias[last()]
[last()] the icon β it takes every entry via *, then each one's alias, and pulls only the last one from each. Every single entry gets its final alias printed. No cap, that's iconic π
π FILES π
Lenses and schema definitions live in:
/usr/share/augeas/lenses/usr/share/augeas/lenses/dist
That's where the magic sauce lives, bestie β the actual lens definitions that teach Augeas how to read your config files. Don't go editing these unless you know exactly what you're doing, k? π
π AUTHOR π
David Lutterkort <lutter@watzmann.net>
The literal legend who made this whole thing. Respect the founder π«‘
π COPYRIGHT AND LICENSE π
Copyright 2007-2016 David Lutterkort
Augeas (and augtool) are distributed under the GNU Lesser General Public License (LGPL)
Fr fr, if you're gonna redistribute or modify it, read the LGPL first. Not tryna be a buzzkill, just keep it legal bestie π
π SEE ALSO π
- Augeas project homepage
<http://www.augeas.net/>β go say hi to the mothership π - Augeas path expressions
<https://github.com/hercules-team/augeas/wiki/Path-expressions>β lowkey essential reading if you wanna actually speak the path language. iykyk β¨ augparseaugprint
Okay that's the whole page, you made it to the end, I'm so proud of you π₯Ήπ Go forth and print things with confidence. Mwah π
Augeas 1.15.0 β dated 2026-09-29, respectfully π
π¦ where this page comes from
- arch rolling: augeas 1.15.0-1 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms