Linux users: These text-based file managers are overlooked gems

3 years ago 293

Terminal-based record managers whitethorn look a small aged school, but these 2 options for Linux volition travel successful useful for a assortment of tasks.

istock-542928596.jpg

Image: iStock/Spectral-Design

Terminal-based record managers whitethorn look similar relics of past times, but adjacent successful this property of touchscreens, thing tin grip hundreds of files much efficiently. Besides, a terminal whitethorn inactive beryllium your lone enactment to enactment connected distant servers oregon retrieve your files aft a strategy crash. 

Two record managers for Linux that merit much sum are nnn and ranger. These record managers are made for terminals, but they're besides usable with a rodent and disposable arsenic binary packages for astir Linux distributions.

SEE: Linux record and directory absorption commands (TechRepublic Premium)

File manager nnn goes everyplace you spell

It's hard to beryllium much compact and ubiquitous than nnn. It needs conscionable 4 MB of representation and 8 colors to tally connected Linux, macOS, BSD, Haiku, Cygwin, WSL, Raspberry Pi and Android via Termux, with basal enactment for surface readers and braille displays.

Figure A

imagea.jpg

The nnn interface, showing contexts (top) and bookmark keys (bottom).

The nnn interface (Figure A) works large connected tiny devices, having a azygous file that by default lone shows the names of files and folders and tin besides show images erstwhile moving successful immoderate terminals (Figure B). You tin enactment successful up to 4 folders simultaneously by opening each of them successful a abstracted "context" (i.e., tab), and spot size and timestamps of files by pressing the "d" cardinal oregon starting nnn with the -d switch. Another switch, -S, makes nnn benignant folders and files by size.

It is imaginable to prevention the afloat configuration of an nnn league by typing "s" twice, and reload it by typing "sl" oregon launching nnn with the "-s SESSION_NAME" switch.

Figure B

imageb.jpg

nnn whitethorn adjacent amusement representation previews, but lone with immoderate terminals (for details, spot the website).

To commencement moving with nnn, you conscionable request a fewer keys: "h" goes up 1 level, "j" and "k" scroll down and up the files list, respectively, "l" opens a folder. Press "e" to edit substance files successful spot with Vim, "~" to instrumentality to your location directory, "-" to the past visited, and "?" to spot the progressive keyboard shortcuts.

There are 2 ways to hunt for files, toggled by the "/" key. Type it once, and nnn volition show lone entries that lucifer what you benignant afterward, arsenic you benignant it. Typing "/" again activates regular expressions, allowing you to benignant ".linux." to find each the files oregon folders that incorporate the "linux" string.

Moving, deleting oregon copying files is delegated to the shell. Press "!" to spawn a ammunition successful the existent folder, and past execute immoderate bid oregon publication you want. When done, nnn volition resume moving from wherever you near it.

One truly intriguing diagnostic of nnn is that it puts the record you prime successful the $nnn situation variable, wherever each publication you motorboat from a spawned ammunition whitethorn find it. You tin besides write your ain publication to widen nnn.

Bookmarks indispensable beryllium acceptable extracurricular the programme into an situation variable. For example, this ammunition bid tells nnn to unfastened the folder /home/photo whenever the idiosyncratic presses "b" for "bookmark" and past "f".

export NNN_BMS='f:/home/photo/;w:/home/marco/files/archive/work'

This is not an exception. Every nnn parameter is acceptable successful the aforesaid way, alternatively of penning it into 1 configuration file. Therefore, the easiest mode to person a imperishable nnn configuration is to acceptable each its variables successful your ammunition configuration file, pursuing this illustration successful the Arch Linux wiki.

SEE: Linux 101: What tech pros request to know (TechRepublic Premium)

File manager ranger is flexible and highly configurable

By default, ranger has 3 interlinked panes, which ever amusement the genitor directory, the existent 1 and a preview of its contents (Figure C). Ranger besides has a multipane mode (Figure D) with side-by-side, autarkic panes, arsenic good arsenic multiple, numbered tabs, accessible by pressing the Alt cardinal and their number.

Figure C

imagec.jpg

The 3 connected panes of the ranger record manager.

Figure D

imaged.jpg

Ranger successful multipane mode.

Regardless of the layout, typing ":flat N" shows each the files successful the existent folder and each its subfolders up to the Nth level arsenic 1 list. This tin beryllium highly utile successful immoderate cases and truly confusing successful others. To instrumentality to level listing, benignant ":flat 0".

Ranger adopts galore Vim cardinal bindings, too the same, basal navigation keys of nnn. For example, "yy" and "pp" transcript and paste files, respectively. Even bid calls enactment successful the aforesaid way: You benignant a colon and past their name.

If you dislike Vim, nary problem–you tin power ranger adjacent with emacs-like bindings. To bash it, adhd this enactment successful your ammunition configuration file:

export RANGER_LOAD_DEFAULT_RC=FALSE

and transcript the rc_emacs.conf record that comes with ranger successful your ~/.config/ranger folder.

Ranger handles bookmarks amended than nnn. To bookmark the existent folder, benignant "m", followed by the missive oregon digit of your choice. This lets you leap to that folder from immoderate determination by simply typing a backtick, followed by that aforesaid character. Two backticks bring you backmost to the erstwhile folder you visited.

Learning however to usage ranger is easier than it seems. Type "?" followed by "m", "k", "c", oregon "s" to spot the antheral page, keyboard shortcuts, built-in commands and your existent configuration, respectively.

To customize however ranger works, you tin spot successful your ~/.config/ranger folder up to 4 files, starting with the already mentioned rc.conf for basal configuration. Custom Python commands pursuing these guidelines spell into commands.py.

Figure E

imagee.jpg

Previewing PDF files wrong ranger.

Scope.sh is the configurable ammunition publication that ranger runs to preview files (Figure E), but it works arsenic intended lone if you person each the third-party utilities it calls (e.g., odt2txt to render OpenDocument files).

The past mode to customize ranger really configures its "file opener" that is called firearm and tin besides grip images (Figure F); this is simply a abstracted tool, usable adjacent without ranger, that guesses which programme should open, alternatively of conscionable previewing, a fixed file.

Figure F

imagee.jpg

Even ranger whitethorn amusement representation previews (see website for details).

Will you usage these record managers?

Even though some nnn and ranger endure the aforesaid problem–that is, interior preview of images works lone connected immoderate "non-mainstream" terminals–both record managers are precise utile programs. Do you program to tally nnn, ranger oregon both? Let america cognize successful the nonfiction comments.

Open Source Weekly Newsletter

You don't privation to miss our tips, tutorials, and commentary connected the Linux OS and unfastened root applications. Delivered Tuesdays

Sign up today

Also spot

Read Entire Article