LSBLK(8)
okay so this is lsblk(8) from the System Administration section, and bestie, we're about to list some block devices ๐
๐ธ NAME ๐ธ
lsblk โ list block devices โจ
๐ SYNOPSIS ๐
lsblk [options] [device...]
๐ DESCRIPTION ๐
lsblk lists info about all available block devices, or just the ones you specify. It gets its tea from the sysfs filesystem and the udev db. But if the udev db isn't available, or if lsblk was compiled without udev support, it tries to read LABELs, UUIDs, and filesystem types straight from the block device. And in that case? root permissions are necessary, no cap.
By default, the command prints all block devices (except RAM disks) in a tree-like format. The same device can show up multiple times in the tree if it relates to other devices. For more complicated setups, the --merge option is recommended to gather groups of devices and describe complex N:M relationships.
The tree-like output (or the children[] array in the JSON output) is only enabled if the NAME column is present in the output, or when the --tree command line option is used. See also --nodeps and --list to control the tree formatting.
The default output, as well as the default output from options like --fs and --topology, is subject to change. So whenever possible, you should avoid using default outputs in your scripts. Always explicitly define expected columns by using --output columns-list and --list in environments where a stable output is required.
bestie, do NOT rely on default outputs in scripts, periodt. Lock in your columns. ๐
Use lsblk --list-columns to get a list of all available columns. Obsessed with how easy that is.
Note that lsblk might be executed at a time when udev does not have all information about recently added or modified devices yet. In this case it is recommended to use udevadm settle before lsblk to synchronize with udev. Like, give udev a sec to catch up, fr fr.
The relationship between block devices and filesystems is not always one-to-one. The filesystem may use more block devices, or the same filesystem may be accessible by more paths. This is the reason why lsblk provides MOUNTPOINT and MOUNTPOINTS (pl.) columns. The column MOUNTPOINT displays only one mount point (usually the last mounted instance of the filesystem), and the column MOUNTPOINTS displays by multi-line cell all mount points associated with the device. It's giving thorough. ๐ฆ
๐ OPTIONS ๐
Bestie, welcome to the wardrobe. Every single flag below is a fit, and lsblk is about to serve looks. No cap, you can mix and match. Let's go.
-A,--noemptyโ Don't print empty devices. That's it. Ghost devices get no screen time. ๐-a,--allโ Turn off all the built-in filters and list all empty devices plus RAM disk devices too. The full chaos menu. โจ-b,--bytesโ Print sizes in bytes instead of human-readable form. By default sizes use units that are powers of 1024 bytes, and the formal abbreviations (KiB,MiB,GiB, ...) get shortened to just their first letter:K,M,G, .... So yes, bytes mode is the raw-number vibe. ๐ข-H,--list-columnsโ List the columns you can specify with--output. You can pair it with--jsonor--rawto get that list in a machine-readable format. Very demure, very parseable. ๐-D,--discardโ Print info about the discarding capabilities (TRIM,UNMAP) for each device. Spring cleaning data, literally. ๐งน-d,--nodepsโ Do not print holder devices or slaves. For example,lsblk --nodeps /dev/sdaprints info about thesdadevice only. No entourage. ๐-E,--dedupcolumn โ Use column as a de-duplication key to de-duplicate the output tree. If the key is not available for the device, or the device is a partition and the parental whole-disk device provides the same key, then the device is always printed. The usual use case is de-duplicating output on system multi-path devices, for example by-E WWN. One icon, one line, no duplicates. ๐-e,--excludelist โ Exclude devices specified by the comma-separated list of major device numbers. Note that RAM disks (major=1) are excluded by default if--allis not specified. The filter is applied to the top-level devices only. This may be confusing for--listoutput format where hierarchy of the devices is not obvious. So yeah, read the fine print, bestie. ๐-f,--fsโ Output info about filesystems. This option is equivalent to-o NAME,FSTYPE,FSVER,LABEL,UUID,FSAVAIL,FSUSE%,MOUNTPOINTS. The authoritative information about filesystems and raids is provided by theblkid(8)command. Periodt. ๐--hyperlink[=when]โ Print paths as terminal hyperlinks. The optional when argument can bealways,never, orauto. If the argument is omitted, it defaults toauto, which means that hyperlinks will only be used when the output goes to a terminal. Cute link energy only when it makes sense. ๐-I,--includelist โ Include devices specified by the comma-separated list of major device numbers. The filter is applied to the top-level devices only. This may be confusing for--listoutput format where hierarchy of the devices is not obvious. Same warning as exclude, so don't act surprised. ๐ญ-i,--asciiโ Use ASCII characters for tree formatting. For when emoji branches are too much (never, but okay). ๐-J,--jsonโ Use JSON output format. It's strongly recommended to use--outputand also--treeif necessary. Note thatchildren[]is used only ifNAMEcolumn or--treeis used. JSON girlies, this is your moment. โจ-l,--listโ Produce output in the form of a list. The output does not provide information about relationships between devices, and since version 2.34 every device is printed only once if--pairsor--rawnot specified (the parsable outputs are maintained in backwardly compatible way). Flat and unbothered. ๐-M,--mergeโ Group parents of sub-trees to provide more readable output for RAIDs and Multi-path devices. The tree-like output is required. It's giving family reunion, but organized. ๐ซถ-m,--permsโ Output info about device owner, group and mode. This option is equivalent to-o NAME,SIZE,OWNER,GROUP,MODE. Permission slip: signed. ๐-N,--nvmeโ Output info about NVMe devices only. NVMe besties, this one's for you. ๐ฅ-v,--virtioโ Output info about virtio devices only. Virtual girlies, rise. ๐ฆ-n,--noheadingsโ Do not print a header line. Minimalist. Clean. No labels. โญ-o,--outputlist โ Specify which output columns to print. Use--list-columnsto get a list of all supported columns. The columns may affect tree-like output. The default is to use tree for the columnNAME(see also--tree). The default list of columns may be extended if list is specified in the format+list(e.g.,lsblk -o +UUID). Customize your feed, bestie. ๐-O,--output-allโ Output all available columns. The whole spreadsheet, the entire lore. ๐-P,--pairsโ Produce output in the form ofkey="value"pairs. The output lines are still ordered by dependencies. All potentially unsafe value characters are hex-escaped (\x<code>). See also option--shell. Very key-value core. ๐-p,--pathsโ Print full device paths. No shorthand, just the whole address. ๐-Q,--filterexpression โ Print only the devices that meet the conditions specified by expression. The filter is assessed prior tolsblkcollecting data for all output columns. Only the necessary data for the lazy evaluation of the expression is retrieved from the system. This approach can enhance performance when compared to post-filtering, as commonly done by tools such asgrep(1). This feature is EXPERIMENTAL. See alsoscols-filter(5). For example, to excludesdaandsdb, but print everything else (!~is a negative regular-expression matching operator):
lsblk --filter 'NAME !~ "sd[ab]"'
--highlightexpression โ Colorize lines matching expression. This feature is EXPERIMENTAL. See alsoscols-filter(5). Highlight reel, but make it terminal. ๐--ctname[:parameter[:function]] โ Define a custom counter. Custom counters are printed after the standard output. The name is the custom name of the counter, the optional parameter is the name of the column to be used for the counter, and the optional function specifies the aggregation function. Supported functions are:count,min,max,sum. The default function iscount. If parameter is not specified, then the counter counts the number of lines. This feature is EXPERIMENTAL. See also--ct-filter. For example,--ct MyCounter:SIZE:sumreports the total of theSIZEvalues. To report the number of SATA disks, one can use:
lsblk --ct-filter 'TYPE=="disk" && TRAN=="sata"' \
--ct "Number of SATA devices"
--ct-filterexpression โ Define a restriction for the next counter. This feature is EXPERIMENTAL. See also--ctandscols-filter(5). For example, to aggregate sizes by device type:
lsblk --ct-filter 'TYPE=="part"' --ct Partitions:SIZE:sum \
--ct-filter 'TYPE=="disk"' --ct WholeDisks:SIZE:sum
-r,--rawโ Produce output in raw format. The output lines are still ordered by dependencies. All potentially unsafe characters are hex-escaped (\x<code>) in theNAME,KNAME,LABEL,PARTLABELandMOUNTPOINTcolumns. Raw and unfiltered, but safe-ish. ๐-S,--scsiโ Output info about SCSI devices only. All partitions, slaves and holder devices are ignored. SCSI only, no plus-ones. ๐-s,--inverseโ Print dependencies in inverse order. If the--listoutput is requested then the lines are still ordered by dependencies. Flip the script, but keep the order. ๐-T,--tree[=column]โ Force tree-like output format. If column is specified, then a tree is printed in the column. The default isNAMEcolumn. Tree mode: activated. ๐ณ-t,--topologyโ Output info about block-device topology. This option is equivalent to-o NAME,ALIGNMENT,MIN-IO,OPT-IO,PHY-SEC,LOG-SEC,ROTA,SCHED,RQ-SIZE,RA,WSAME. Topology tea, served. ๐-w,--widthnumber โ Specifies output width as a number of characters. The default is the number of the terminal columns, and if not executed on a terminal, then output width is not restricted at all by default. This option also forceslsblkto assume that terminal control characters and unsafe characters are not allowed. The expected use-case is for example whenlsblkis used by thewatch(1)command. Width control, because sometimes the terminal is messy. ๐-x,--sortcolumn โ Sort output lines by column. This option enables--listoutput format by default. It is possible to use the option--treeto force tree-like output and then the tree branches are sorted by the column. Sort it out, literally. ๐ค-y,--shellโ The column name will be modified to contain only characters allowed for shell variable identifiers, for example,MIN_IOandFSUSE_PCTinstead ofMIN-IOandFSUSE%. This is usable, for example, with--pairs. Note that this feature has been automatically enabled for--pairsin version 2.37, but due to compatibility issues, now it's necessary to request this behavior by--shell. Shell-safe names, because variables can't have dashes and percent signs. ๐-z,--zonedโ Print the zone related information for each device. Zoned out, in the cool way. ๐--sysrootdirectory โ Gather data for a Linux instance other than the instance from which thelsblkcommand is issued. The specified directory is the system root of the Linux instance to be inspected. The real device nodes in the target directory can be replaced by text files with udev attributes. Peek into another system, respectfully. ๐--properties-bylist โ This option specifies the methods used bylsblkto gather information about filesystems and partition tables. The list is a comma-separated list of method names. The default setting is"file,udev,blkid". The supported methods are:udevโ Reads data from udev DB. If unsuccessful, it continues to the next probing method.blkidโ Reads data directly from the device using libblkid. If unsuccessful, it continues to the next probing method.fileโ Reads data from a file. This method is only used if the--sysrootoption is specified. This method always stops probing if used.noneโ Does not probe. This method always stops probing.
-h,--helpโ Display help text and exit. The classic "help me bestie" button. ๐-V,--versionโ Display version and exit. Version check, periodt. ๐
๐ช EXIT STATUS ๐ช
When lsblk leaves the chat, it tells you how it went:
0โ success ๐1โ failure ๐ญ32โ none of specified devices found ๐64โ some specified devices found, some not found ๐
๐จ COLORS ๐จ
The output colorization is implemented by terminal-colors.d(5) functionality. Implicit coloring can be disabled by an empty file /etc/terminal-colors.d/lsblk.disable for the lsblk command or for all tools by /etc/terminal-colors.d/disable.
Since version 2.41, the $NO_COLOR environment variable is also supported to disable output colorization unless explicitly enabled by a command-line option.
The user-specific $XDG_CONFIG_HOME/terminal-colors.d or $HOME/.config/terminal-colors.d overrides the global setting.
Note that the output colorization may be enabled by default, and in this case terminal-colors.d directories do not have to exist yet. ๐
๐ ENVIRONMENT ๐
okay bestie, these are the little environment variables that change how lsblk behaves. they're like the settings menu but for your shell, iykyk ๐
LSBLK_DEBUG=allโ turns onlsblkdebug output. all the tea, all of it ๐LIBBLKID_DEBUG=allโ turns onlibblkiddebug output โจLIBMOUNT_DEBUG=allโ turns onlibmountdebug output โจLIBSMARTCOLS_DEBUG=allโ turns onlibsmartcolsdebug output โจLIBSMARTCOLS_DEBUG_PADDING=onโ use visible padding characters ๐ (so you can literally see the padding, iconic)LIBSMARTCOLS_JSON=compact|linesโ controls the JSON output format when you're using--json. the supported values arecompactfor JSON output with minimal whitespace, andlinesfor JSON Lines format (one JSON object per line). if it's unset, or set to literally any other value, you get pretty-printed JSON ๐ธLSBLK_COLUMNS=โ specifies a comma-separated list of output columns to print. every single column listed by--list-columnscan be used here ๐
๐ NOTES ๐
for partitions, some information (e.g., queue attributes) is inherited from the parent device. so yeah, they get it from their parent, main character energy runs in the family fr fr ๐ซถ
the lsblk command needs to be able to look up each block device by major:minor numbers, which is done by using /sys/dev/block. this sysfs block directory appeared in kernel 2.6.27 (October 2008). in case of problems with a new enough kernel, check that CONFIG_SYSFS was enabled at the time of the kernel build. no cap, that's the vibe check ๐
๐ AUTHORS ๐
Milan Broz <gmazyland@gmail.com>, Karel Zak <kzak@redhat.com>
(absolute legends, we stan ๐)
๐ SEE ALSO ๐
blkid(8), findmnt(8) ls(1), scols-filter(5)
go read those too bestie, they're all part of the same friend group ๐
๐ REPORTING BUGS ๐
found a bug? don't just suffer in silence ๐ญ for bug reports, use the issue tracker <https://github.com/util-linux/util-linux/issues>. tell them everything, they wanna know ๐
โญ AVAILABILITY โญ
the lsblk command is part of the util-linux package which can be downloaded from Linux Kernel Archive <https://www.kernel.org/pub/linux/utils/util-linux/>. go get it, it's free, it's iconic ๐
and that's a wrap on LSBLK(8) bestie!! ๐ this page came to you from util-linux 2.42.4, dated 2026-09-21 โ slay, ate, no crumbs left, periodt ๐โจ๐ฆ
๐ฆ where this page comes from
- arch rolling: util-linux 2.42.4-1 ยท BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause-UC AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND ISC AND LGPL-2.1-or-later AND LicenseRef-PublicDomain
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms