TranslateProject/sources/tech/20221215.3 ⭐️⭐️ Enjoy two-panel file management on Linux with far2l.md

7.2 KiB

Enjoy two-panel file management on Linux with 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 number 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

Far2l is currently in beta, so you're unlikely to find it in your Linux distribution's software repository. However, you can compile it from source by downloading cloning its Git repository:

$ 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:

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 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 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 CMake to prepare the makefiles:

$ 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:

$ 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:

$ ~/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 of ​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 find command gains graphical auto-completion.

Image of ​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 of far21 move options.

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.


via: https://opensource.com/article/22/12/linux-file-manager-far2l

作者:Seth Kenlon 选题:lkxed 译者:译者ID 校对:校对者ID

本文由 LCTT 原创编译,Linux中国 荣誉推出