From Gentoo Wiki
Jump to:navigation Jump to:search
This article is a stub. You can help by expanding it.

ranger is a console file manager with VI key bindings. It provides a minimalistic and nice curses interface with a view on the directory hierarchy.


USE flags

USE flags for app-misc/ranger A vim-inspired file manager for the console

test Enable dependencies and/or preparations necessary to run tests (usually controlled by FEATURES=test but can be toggled independently)


root #emerge --ask app-misc/ranger

Additional software

Ranger can be extended with additional tools, this section will discuss some possibilities of note.


Dragon is a drag and drop functionality for X/Wayland, that can be used in conjunction with Ranger.

Dragon is not currently present in the Gentoo ebuild repository, however it still may be installed. The recommended way to install third party packages (software from outside the Gentoo repository) on Gentoo is by writing an Ebuild, if one is not already available from an overlay. This will allow Portage to track all the changes made to the system by the installer, allowing safe updating and removal, and avoiding adding untracked files to the system directories.

In a pinch, Dragon can be installed by compiling from the git repo, to a user's home. First, create a directory to hold the source if one does not yet exist, clone the git repository, and enter the source directory:

user $mkdir --parents ~/.local/src
user $cd ~/.local/src
user $git clone https://github.com/mwh/dragon.git
user $cd dragon

Install Dragon, prefixing to a directory in the user's home dir:

user $make prefix="~/.local" install

The ~/.local/bin directory can be added to the PATH environment variable, to allow invocation of dragon from the command line - and in scripts - without specifying the full path to the executable.

To use Dragon in Ranger, add to the configuration files:

FILE /.config/ranger/rc.conf
map <C-d> shell dragon -a -x %p --and-exit
FILE ~/.config/ranger/rifle.conf
has dragon, X, flag f = dragon -a -x "$@"

It should now be possible to press Ctrl+d in ranger to open a GUI popup with the selected folder, which can be used to drag and drop.



user $ranger --help
                                                                                                                                                                                                                                     Usage: ranger [options] [path]

  --version             show program's version number and exit
  -h, --help            show this help message and exit
  -d, --debug           activate debug mode
  -c, --clean           don't touch/require any config files.
  --logfile=file        log file to use, '-' for stderr
  --cachedir=dir        change the cache directory. (/home/chr/.cache/ranger)
  -r dir, --confdir=dir
                        change the configuration directory.
  --datadir=dir         change the data directory.
  --copy-config=which   copy the default configs to the local config
                        directory. Possible values: all, rc, rifle, commands,
                        commands_full, scope
  --choosefile=OUTFILE  Makes ranger act like a file chooser. When opening a
                        file, it will quit and write the name of the selected
                        file to OUTFILE.
                        Makes ranger act like a file chooser for multiple
                        files at once. When opening a file, it will quit and
                        write the name of all selected files to OUTFILE.
  --choosedir=OUTFILE   Makes ranger act like a directory chooser. When ranger
                        quits, it will write the name of the last visited
                        directory to OUTFILE
                        Open ranger with supplied file selected.
  --show-only-dirs      Show only directories, no files or links
  --list-unused-keys    List common keys which are not bound to any action.
                        List all files which are tagged with the given tag,
                        default: *
  --profile             Print statistics of CPU usage on exit.
  --cmd=COMMAND         Execute COMMAND after the configuration has been read.
                        Use this option multiple times to run multiple

External resources

  • LF - a terminal file manager inspired by ranger, written in Go.
  • app-misc/nnn - the "missing terminal file browser" for X.