lfs

lfs – list your filesystems

The Command Line Interface (CLI) is a way of interacting with your computer. To harness all the power of Linux, it’s highly recommended mastering the interface. It’s true the CLI is often perceived as a barrier for users migrating to Linux, particularly if they’re grown up using GUI software exclusively. While Linux rarely forces anyone to use the CLI, some tasks are better suited to this method of interaction, offering inducements like superior scripting opportunities, remote access, and being far more frugal with a computer’s resources.

The part of the operating system responsible for managing files and directories is called the file system. It organizes our data into files, which hold information, and directories (also called ‘folders’), which hold files or other directories. We cover the basics of the file system in Linux for Starters – Part 12.

lfs is billed as a better df, a standard Unix command used to display the amount of available disk space for file systems on which the invoking user has appropriate read access.

Installation

There’s two main ways to install lfs. First, you can use cargo, Rust’s package manager. If you don’t have cargo installed, you’ll first need to type:

$ sudo apt install cargo

Now you can install lfs with the command:

$ cargo install lfs

One further step is that you’ll need to ensure ~/.cargo/bin is in your PATH. The variable $PATH is set by your shell every time it launches, but you can set it so that it always includes your new path with every new shell you open. The exact way to do this depends on which shell you’re running.

For the bash shell we follow these steps:

  • Open the .bashrc file in our home directory (~/.bashrc) in a text editor.
  • Add export PATH=”$PATH:~/.cargo/bin”to the last line of the file.
  • Save the .bashrc file.
  • Restart the terminal (or run the command source .bashrc).

Alternatively, you could copy lfs to a directory such as /usr/local/bin with the command:

$ sudo cp ~/.cargo/bin/lfs /usr/local/bin/

If you are neither a Rust developer nor an aspiring Rust developer, we suggest you install the precompiled lfs (which is very small) rather than install the Rust development environment. The developer provides binaries for x86-64, ARMv7, and AArch64 (the 64-bit extension of the ARM architecture, first introduced with the ARMv8-A architecture).

Next page: Page 2 – In Operation

Pages in this article:
Page 1 – Introduction / Installation
Page 2 – In Operation
Page 3 – Summary


Share this article

Share your Thoughts

This site uses Akismet to reduce spam. Learn how your comment data is processed.