= 24 File managers: Far2l

Far2l is a port of the Windows text-based file manager *Far*.
And to be clear, that's a lower-case *L* (as in "Linux") not a *1*
It runs in the terminal and is designed around a plug-in structure, enabling compatibility with SSH, WebDAV, NFS, and more.
You can compile and run Far2l on Linux, Mac, and BSD, or Far on Windows.

== Install

Far2l is currently in beta, so you're unlikely to find it in your Linux distribution's software repository.
However, you can https://opensource.com/article/21/11/compiling-code[compile it from source] by downloading cloning its https://github.com/elfmz/far2l[Git repository]:

[source,bash]
----
$ git clone --depth 1 https://github.com/elfmz/far2l.git
----

You can browse through the source code to see all of its different components.
The main source files are in `utils/src`:

[source,bash]
----
SharedResource.cpp
StackSerializer.cpp
StringConfig.cpp
StrPrintf.cpp
TestPath.cpp
Threaded.cpp
ThreadedWorkQueue.cpp
TimeUtils.cpp
TTYRawMode.cpp
utils.cpp
WideMB.cpp
ZombieControl.cpp
----

The file `ZombieControl.cpp` works to https://www.redhat.com/sysadmin/killing-zombies-linux-style[mitigate a zombie apocalypse] (at least, in terms of processes), the file `ThreadedWorkQueue.cpp` helps speed processes along by using threading.
Far2l isn't just built for extensibility, it's built responsibly!

Assuming you've already prepared your system for compiling code, as described in the https://opensource.com/article/21/11/compiling-code[compiling from source] article, you must also install some development libraries required by Far2l.
On Fedora, CentOS, OpenMandriva, and Mageia, the minimal list is:

* wxGTK3-devel
* spdlog-devel
* xerces-c-devel
* uchardet-devel (your repository may not have this one, but there's a workaround)

On Debian, the minimal list is:

* libwxgtk3.0-gtk3-dev
* libuchardet-dev
* libspdlog-dev
* libxerces-c-dev

Use https://opensource.com/article/21/5/cmake[CMake] to prepare the makefiles:

[source,bash]
----
$ mkdir build
$ cd !$
$ cmake .. -DUSEUCD=no
----

The `-DUSECD=no` option is required only if you don't have the development libraries for `chardet` installed.
If you do, then you can omit that option.

Finally, compile the code and install far2l to a temporary location:

[source,bash]
----
$ make -j$(nproc --all)
$ mkdir ~/far2l
$ make install DESTDIR=~/far2l
----

If you prefer to install it to your system instead of to a temporary directory, then omit the `DESTDIR=~/far2l` option.

To launch far2l, invoke the binary stored in the `bin` subdirectory of your install path.
For instance:

[source,bash]
----
$ ~/far2l/local/bin/far2l
----

== Using far2l

When you first launch far2l, it creates a configuration directory in `~/.config` and prompts you to choose what font you'd like to use.
On my system, 16 pt font size was the default, and anything less than that was impossible to read.
I used the open source Fantasque Mono Regular as my font, but any monospace font ought to work.

Far2l is a two-panel file manager, meaning that the default view has a place to display two separate directories.
At launch, both directories happen to be your home directory.
To maximize the amount of screen space used for listing files, far2l uses two columns in each panel, and you can use the *Left* and *Right* arrows to change from one column to the other.

In the right column, you can also use the *Right* arrow to move "down" the list of files by one screen.
In the left column, use the *Left* arrow to move "up" the list of files by one screen.

image:far2l.webp[The far2l file manager]

This navigation takes some getting used to, especially if you're used to terminal file managers that only use the *Right* arrow to descend into a directory.
However, once you get used to far2l's navigation, you're likely to appreciate the added speed you gain from this simple pagination.

== Open a file or folder

To open a folder, select a folder in your file list and press the *Return* key.
This causes the active panel to change to a view of that directory.
The inactive panel doesn't change, so it's not uncommon for far2l to always be showing two different directories at the same time.
That's a feature of the two-panel file manager design, although it can take some getting used to if you're not in the habit of splitting windows.

After you've moved into a directory, you can move back into its parent folder by selecting the double dots (`..`) at the top of the file listing and pressing *Return*.

To open a file, select a folder in your file list and press the *Return* key.
The file opens according to your desktop's mimetype preferences.

== Panel and window navigation

To move from one panel to another, press the *Tab* key.

The fun thing about far2l is that its file listing is actually a layer over the top of your terminal.
To hide the file listing temporarily, and to reveal it once it's gone, press *Ctrl+O* (that's the letter `O` not the digit zero).

You can also adjust how much of your terminal the file panels take up.
Press *Ctrl+Up* and *Ctrl+Down* to adjust the vertical size of the file panels.

Make no mistake, though, you're not just suspending far2l when you access the terminal underneath.
This isn't your usual terminal, it's a far2l terminal that interacts with the file manager and adds a few features to your standard terminal experience.
For example, the https:redhat.com/sysadmin/linux-find-command[find] command gains graphical auto-completion.

image:far2l-popup.webp[Far2l responsive terminal]

== Copying and moving files

All the usual file management functions are available within far2l are available with function keys.
These are listed along the bottom of the far2l window.
There are lots of options for some of the actions, which is either over-complex or really really powerful, depending on your preference.

image:far2l-move-options.webp[Moving a file in far2l]

== Exiting far2l

To close far2l, type `exit far` into the command prompt at the bottom of the far2l window.

== Far out

Far2l is a dynamic and responsive text-based file manager.
If you're a fan of classic two-panel file managers, then you'll feel at home with far2l.
Far2l provides an interesting and novel interpretation of a terminal, and if you don't try far2l for its two-panel file management, you should at least try it for its terminal.
