Skip to content

Instantly share code, notes, and snippets.

@heroheman
Last active April 16, 2024 03:54
Show Gist options
  • Save heroheman/aba73e47443340c35526755ef79647eb to your computer and use it in GitHub Desktop.
Save heroheman/aba73e47443340c35526755ef79647eb to your computer and use it in GitHub Desktop.
Ranger Cheatsheet

Ranger Cheatsheet

General

Shortcut Description
ranger Start Ranger
Q Quit Ranger
R Reload current directory
? Ranger Manpages / Shortcuts

Movement

Shortcut Description
k up
j down
h parent directory
l subdirectory
gg go to top of list
G go t bottom of list
J half page down
K half page up
H History Back
L History Forward
~ Switch the view

File Operations

Shortcut Description
<Enter> Open
r open file with
z toggle settings
o change sort order
zh view hidden files
cw rename current file
yy yank / copy
dd cut
pp paste
/ search for files :search
n next match
N prev match
<delete> Delete

Commands

Shortcut Description
: Execute Range Command
! Execute Shell Command
chmod Change file Permissions
du Disk Usage Current Directory
S Run the terminal in your current ranger window (exit to go back to ranger)

Tabs

Shortcut Description
C-n Create new tab
C-w Close current tab
tab Next tab
shift + tab Previous tab
alt + [n] goto / create [n] tab

File substituting

Shortcut Description
%f Substitute highlighted file
%d Substitute current directory
%s Substitute currently selected files
%t Substitute currently tagged files

Example for substitution

:bulkrename %s

Marker

Shortcut Description
m + <letter> Create Marker
um + <letter> Delete Marker
' + <letter> Go to Marker
t tag a file with an *
t"<any> tag a file with your desired mark

thx to the comments section for additional shortcuts! post your suggestions there!

@Zeioth
Copy link

Zeioth commented Jun 23, 2020

Since your cheatsheet have a good pagerank, it would be nice to add the markers section:

  • m+letter to create
  • um+letter to delete
  • '+letter to use)

@heroheman
Copy link
Author

Since your cheatsheet have a good pagerank, it would be nice to add the markers section:

  • m+letter to create
  • um+letter to delete
  • '+letter to use)

Did not know about this. Thanks for the hint and added it.
And I really don't know why its ranked that high. 🤷

@mareksubocz
Copy link

I believe there's a mistake in '+letter marks shortcut. It says it deletes the mark. Shouldn't it be to go to it?

@miku86
Copy link

miku86 commented Dec 3, 2020

I believe there's a mistake in '+letter marks shortcut. It says it deletes the mark. Shouldn't it be to go to it?

Yes. You hit ' + the created letter to go to the destination.

Other useful commands:

S: run the terminal in your current ranger window (exit to go back to ranger window)
t: tag a file with an * (great to mark files)
t"<any>: tag a file with your desired mark (I use this for videos I already watched)

I would also add the arrow keys as alternatives for the vim keys j, k, h, l, this makes it easier for ranger beginners.

@dzintars
Copy link

dzintars commented Feb 4, 2021

~ - Switch the views

@kave-me
Copy link

kave-me commented Feb 28, 2021

Perfect

@heroheman
Copy link
Author

I believe there's a mistake in '+letter marks shortcut. It says it deletes the mark. Shouldn't it be to go to it?

Yes. You hit ' + the created letter to go to the destination.

Other useful commands:

S: run the terminal in your current ranger window (exit to go back to ranger window)
t: tag a file with an * (great to mark files)
t"<any>: tag a file with your desired mark (I use this for videos I already watched)

I would also add the arrow keys as alternatives for the vim keys j, k, h, l, this makes it easier for ranger beginners.

thx for the suggestions, did not know about the t * marker!

@badele
Copy link

badele commented Mar 19, 2021

+ + letter + letter | add file permissions (chmod)
- + letter + letter | remove permissions (chmod)

@miku86
Copy link

miku86 commented Mar 31, 2021

I believe there's a mistake in '+letter marks shortcut. It says it deletes the mark. Shouldn't it be to go to it?

@heroheman Can you fix this?

Old: ' + <letter> Delete Marker

New: ' + <letter> Go to Marker

Thank you! :)

@heroheman
Copy link
Author

I believe there's a mistake in '+letter marks shortcut. It says it deletes the mark. Shouldn't it be to go to it?

@heroheman Can you fix this?

Old: ' + <letter> Delete Marker

New: ' + <letter> Go to Marker

Thank you! :)

Done that, sorry for the delay, keep them coming.

@xNaCly
Copy link

xNaCly commented Jun 28, 2021

great cheat sheet 😄 👍

@maciasello
Copy link

Tagging custom tag does not have t in front.

Old: t"<any>
New: "<any letter>

Keep up the great list :D

@GiorgosChr
Copy link

Is there a way to type shell commands and show the output?

@bassamanator
Copy link

Is there a way to cd into the directory that is selected?

@izmyname
Copy link

Thank you! Didn't know ranger THAT powerful.

@OsirisAnubis
Copy link

Thank a lot!

@d4ilyrun
Copy link

d4ilyrun commented Nov 1, 2023

Is there a way to cd into the directory that is selected?

You can press S

@bassamanator
Copy link

Is there a way to cd into the directory that is selected?

You can press S

That doesn't work unfortunately. Pressing s just changes the prompt to :shell , leaving as is or typing cd does nothing.

The only solution found is to start ranger via . ranger, and then when you exist, you find yourself in the last folder you were in.

@Glutnix
Copy link

Glutnix commented Dec 10, 2023

Is there a way to cd into the directory that is selected?

The only solution found is to start ranger via . ranger, and then when you exist, you find yourself in the last folder you were in.

I got this to work in bash by making an alias to start ranger - in your .bashrc or .bash_aliases add this line:

alias r=". ranger"

@bg2585
Copy link

bg2585 commented Dec 16, 2023

Is there a way to cd into the directory that is selected?

Ctrl + Shift + T opens another tab in the current directory. Ctrl + Shift + W closes current tab and Alt + (tab number position eg 1, 2, 3) navigates through the tabs

@bachir2000
Copy link

Great

@hans-chrstn
Copy link

"1l" to unzip files

@bjorn5th
Copy link

bjorn5th commented Apr 1, 2024

Thanks so much!!!

@msanchezpolanco
Copy link

tag a file with your desired mark: t"<any> should be "<any>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment