Skip to content
CatsDeservePets edited this page Feb 12, 2026 · 3 revisions

How do -print-selection/-selection-path work?

Both flags turn lf into a file picker:

  1. Select the files you want.
  2. Confirm the selection by opening any file.

lf then exits and returns the selected paths. -print-selection prints them to stdout, -selection-path <path> writes them to the given file.

If you quit lf without confirming, the selection is discarded.

How to change your shells directory using lf?

For security reasons, regular programs like lf can't change your shell's working directory.

A common workaround is printing or writing the last directory on exit and letting the shell cd into it. lf exposes the flags -print-last-dir and -last-dir-path for this purpose.

You can use one of the example lfcd wrapper shell scripts provided here: https://github.com/gokcehan/lf/tree/master/etc

Why don't my icons show up correctly?

Make sure the following things are true:

  • You put set icons into your lfrc.
  • You are using a nerd font and your terminal supports it (not needed when using emojis or 'normal' characters)

Tip: When using custom icons, make sure to put slashes (/) after directory names (even on Windows).