201 lines
16 KiB
Plaintext
201 lines
16 KiB
Plaintext
|
|
Episode: 1756
|
||
|
|
Title: HPR1756: Ranger File Manager
|
||
|
|
Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr1756/hpr1756.mp3
|
||
|
|
Transcribed: 2025-10-18 08:53:03
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
This is HPR Episode 1,756 Entitled Ranger File Manager.
|
||
|
|
It is hosted by me and is about 22 minutes long.
|
||
|
|
The summary is introduction to the Ranger Command Line File Manager.
|
||
|
|
This episode of HPR is brought to you by An Honesthost.com.
|
||
|
|
Get 15% discount on all shared hosting with the offer code HPR15.
|
||
|
|
That's HPR15.
|
||
|
|
Better web hosting that's honest and fair at An Honesthost.com.
|
||
|
|
Hello again, this is Be Easy, signing in, taking some feedback from some of the discussion
|
||
|
|
from the summary podcast from HPR.
|
||
|
|
I'm introducing myself this time.
|
||
|
|
The first time I was exactly sure which handles I'm going to use, so I just left it blank.
|
||
|
|
But now, here I am once again, Be Easy and giving up a follow-up podcast to my initial one
|
||
|
|
about how I use Linux to run my small business.
|
||
|
|
There are some thoughts about this one project that I use a lot called Ranger,
|
||
|
|
and I just decided I'm going to go into it a little bit.
|
||
|
|
So Ranger is a command line utility for kind of like Midnight Commander.
|
||
|
|
It's NCURSE's based file manager, but it has VIM key bindings.
|
||
|
|
So I'm going to read just a little bit from the man page and then tell you a little bit about how I use it.
|
||
|
|
So from the man page, the description is Ranger is a console file manager with VI key bindings.
|
||
|
|
It provides minimalistic and nice curses interface with a view on the directory hierarchy.
|
||
|
|
The secondary task of Ranger is to figure out which program you want to open
|
||
|
|
for each type of file.
|
||
|
|
And so that's a brief introduction of what it is.
|
||
|
|
And the first thing you want to do is configure it a little bit.
|
||
|
|
You can hack it, you can customize it the way you like.
|
||
|
|
And I'm just going to go through a little bit about how I use it.
|
||
|
|
The project page is vanger.nongenu.org.
|
||
|
|
And it has some nice documentation there on how to use it.
|
||
|
|
Also you can find it in a lot of repos.
|
||
|
|
It's in the Debian and Ubuntu repos.
|
||
|
|
And also the Fedora repos and Arch.
|
||
|
|
And those are the ones I've checked.
|
||
|
|
So what else does it do?
|
||
|
|
Well, the main view of the system is like a three-paint view.
|
||
|
|
There's like the previous view.
|
||
|
|
There's a previous pane, the current pane, and the next pane.
|
||
|
|
So you use either arrows or your VI keys, which are H, J, K, and L for moving around.
|
||
|
|
So J and K up and down, or down and up, and then H and L left and right.
|
||
|
|
So you can use those, or you can use up and down left right.
|
||
|
|
You can use page up and page down if you want to just simply move around.
|
||
|
|
And so that's pretty cool.
|
||
|
|
It's kind of a tree view.
|
||
|
|
You can just go from tree to tree to tree.
|
||
|
|
You can go down to the next folder and then go over.
|
||
|
|
And then see what's inside of that folder.
|
||
|
|
And then go over and see what's inside of that folder.
|
||
|
|
And the really cool thing is that it previews files real-time.
|
||
|
|
The reason why I like this better than midnight commanders, because midnight commander,
|
||
|
|
you have to hit F3 to preview the file if it's a text file.
|
||
|
|
And it's really limited to the types of files that it can preview.
|
||
|
|
There's a lot more flexibility with Ranger.
|
||
|
|
So there's some optional dependencies that you can install that will allow you to preview lots of different types of files.
|
||
|
|
You can install Kaka Utils, so CACA-utils, for ASCII art.
|
||
|
|
So it'll turn JPEGs and BMPs into ASCII art in your screen.
|
||
|
|
So it's really cool to see, especially something with not a lot of detail,
|
||
|
|
or even some really close-up pictures.
|
||
|
|
You can see really cool ASCII art.
|
||
|
|
There's a highlight.
|
||
|
|
So Kaka Utils highlight is for syntax highlighting for code.
|
||
|
|
So I've seen it work for HTML, XML, CSS, C, Python.
|
||
|
|
It's the ones I've seen it, but I'm sure it doesn't work that.
|
||
|
|
A tool is another one that you can install that'll look inside of archive file.
|
||
|
|
So zip, tar, and I think even like dev files that'll look inside.
|
||
|
|
Links, or W3M, or e-links, to look at HTML, to give your preview of what the HTML page will look in,
|
||
|
|
and text my browser, PDF to text.
|
||
|
|
So that's PDF, T-O-T-E-X-T, and that will let you preview PDFs that are not scanned PDFs,
|
||
|
|
and PDFs that were turned into PDFs from either latex or word to some other way.
|
||
|
|
Transmission dash show will show you BitTorin information if you're looking at a BitTorin file.
|
||
|
|
And media info, or XF tool, or EXIF tool, for media file info.
|
||
|
|
I don't use media info anyway, and the media info dash GUI,
|
||
|
|
if I'm using a GUI application to look at the metadata for media.
|
||
|
|
And so it's pretty cool. So if you go to an MP3 file, and that's the file that you're highlighting
|
||
|
|
to preview on the right-hand side, so when you're looking at a file on the side of directory,
|
||
|
|
the next pane turns into a preview pane. And so that's what you'll either see the ASCII art or
|
||
|
|
the text or the media file information. And so if you go to an MP3 file, you'll see all the
|
||
|
|
information about the artist and the genre and the codex that was used to create it, all that kind
|
||
|
|
of stuff. If you've never used media info, you should just check that out anyway. It's pretty cool.
|
||
|
|
And the other thing is that the whole system is color coded, and there's three different themes
|
||
|
|
that you choose from. I think you probably download some other ones, but there is the default one,
|
||
|
|
which I just use. There's a jungle, which is more green for the main colors, and there's snow,
|
||
|
|
where white is the main color. And so there's a little bit of customization there, and I'm going to go
|
||
|
|
into a little bit later where you make these configurations. And then so when you're also
|
||
|
|
navigating through the files, you can preview the file in that next menu, but if you hit right
|
||
|
|
one more time when you're on that file, it'll actually open it in the launcher that you choose
|
||
|
|
to use the open file. And there's a config file to use to define that so you can either, for like a
|
||
|
|
text file, I use them. So it'll open a text file, and then it'll open a PDF file, and events,
|
||
|
|
it'll open up a MP3 file, and I think I haven't said it. So it's really useful, or you know,
|
||
|
|
like a ODT file to open up a LibreOffice. So you can navigate, you can preview. The only thing I
|
||
|
|
don't like is that there really isn't a preview for LibreOffice or open documents. So you actually
|
||
|
|
just have to hit right one more time and open those to see what it looks like.
|
||
|
|
Just as a side note, I also use this other program called NC-DU, which is NCURSES-DU to analyze
|
||
|
|
space that's available in different folders. So it gives you like a graphical view of how much
|
||
|
|
space you have in that current directory, and you can navigate similarly as you do in
|
||
|
|
and ranger, when you hit over, you can go inside of that folder and see which files are the
|
||
|
|
biggest in that next folder, and they can hit over again, or up, down, left, right, and see which
|
||
|
|
ones are the biggest ones in the next subfolder, and so you can find, I use it to find random files
|
||
|
|
that I didn't know were still in my system, I've taken up a lot of them. All right, going back
|
||
|
|
into the configuration of ranger. So one of the biggest things that you can do, first thing you
|
||
|
|
need to do is you have to create the ranger files, and to do all the config files, so the first thing
|
||
|
|
you do is you run ranger-config, copy-config equals all, and that'll make the default copies of
|
||
|
|
all the config files, and they're located in the home directory.config or slash.config-ranger-directory.
|
||
|
|
There's an rc.conf file, so rc.co.f, which is where you set all your key bindings in some of your
|
||
|
|
settings. There is the commands.py file, which is a Python script, which when you're in command mode,
|
||
|
|
so when we hit colon, there's a lot of commands you can do, just like you do in VIM, and it
|
||
|
|
tells you all those, and so a lot of the key bindings, you can key bind to things that are done in the command mode.
|
||
|
|
And you can customize those and add more Python scripts if you want to. We're just right inside of
|
||
|
|
there, and it lets you, it's also where you customize which files, which programs open the files.
|
||
|
|
There's also the scope.sh, which is where you define the files that you are used for making the
|
||
|
|
previews, and I am in a process of making one, I use markdown a lot, and I'm in the process of
|
||
|
|
making one that uses Python markdown to turn a markdown file into HTML, and then the set net
|
||
|
|
to links, so that it will preview the markdown file in HTML on my screen. And I think I have
|
||
|
|
it just to test it. Navigation is the next thing I want to talk about, so like I said, there's
|
||
|
|
up-down left right, you can go GG to go to the top, or capital G to go to the bottom, which is
|
||
|
|
like you do in VI. Capital E is used to edit a file, and it will open up using whatever editor you
|
||
|
|
chose. Like I said, there's page up and page down. Has for some of the other commands that you can
|
||
|
|
use, you can use spacebar to mark the current item to do stuff to it, so move it, delete it,
|
||
|
|
whatever. You can also use the command mark, and then a pattern, so colon the word m-a-r-k, and then
|
||
|
|
regular expression to mark all the ones that match a certain regular expression, and then you can
|
||
|
|
do other stuff to them, and some of the things you can do to the files or the folders is you can do
|
||
|
|
DD, and then PP to cut and paste something. You can use YY to yank it, and then PP to put it in
|
||
|
|
another place, which would be like a copy and paste instead of a cut and paste. You can also
|
||
|
|
have some other commands you can use, you can use colon touch, and then the file name to create a
|
||
|
|
new file, colon m-k-d-i-r or make-d-r to make a new directory. You can do colon grip to
|
||
|
|
and then your search criteria to find items, find words, or things that match in the different
|
||
|
|
files. You can either press the delete key, and it's going to ask you to confirm, and to delete,
|
||
|
|
or you can type in colon delete the word delete, and that'll also delete the file.
|
||
|
|
You can use colon rename, or colon bulk rename, colon rename, whatever one you're on, or whatever
|
||
|
|
ones you've marked, you rename, and it'll just rename it to whatever the next word that you put in,
|
||
|
|
the command. Next to that, there's also the bulk rename, and so what you do is you mark all the files,
|
||
|
|
and then you do bulk rename, and hit enter, and it's going to create a file out of that, and you edit that
|
||
|
|
file with the names that you want things to be changed to. So it's going to make a file with all the
|
||
|
|
names of the directories and the files that are in the directory that you're in, and then you can
|
||
|
|
like, on the computer, just delete words, or delete letters, characters, and replace them with other
|
||
|
|
characters, and we hit save, and I'll say do, I'm sure you want to do that, and then you say yes,
|
||
|
|
and it changes the names of all those files to whatever you've redained them in that file that
|
||
|
|
you edited. It's a pretty cool trick. To get it to work for me, I was getting this error,
|
||
|
|
and I don't know if it's because it's the old version of our different version of Python or
|
||
|
|
something, but I had to change something in the Python configuration script, where it was
|
||
|
|
trying to call something, it's called ranger.container.file, so it was looking for a from ranger.container.file
|
||
|
|
import capital word file. I just had to change the word ranger.container to ranger.fsobject.file
|
||
|
|
import file, because when I looked in the Python libraries, I couldn't find the container folder,
|
||
|
|
but I found, when I did a, when I did a grep for the word file for the capital F, I found it in the
|
||
|
|
fsobjects library, so I changed it to that and all of a sudden worked, so I guess that's the fix.
|
||
|
|
Another, some of the key bindings that you can use, you can use zh that'll toggle hidden files
|
||
|
|
on and off, so it starts off with hidden files not shown, you can hit zh to turn hidden files on,
|
||
|
|
you can use gn and that's going to make a new tab, and then gt or gcapitalt, and that's how you
|
||
|
|
navigate between tabs, so just like in vim or vi, you can do everything in the current screen,
|
||
|
|
you can make a new buffer, you can make a new tab, same thing you can make a new tab, so it's a tree,
|
||
|
|
but it's also, you can make separate tabs, some like it's stuff in separate tabs,
|
||
|
|
you can use the slash, the forward slash key, and type in characters to do a search on that
|
||
|
|
directory, just like you would, if it was a file in vi, where if you, if there's a file that was called
|
||
|
|
foo.txt, if you went slash and it foo, it would find foo, and then you could end, and they'll go next next next
|
||
|
|
to all the ones that have found in that directory, it's pretty cool, you can do capital v to go into visual
|
||
|
|
mode, I haven't used this very much, but I think it's another way to select multiple,
|
||
|
|
you can do colon open underscore with, and then you can use another command instead of using the default
|
||
|
|
file, the default program that opens up that application, you can use a different one, but using that,
|
||
|
|
I think you can also use, I think it's R, and it'll also do open with, and there's a lot of commands,
|
||
|
|
and a lot of different key binders and stuff, so the way that you can access all this stuff is
|
||
|
|
through the help, and there's four different ways to get into help, the main help you just hit
|
||
|
|
question mark when you're a major, and you'll be able to see the man page basically, you can do one
|
||
|
|
question mark, and that'll give you a list of all the key bindings, you can do two question mark,
|
||
|
|
and that'll list you all the commands that you can do command mode, and you can do three question mark,
|
||
|
|
and that will give you a list of all the settings, and so like I said, this is tip of the iceberg,
|
||
|
|
kind of like them where you can do a lot or you can do a little, but they get comfortable with it,
|
||
|
|
it doesn't take very much, you know, if you know how to use arrow keys, you can get a lot of
|
||
|
|
use out of it, and then that's how I use it, I read a lot of my notes just with a terminal open
|
||
|
|
full screen, because it doesn't really allow you to scroll through the files, because it's a
|
||
|
|
preview screen, so you'd have to open them to scroll through them, but if you have short enough
|
||
|
|
notes or short enough information in the files, in a full screen like 720 or 1080p screen,
|
||
|
|
you can see almost the entire file contents, and you can navigate, never even have to open up
|
||
|
|
other applications, you can spend a lot of time and ranger, so I use it not just for my small business,
|
||
|
|
just about any computer that I install, like I have Raspberry Pi, and I installed ranger
|
||
|
|
on it using both Raspbian and Pidora, just because it's an easy way to navigate through the file structure,
|
||
|
|
so that pretty much sums up what I'm going to talk about on this video, on this podcast,
|
||
|
|
and let me know if you have anything else that you want to talk about from my original post,
|
||
|
|
there's a couple of other things I want to cover, and let me know if there's anything
|
||
|
|
particular that you want to know about that I use, by no means an expert, but you know,
|
||
|
|
I've used things a couple times, you know, for a couple of months, and I've run into problems,
|
||
|
|
and I've fixed them, and the fact that I'm still using them means that none of the problems
|
||
|
|
I ran to were an issue, so hopefully that makes sense to everyone, and please give me feedback,
|
||
|
|
I love hearing the feedback about how to make the podcast better, when information
|
||
|
|
you would like more of, what you would like less of, and I'll probably do a couple more before
|
||
|
|
all of a sudden, thanks, bye!
|
||
|
|
You've been listening to Hacker Public Radio at Hacker Public Radio dot org.
|
||
|
|
We are a community podcast network that releases shows every weekday, Monday through Friday.
|
||
|
|
Today's show, like all our shows, was contributed by an HPR listener like yourself.
|
||
|
|
If you ever thought of recording a podcast, then click on our contributing to find out
|
||
|
|
how easy it really is. Hacker Public Radio was founded by the digital dog pound and the
|
||
|
|
infonomicum computer club, and it's part of the binary revolution at binrev.com.
|
||
|
|
If you have comments on today's show, please email the host directly,
|
||
|
|
leave a comment on the website, or record a follow-up episode yourself.
|
||
|
|
Unless otherwise status, today's show is released on the creative comments,
|
||
|
|
attribution, share a light, free dot org license.
|