FSTAB-DECODE(8)

๐Ÿ“ฆ
version 3.18 ยท 4 versions
, in debian trixie, opensuse-leap 16.0, ubuntu questing, ubuntu resolute, ubuntu stonking

โœจ NAME โœจ

okay bestie, this is fstab-decode from the Linux System Administrator's Manual ๐Ÿ’… It's a section 8 page, and the whole thing is about running a command with fstab-encoded arguments ๐Ÿงš

fstab-decode - run a command with fstab-encoded arguments

๐ŸŽ€ SYNOPSIS ๐ŸŽ€

fstab-decode COMMAND [ARGUMENT ...]

๐Ÿ’– DESCRIPTION ๐Ÿ’–

okay so fstab-decode decodes escapes (like newline characters and other whitespace) in the ARGUMENTs you give it, then uses them to run COMMAND ๐Ÿซถ The escaping uses the exact same rules as path escaping in /etc/fstab, /etc/mtab and /proc/mtab, so it's all one big happy family ๐ŸŒธ

In essence, you can use fstab-decode any time you want to pass a bunch of parameters to a command as a list of command line arguments. It takes output that looks like this:

/root
/mnt/remote-disk
/home

and turns it into one long list of parameters, "/root /mnt/remote-disk /home" โœจ Super useful when you're dealing with multiple filesystems at once. For example, you can use it to unmount a whole pile of NFS shares in one go ๐Ÿฆ‹

This program also strips out whitespace and other sneaky characters that could make programs like mount(8) or umount(8) fail. Major clean-up energy ๐Ÿงผโœจ

๐Ÿ‘‘ EXIT STATUS ๐Ÿ‘‘

fstab-decode exits with status 127 if COMMAND can't be run ๐Ÿ’€ Otherwise, it exits with whatever status COMMAND returned. So it's basically just passing the baton ๐Ÿƒโ€โ™€๏ธ๐Ÿ’จ

๐ŸŒˆ EXAMPLES ๐ŸŒˆ

ok this one is iconic ๐Ÿ˜ญ The example reads fstab, finds every VFAT filesystem, and prints their mount points (that's argument 2 in the fstab file). Then fstab-decode runs the program you specify, umount(8), and hands it the list of VFAT mountpoints. Result: every VFAT partition gets unmounted ๐Ÿ”ฅ

fstab-decode umount $(awk '$3 == "vfat" { print $2 }' /etc/fstab)

๐Ÿฆ‹ SEE ALSO ๐Ÿฆ‹

fstab(5) ๐Ÿ“


bestie that's the whole page ๐Ÿ’œ It's from sysvinit, dated May 2006, so it's a little vintage but the vibes are still immaculate ๐Ÿ’…โœจ

๐Ÿ“ฆ where this page comes from