LF – A nifty terminal file manager for Linux systems

By default most of the Linux admins will prefer to work in CLI because they used to that. Also, there is no option to work via GUI on 95% of Linux servers.However, if you would like to add some color to your black terminal while navigation to other directories.

You can give a try to LF command that gives you a nice experience. Don’t install this on Prod environment as it’s in development stage.

What’s LF

LF stands for List File is a nifty terminal file manager for Linux systems which was written in Go Language. It is heavily inspired by ranger with some missing and extra features.

Some of the missing features are deliberately omitted since they are better handled by external tools.

It provides a minimalist and nice curses interface with a view on the directory hierarchy.

Also we can read a text files without opening it any text viewer. It allow users to easily navigate to the entire file system.

LF Features

  • Cross-platform (Linux, OSX, BSDs, Windows (partial))
  • Single binary without any runtime dependencies (except for terminfo database)
  • Fast startup and low memory footprint (due to native code and static binaries)
  • Server/client architecture to share file selection between multiple instances
  • Configuration with shell commands
  • Customizable keybindings (vi and readline defaults)
  • Preview filtering (for source highlight, archives, pdfs/images as text etc.)

How to install LF in Linux

Go to LF Releases page on github and download latest and relevant version for your Operating system. It will contain a single executable file so, just move the file to you path directory.

To check your path directory, run the following command.

# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin

Run the below command to download the latest available version for your operating system.

# wget https://github.com/gokcehan/lf/releases/download/r8/lf-linux-amd64.tar.gz

Extract the tar archive using the following command.

# tar xvf lf-linux-amd64.tar.gz

As I told previously, just move the executable file to your path directory.

# mv lf /usr/local/bin

Finally run the LF command to use it. Press q to exit from LF command.

# lf

By default you won’t get a man page for LF command. To get a man page, follow the below steps.

First clone the LF github page like below.

# git clone https://github.com/gokcehan/lf.git

Navigate to the lf directory.

# cd lf

Finally move the lf.1 file to /usr/share/man/man1/ folder.

# mv lf.1 /usr/share/man/man1/lf.1

Now, you can able to access man page for LF command.

# man lf

Run the below command to access LF command docs.

# lf -doc

For Arch Linux based users can easily install it with help of AUR Helper, as this package is available in AUR repository.

$ yay -S lf

LF Command Usage

Use the following keys to navigate the files and folders in the directory. Navigate to the following page for video tutorials.

  • k or UP Arrow: To move up.
  • j or DOWN Arrow: To move down.

Use the following keys to move half a page at a time.

  • Ctrl+u: To move half a page up.
  • Ctrl+d: To move half a page down.

Use the following keys to move a full page at a time.

  • Ctrl+b or PgUp: To move a full page up.
  • Ctrl+f or PgDn: To move a full page down.

Use the following keys to move to the beginning and end of the list.

  • gg or Home: To move to the beginning of the list.
  • G or End: To move to the end of the list.

Use the following keys to toggle, invert and unmark the files in the current directory.

  • space: To toggles files in the current directory.
  • v: To inverts selections in the current directory.
  • u: To unmark all selections.

Use the following keys to perform copy, cut, paste and clear files.

  • y: To copy the current file or selections.
  • d: To cut the current file or selections.
  • p: To past the copied or cut files to the current directory.
  • c: To clears copied or cut files.

Use : to read a builtin or custom commands.

  • :set hidden Type the following custom command to view hidden files.
  • :set sortby size; set info size Type the following custom command to view the files and directory size.

Use $ to run a command in the shell.

  • $ touch magi.txt To create a new file in the current directory.
  • $ mv magi.txt 2g.txt To rename a file.

Use the following keys to perform  search.

  • /[Pattern]: To perform a search.
  • n: To move to next pattern matching.
  • p: To move to previous pattern matching.
  • ?[Pattern]: To perform a reverse search.

Hit the z key to view the default keybindings associated with z (prefixed with z) key.

keys    command                                                                                          
za      set info size:time
zh      set hidden!
zn      set info                                                                                         
zr      set reverse!                         
zs      set info size                         
zt      set info time 

Hit the s key to view the default keybindings associated with s (prefixed with s) key.

keys    command                                                                                          
sn      :{{ set sortby natural; set info ; }}
ss      :{{ set sortby size; set info size; }}
st      :{{ set sortby time; set info time; }}

Additional Commands.

  • %[Command]: Use this to run a command in the shell while piping the input from the ui and output to the ui.
  • ![Command]: Use this to run a command in the shell waits for a key press afterwards.
  • &[Command]: To run a command in the background.
  • h: To move to the parent directory.

About Vinoth Kumar

Vinoth Kumar has 3.5+ years of experience in Linux server administration & RHEL certified professional. He is currently working as a Senior L2 Linux Server administrator.

View all posts by Vinoth Kumar

Leave a Reply

Your email address will not be published. Required fields are marked *