RIFLE(1)
π¦ RIFLE(1) β ranger's file opener π¦
π NAME π
rifle β ranger's file opener
β¨ SYNOPSIS β¨
rifle [--help] [-f FLAGS] [-l] [-p KEYWORD] [-w PROGRAM] [-c CONFIG_FILE] files
πΈ DESCRIPTION πΈ
okay so rifle is a powerful file executor that does complex file type checking, bestie. it was written to meet the needs of the file manager ranger, and its main character energy is that it automatically determines file types depending on which programs are installed on the system β even without any user interaction. it's giving effortless, honestly.
π OPTIONS π
-f FLAGSβ specify flags for opening the files. flags are letters that change how the program is executed. any combination of flags will work. writing uppercase flags will negate the effect of all previously used lowercase flags of the same letter.
table of all flags:
fβ fork program to backgroundrβ run program as root, usingsudotβ run program in a separate terminal, as specified by$TERMCMD
-lβ list all possible ways to open the specified files. each line will contain information in the format ofid:label:flags:command.idis the identification number.labelis an arbitrary string that was specified for this command,flagsare the flags that are used by default, andcommandis the command that is going to be executed.-p KEYWORDβ pick a method to open the files.
KEYWORD is either the ID number listed by rifle -l or a string that matches a label in the configuration file.
-w PROGRAMβ open the files with the programPROGRAM-c CONFIG_FILEβ read configuration fromCONFIG_FILE, instead of the default.-h,--helpβ print a list of options and exit.
π FILES π
rifle shares configuration files with ranger, though ranger is not required in order to use rifle. the default configuration file rifle.conf is expected to be at ~/.config/ranger/rifle.conf. however, this can be overridden with the -c option. note that due to the nature of the configuration, rifle will only read one file, it will not read the defaults in addition.
this file specifies patterns for determining the commands to open files with. the syntax is described in the comments of the default rifle.conf that ships with ranger. to obtain it, you need to run: ranger --copy-config=rifle
π¦ ENVIRONMENT π¦
VISUALβ determines which editor to use for editing files.EDITORβ determines which editor to use for editing files ifVISUALis undefined or empty (in the defaultrifle.conf). if both are undefined or empty,vimis used instead.PAGERβ determines which pager to use for displaying files (in the defaultrifle.conf).TERMCMDβ determines the terminal emulator command for use with thetflag. it is required that the value is the path to an executable file which accepts the-e COMMANDargument.XDG_CONFIG_HOMEβ specifies the directory for configuration files. defaults to$HOME/.config.
π EXAMPLES π
list all the different methods:
$ rifle -l helloworld.py
0:editor::$EDITOR -- "$@"
1:pager::$PAGER -- "$@"
2:::python -- "$1"
display its content by opening it with cat:
$ rifle -w cat helloworld.py
print("Hello World!")
run it by picking the method 2, which calls python -- "$1":
$ rifle -p 2 helloworld.py
Hello World!
display the file in a pager inside a new terminal, run as root:
$ rifle -p 1 -f tr helloworld.py
okay bestie, thatβs the whole rifle(1) manual! π this page is serving version rifle-1.9.4, dated 2025-01-07, and no cap it ate. π«Άβ¨
π¦ where this page comes from
- nixos 26.05: ranger 1.9.4-unstable-2026-04-26
- nixpkgs unstable: ranger 1.9.4-unstable-2026-09-09
- opensuse-leap 16.0: ranger 1.9.4+git20250910.3f7a3546-bp160.1.1 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms