Execute command on ranger selection?
23,643
This is in man ranger
:
@
Open the console with the content "shell %s", placing the cursor before the " %s" so you can quickly run commands with the current selection as the argument.
So,
highlight the files you want to work on with
Space
type
@
to get to a command prompt which will be:shell %s
with the cursor positioned before%s
type the name of your command and press
Enter
the command you specified will be executed with selected filenames as parameters
The man page also covers adding a pause to check command output:
FLAGS There are some additional flags that can currently be used only in the "shell" command: (for example ":shell -w df") p Redirect output to the pager s Silent mode. Output will be discarded. w Wait for an Enter-press when the process is done
Related videos on Youtube
Author by
Nicolas Scotto Di Perto
Updated on September 18, 2022Comments
-
Nicolas Scotto Di Perto almost 2 years
I haven't found an advanced tutorial on
ranger
yet, so my question is: is it possible to execute a command on a selection of files inranger
?If so, how would I do that?
-
acgtyrant almost 7 yearsIs there any output? I execute
:shell realpath %s
, but no output. -
LJNielsenDk over 5 yearsIs there a way to automatically get spaces and such escaped in the selected filenames that are passed? I can do it manually of course but it can get tedious.