fstab-decode turns the escaped paths inside /etc/fstab back into real characters before handing them to another command. The installed utility is from sysvinit-utils 3.08-6ubuntu3 and lives at /usr/sbin/fstab-decode. This guide uses harmless printf checks first, then shows how the same pattern relates to filesystem commands.
Allow about ten minutes. You need a shell, the sysvinit-utils package, and a readable source of fstab-style path arguments. The examples do not change mounts or files. The final unmount pattern is potentially service-disrupting, and should only be run after reviewing its decoded arguments.
Confirm that the utility is available, and see which copy your shell will run:
$ command -v fstab-decode
/usr/sbin/fstab-decode
$ fstab-decode
Usage: fstab-decode command [arguments]
Checkpoint: the usage line should identify command [arguments]. If the command is missing, install or repair the package through your normal system administration process. Do not copy a replacement binary into /usr/sbin.
fstab represents spaces and tabs in a path as \040 and \011. A newline is \012, and a literal backslash is \134. Pass those sequences as shell arguments and let printf display the result:
$ fstab-decode printf 'arg=<%s>\n' 'plain' 'archive\040old' 'tab\011name' 'line\012break' 'slash\134name'
arg=<plain>
arg=<archive old>
arg=<tab name>
arg=<line
break>
arg=<slash\name>
Each encoded value stays one argument. The decoded space or newline is data inside that argument; it does not cause a second round of shell word splitting. The visible tab and line break in the output are expected.
Run a compact argument-count check when the distinction matters:
$ fstab-decode sh -c 'printf "argc=%s\n" "$#"; printf "arg=<%s>\n" "$@"' sh 'one\040two' 'three'
argc=2
arg=<one two>
arg=<three>
The extra sh after -c is the shell's $0; the remaining values become $1 and later positional parameters.
The useful workflow is to produce one fstab-escaped path per line, then use command substitution to pass those lines as separate shell words. This read-only example previews VFAT mount points from the local fstab instead of unmounting anything:
$ (set -f; fstab-decode printf 'mountpoint=<%s>\n' $(awk '$3 == "vfat" { print $2 }' /etc/fstab))
(no output on this machine)
Your output may be empty, or may contain different mount points. The subshell's set -f disables pathname expansion while the command substitution is expanded. That matters because an asterisk or question mark in an input path could otherwise be treated as a shell pattern before fstab-decode sees it. The subshell keeps that setting from changing your interactive shell.
Review the generated list separately if the result is unexpected:
$ awk '$3 == "vfat" { print $2 }' /etc/fstab
(no output on this machine)
Do not add quotes around the entire command substitution in this pattern. Quoting it would pass the complete multi-line output as one argument, rather than one argument per source line.
The manual's representative use is unmounting every VFAT mount point listed in /etc/fstab:
$ (set -f; sudo fstab-decode umount $(awk '$3 == "vfat" { print $2 }' /etc/fstab))
Warning: stop before running this. umount can interrupt users and services, and sudo elevates the operation.
mount command or service configuration for that host. There is no automatic undo supplied by fstab-decode.A safer habit is to replace umount with printf until the argument list is exactly right. Keep the command in a subshell so the temporary glob setting is not retained.
If the target command cannot be started, fstab-decode exits with status 127 and reports the operating system error:
$ fstab-decode command-that-does-not-exist
fstab-decode: command-that-does-not-exist: No such file or directory
$ printf '%s\n' "$?"
127
When the command does start, fstab-decode returns the target command's status. Capture it immediately if a script needs to act on failure:
fstab-decode some-command 'path\040with\040spaces'
status=$?
if [ "$status" -ne 0 ]; then
printf 'decoded command failed with status %s\n' "$status" >&2
exit "$status"
fi
Do not treat a successful decode as proof that a path exists, is mounted, or is safe to operate on. Those are separate checks belonging to the command you are running.
fstab-decode resolves to the installed utility and accepts a command plus arguments.\040, \011, \012 and \134 decode to the intended path characters.