Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
2
votes
1
answers
175
views
Ranger: yank name does not copy anything to clipboard
I am using: ``` ranger version: ranger-master Python version: 3.11.8 (main, Feb 12 2024, 14:50:05) [GCC 13.2.1 20230801] Locale: en_US.UTF-8 ``` When I invoke `yank name` using `yn`, nothing happens. I use Arch linux + wayland + sway. How can I fix this ? Thank you for help
I am using:
ranger version: ranger-master
Python version: 3.11.8 (main, Feb 12 2024, 14:50:05) [GCC 13.2.1 20230801]
Locale: en_US.UTF-8
When I invoke yank name
using yn
, nothing happens. I use Arch linux + wayland + sway. How can I fix this ?
Thank you for help
Jan Černý
(1723 rep)
Mar 17, 2024, 10:22 PM
• Last activity: May 8, 2025, 09:38 AM
0
votes
1
answers
131
views
Certain file types not showing in Ranger preview
I have a bunch of csv files that are all just plain text csv files. ``` $ file ./* file1.csv: ASCII text, with very long lines file2.csv: CSV Text ``` I even generated file2.csv from file1.csv using `cut`. However, the files seem to be of different types. When previewing them on ranger, file1.csv pr...
I have a bunch of csv files that are all just plain text csv files.
$ file ./*
file1.csv: ASCII text, with very long lines
file2.csv: CSV Text
I even generated file2.csv from file1.csv using cut
. However, the files seem to be of different types.
When previewing them on ranger, file1.csv previews as expected. But when I go to preview file2.csv, it just says
---------------File Type Classification----------------------------
CSV Text
How do I fix this?
I have Ranger v1.9.3 and default config files (scope.sh, rc.conf, rifle.conf). This happens even when I run ranger as ranger -c
Sidenote: Any idea why file2.csv
shows up as "CSV Text" rather than an ASCII text file even when I generated it from an ASCII text file using simple bash commands like sed
and cut
blackthorne18
(3 rep)
Mar 22, 2024, 12:40 PM
• Last activity: Mar 12, 2025, 09:34 PM
4
votes
2
answers
2144
views
jump to a directory inside of ranger
I tried `:cd path` but it does literally nothing. Imagine I open ranger while inside of `~/dir/`, now I want to go to `~/somewhere/else/` while inside of ranger. I know I can `hjjjj(whatever)lj/k(whatever)l` to move from folder-to-folder while inside ranger, but I want to jump directly to `~/somewhe...
I tried
:cd path
but it does literally nothing.
Imagine I open ranger while inside of ~/dir/
, now I want to go to ~/somewhere/else/
while inside of ranger.
I know I can hjjjj(whatever)lj/k(whatever)l
to move from folder-to-folder while inside ranger, but I want to jump directly to ~/somewhere/else/
.
How do I do that?
user172877
Apr 24, 2019, 08:35 PM
• Last activity: Nov 16, 2024, 07:45 PM
30
votes
4
answers
76931
views
How to change the default text editor in ranger?
Currently, ranger will only open text files with nano, and I want it to open them with vim. As per the [Arch Wiki](https://wiki.archlinux.org/index.php/Ranger#Installation) I have tried adding has xdg-open, flag f = xdg-open "$1" ext txt = vim "$@" to rifle.conf, but that didn't work.
Currently, ranger will only open text files with nano, and I want it to open them with vim.
As per the [Arch Wiki](https://wiki.archlinux.org/index.php/Ranger#Installation) I have tried adding
has xdg-open, flag f = xdg-open "$1"
ext txt = vim "$@"
to rifle.conf, but that didn't work.
Display name
(1337 rep)
May 26, 2017, 04:49 PM
• Last activity: Nov 1, 2024, 11:30 AM
5
votes
3
answers
1289
views
Remove the leftmost column from ranger file manager
There is a way I can remove the rightmost column: ```python # Preview files on the rightmost column? # And collapse (shrink) the last column if there is nothing to preview? set preview_files false set preview_directories false set collapse_preview true ``` But how do I remove the leftmost column whi...
There is a way I can remove the rightmost column:
# Preview files on the rightmost column?
# And collapse (shrink) the last column if there is nothing to preview?
set preview_files false
set preview_directories false
set collapse_preview true
But how do I remove the leftmost column which shows the parent directory?
I know that I can use set viewmode=multipane
to get single column. But in that case, when I use two tabs, I get two columns for two tabs, in the same screen. I want a screen per tab, but I want each screen to be composed of single column. How do I achieve that?
3N4N
(973 rep)
Dec 18, 2019, 01:17 PM
• Last activity: Jul 22, 2024, 05:37 PM
1
votes
1
answers
224
views
Select files in ranger using ranger
I am a bit confused about using regex in ranger (Arch Linux). I have a folder of files that look like this: ``` 'sometexthere - I. - sometexthere' 'sometexthere - II. - sometexthere' 'sometexthere - III. - sometexthere' ``` I want to select only the files with `II.` or `III.` in the middle. I have s...
I am a bit confused about using regex in ranger (Arch Linux). I have a folder of files that look like this:
'sometexthere - I. - sometexthere'
'sometexthere - II. - sometexthere'
'sometexthere - III. - sometexthere'
I want to select only the files with II.
or III.
in the middle. I have seen this post , and I have tried to mark all the files using mark
and regex like so:
:mark * [II.|III.]*
which should match 'any characters' + 'space' + 'II.' or 'III.' + any character.
However, it always selects all files including those with only one I.
Can anyone help me out here?
Cheers!
mor3dr3ad
(51 rep)
Jun 21, 2024, 01:58 PM
• Last activity: Jun 21, 2024, 10:46 PM
0
votes
0
answers
561
views
How can I view an image in ranger without closing ranger?
I installed [ranger console file manager](https://github.com/ranger/ranger) on Ubuntu. I'd like to view images with it in the console (which I access via JupyterLab), so I also installed `caca-utils`, which contains `img2txt`: ``` sudo apt-get install ranger caca-utils ``` I launched `ranger`, selec...
I installed [ranger console file manager](https://github.com/ranger/ranger) on Ubuntu. I'd like to view images with it in the console (which I access via JupyterLab), so I also installed
However, the image doesn't appear until I close ranger:
How can I view an image in ranger without closing ranger?
caca-utils
, which contains img2txt
:
sudo apt-get install ranger caca-utils
I launched ranger
, selected a file, opened it with img2txt
:


Franck Dernoncourt
(5533 rep)
May 13, 2024, 12:16 AM
17
votes
2
answers
11401
views
How to enable syntax highlighting in ranger preview?
I have seen some screenshots where ranger uses syntax-highlighting in its preview window. So I was wondering how to enable this feature and found out that I need the `scope.sh` file in the directory `/home/user/.config/ranger/scop.sh`, which will be generated with the command `$ ranger --copy-config...
I have seen some screenshots where ranger uses syntax-highlighting in its preview window. So I was wondering how to enable this feature and found out that I need the
scope.sh
file in the directory
/home/user/.config/ranger/scop.sh
,
which will be generated with the command
$ ranger --copy-config=scope
.
After generating it however the preview window completely disappears,
although I inserted set use_preview_script true
in rc.config
.
Q: Does someone know how to enable syntax-highlighting (especially for C/C++) in the ranger preview window?
PatrickSteiner
(621 rep)
Apr 5, 2018, 08:47 AM
• Last activity: Mar 5, 2024, 08:21 PM
2
votes
3
answers
687
views
Check if I'm in a shell through ranger
In ranger, you can hit `S` to jump into a shell and `ctrl+D` to get back to ranger. When I've been in a shell for a while and I want to jump to ranger, I'm unsure if this is a regular shell and I should hit `ranger` or if I'm in the shell through ranger already and I should hit `ctrl+D`. If I hit `c...
In ranger, you can hit
S
to jump into a shell and ctrl+D
to get back to ranger.
When I've been in a shell for a while and I want to jump to ranger, I'm unsure if this is a regular shell and I should hit ranger
or if I'm in the shell through ranger already and I should hit ctrl+D
.
If I hit ctrl+D
wrongly, my terminal will close. If I use ranger
wrongly, I'll get a nested instance of ranger within ranger.
Is there a way to check if I'm already in a ranger shell?
If there is a command, I could alias it to something like rangerp
which will output "True" if I am in a shell and "False" if I'm not.
Peeyush Kushwaha
(586 rep)
Feb 15, 2020, 12:07 PM
• Last activity: Dec 7, 2023, 06:06 AM
6
votes
2
answers
1359
views
How to bind a keyboard shortcut in zsh to a program requiring stdin?
This is a follow-up to [this question](https://unix.stackexchange.com/q/373795/63722): I'm trying to create a keyboard shortcut for the terminal file manager [ranger](https://github.com/ranger/ranger), in order to jump from the zsh prompt into the file manager with a single keystroke. I was followin...
This is a follow-up to [this question](https://unix.stackexchange.com/q/373795/63722) : I'm trying to create a keyboard shortcut for the terminal file manager [ranger](https://github.com/ranger/ranger) , in order to jump from the zsh prompt into the file manager with a single keystroke. I was following the linked answer, adding this to my
.zshrc
:
run_ranger () { echo; ranger; zle redisplay }
zle -N run_ranger
bindkey '^f' run_ranger
The key binding itself works, however ranger fails to start with Error: Must run ranger from terminal
. I had a look at the [ranger code (Python)](https://github.com/ranger/ranger/blob/325f41e6a841ab1413020b9d2d86c3922d90f407/ranger/core/main.py#L137) and it performs the common check sys.stdin.isatty()
to verify that is has a TTY stdin. How can I modify the zle widget so that stdin is properly set?
bluenote10
(301 rep)
Oct 13, 2018, 09:02 PM
• Last activity: Aug 5, 2023, 10:10 AM
1
votes
2
answers
379
views
ranger chain commands in config
I am using ranger as my terminal file manager and now that I understand the basics, I wanted to get a bit deeper into customizing the rc for my purposes. One thing I like to do is to map a command to a keybind that copies a template into the current folder and then starts the `rename_append` command...
I am using ranger as my terminal file manager and now that I understand the basics, I wanted to get a bit deeper into customizing the rc for my purposes. One thing I like to do is to map a command to a keybind that copies a template into the current folder and then starts the
rename_append
command, (usually called with keybind a
) on the file.
Here is an example:
map NS shell cp ~/.templates/bash.sh . ; rename_append
The problem is, that no matter how I call the command, it does copy the template in my current directory, but then doesn't start the rename-process. When I quit ranger, the errormessage says that rename_append
wasn't found, but in the ranger-config, the same command is used to rename files before the appendix. My theory is that, since I am using shell, the command tries to find rename_append
in my programs. I don't know how to chain commands in my ranger-config where one is a shell-command and the next one isn't.
Currently I have to use a second keybind after the first and I would like to only use one and automatically go into renaming-mode after copying the file.
I hope, my problem is understandable.
Enemoy
(23 rep)
Feb 13, 2022, 12:17 PM
• Last activity: Jul 22, 2023, 08:30 AM
61
votes
7
answers
47212
views
Ranger cd into a folder (and invoke shell)?
I'm using [Ranger](https://ranger.github.io/) to navigate around my file system. Is there a shortcut where I `cd` into a folder without leaving Ranger *(as in open bash with a location of a folder found by navigating in Ranger)*?
I'm using [Ranger](https://ranger.github.io/) to navigate around my file system.
Is there a shortcut where I
cd
into a folder without leaving Ranger *(as in open bash with a location of a folder found by navigating in Ranger)*?
Philip Kirkbride
(10746 rep)
Feb 2, 2017, 05:24 PM
• Last activity: Apr 19, 2023, 01:24 PM
6
votes
2
answers
1607
views
How do you go back to the previous directory in Ranger?
In Ranger you can go to a directory with g . When you type g it gives you a list of places you can very easily go. For example g , and then p takes me to `/tmp`. How do I get back to the directory I was in? What's the ranger equiv of `cd -`? When I type g I do not see the option to `cd` back.
In Ranger you can go to a directory with g. When you type g it gives you a list of places you can very easily go. For example g, and then p takes me to
/tmp
. How do I get back to the directory I was in? What's the ranger equiv of cd -
?
When I type g I do not see the option to cd
back.
Evan Carroll
(34663 rep)
Dec 27, 2018, 03:53 AM
• Last activity: Apr 8, 2023, 03:38 PM
0
votes
1
answers
321
views
Log of actions done in ranger?
Is it possible for `ranger` to record file/folder actions? I'm looking for a logging feature for every file/folder action done in `ranger`.
Is it possible for
ranger
to record file/folder actions? I'm looking for a logging feature for every file/folder action done in ranger
.
Sepp A
(73 rep)
Mar 8, 2023, 04:44 PM
• Last activity: Mar 8, 2023, 07:37 PM
35
votes
2
answers
31718
views
How can I move all `marked` files to another directory in ranger?
When I select multiple files within ranger (using ` ` or `V`), how do I move these selected files to another directory? I've tried to use `dd` and `pp`, but this only moves the file that's currently highlighted.
When I select multiple files within ranger (using `
or
V`), how do I move these selected files to another directory?
I've tried to use dd
and pp
, but this only moves the file that's currently highlighted.
Matt
(816 rep)
May 23, 2017, 10:34 AM
• Last activity: Feb 21, 2023, 01:44 PM
0
votes
0
answers
54
views
Ranger Has incorrect colorsheme when opened with firefox
I couldn't really find a better place to ask this question and figured that if anyone would know it would be you guys. So when I open ranger it inherits my colorscheme and styling from alacritty, however whenever ranger is invoked by firefox (set as default in my mimetypes config) It completely flas...
I couldn't really find a better place to ask this question and figured that if anyone would know it would be you guys.
So when I open ranger it inherits my colorscheme and styling from alacritty, however whenever ranger is invoked by firefox (set as default in my mimetypes config) It completely flashbangs me with what looks like the default tty font and a very, very white background.
I was wondering how to make this not happen.
Here are screenshots with the comparison:
Edit: I have discovered that it gives this error in terminal that is running firefox

: cannot load font "-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso10646-1"
this clued me in that my firefox is run in some type of compatibility layer, probably because of my window manager OS combo.
I suppose extra context that I am running Arch Linux with sway/wayland as my window manager. A work around for now is using nautilus instead, but I would still prefer ranger if at all possible.
RustedSasquatch
(1 rep)
Jan 11, 2023, 08:48 PM
• Last activity: Jan 11, 2023, 09:13 PM
46
votes
4
answers
42597
views
How to create a new file or directory using ranger?
I want to create a new file or directory with ranger. I suppose I could use `mkdir` or `touch`, but I'm not sure if these would go in the current directory as viewed in ranger.
I want to create a new file or directory with ranger. I suppose I could use
mkdir
or touch
, but I'm not sure if these would go in the current directory as viewed in ranger.
Chris Stryczynski
(6603 rep)
Aug 6, 2017, 03:23 PM
• Last activity: Nov 14, 2022, 09:10 AM
3
votes
1
answers
3037
views
ranger "set preview_files true" does not work
Since quite some time the file-preview-window in ranger stays empty. I.e. it indeed shows up but does not preview the content of text-files. Image preview and `.pdf` preview however does work. The content of my ranger-config-file looks like the following: ``` user@computer ~ $ cat ~/.config/ranger/r...
Since quite some time the file-preview-window in ranger stays empty.
I.e. it indeed shows up but does not preview the content of text-files.
Image preview and
.pdf
preview however does work.
The content of my ranger-config-file looks like the following:
user@computer ~ $ cat ~/.config/ranger/rc.conf
map DD shell mv %s /home/${USER}/.local/share/Trash/files/
# set colorscheme [default|jungle|snow|solarized]
set colorscheme default
set mouse_enabled false
set preview_images true
set preview_files true
**Solution attempt 1:**
I even explicitly inserted the line set preview_files true
into rc.conf
, all tough according to this site , ranger should preview text-file-contents by default.
**Solution attempt 2:**
According to archlinux the function in order to preview PDFs and images is stored in ~/.config/ranger/scope.sh
, so I did some research and figured out by this side , that scope.sh
is the script ranger runs when it tries to preview **any** file. I never changed it knowingly, but to be save i did reset it:
user@computer ~ $ rm ~/.config/ranger/scope.sh
user@computer ~ $ ranger --copy-config=scope
Still the preview stays empty!
PatrickSteiner
(621 rep)
Jan 11, 2019, 02:24 PM
• Last activity: Sep 22, 2022, 11:00 AM
2
votes
0
answers
254
views
How to send Alt+1 to CLI when multiple tabs are open in gnome-terminal?
Both [`ranger`](https://ranger.github.io/) and the gnome-terminal use `Alt + 1`, `Alt + 2` etc to switch to the corresponding tab. So if a gnome-terminal window only has one tab and `ranger` is open, then pressing `Alt + 2` will go the second tab in `ranger`, but as soon as a second tab in the gnome...
Both [
ranger
](https://ranger.github.io/) and the gnome-terminal use Alt + 1
, Alt + 2
etc to switch to the corresponding tab. So if a gnome-terminal window only has one tab and ranger
is open, then pressing Alt + 2
will go the second tab in ranger
, but as soon as a second tab in the gnome-terminal window is open, ranger
will no longer receive this command, it will always be captured by the gnome-terminal window.
Now this issue could easily be resolved by changing one or the other keybindings, but I'd like to avoid that.
Is there an alternative way to send the Alt + 1
, Alt + 2
etc commands to ranger
even if we have multiple tabs in our gnome-terminal while using the default keybindings in both programs?
EDIT: I believe there was a similar issue in [this question](https://unix.stackexchange.com/questions/32552/how-to-bypass-gnome-terminal-when-sending-keyboard-input) , but maybe something has changed over the past 10 years.
flawr
(145 rep)
Jun 9, 2022, 09:22 AM
6
votes
4
answers
3606
views
"scope.sh" is lacking for ranger file manager
Ranger is a file manager using Miller columns to navigate between the tree. It has an external script called *scope.sh* that previews files utilizing external applications such as the `.torrent` files with `transmission-show`. I've installed all the dependencies, that is the external binaries for it...
Ranger is a file manager using Miller columns to navigate between the tree.
It has an external script called *scope.sh* that previews files utilizing external applications such as the
.torrent
files with transmission-show
.
I've installed all the dependencies, that is the external binaries for it to function, but the file manager, that's ranger
doesn't preview those files.
I checked ~/.config/ranger/
contents, and it turns out the script (scope.sh
) is absent there.
I am on Fedora 25 and I have installed ranger normally through dnf install ranger -y
.
Please help me with providing scope.sh
file.
As I think that's the reason why ranger
doesn't preview those files.
user86041
Dec 10, 2016, 06:27 PM
• Last activity: May 9, 2022, 01:09 PM
Showing page 1 of 20 total questions