Unfortunately after 1.9.1 ranger has changed color handling and ignores terminal colors and tries to use its own scheme. It there any recipe to make ranger use terminal pallet?
It just occurs to me that 'managing files' is not something I tend to do anymore. My files generally stay in the place they are. And when I do manage files it usually involves a VCS anyway.
I do think file managers might be very useful for previewing files.
I use the command line extensively but never found a need for a file manager in there. Just `cp`, `mv`, `rm`. Am I missing something big by not having one?
I use ranger quite a lot when I have to explore the contents of a folder I just cloned or downloaded. Moving around with vim keybindings is much quicker than typing many `cd`, `ls` and `cat`, as you have a preview of files or folder contents on the right side.
I find it also quite useful when doing some housekeeping and cleaning, as while moving around you can mark several items to delete or move them all at once.
Ranger is fantastic, if you're used to vim keys you should definitely check it out. It do all those things you mentioned, but honestly my favorite use of it is as a replacement for `cd`. If you run it with `. ranger` (which I have alias'ed to `rd` in in my terminal), you end up cd'd to whatever directory you left off ranger at. Combined with the "f" command in ranger (as well as bookmarking folders with "m"), you can zip around your filesystem incredibly quickly.
You never tried and gotten used to orthodox file managers perhaps, such as the mighty Midnight Commander. That's okay. Yes you're missing out on a world of productivity.
> That's okay. Yes you're missing out on a world of productivity.
Feels like a sentence like this doesn't explain much. I assume you are not moving files around all day, so where is the productivity exactly in a tool like Midnight Commander? What it allows you to do?
One answer you probably won't be happy with: You don't need to memorize lots and lots of command line options. I can never remember the ones for tar, for example.
Bookmarking directories (local and remote), although there are command line ways to do this.
Being able to quickly view the contents of multiple files (that don't have a simple pattern in the filename). Frankly, any operation you want to do on multiple files that don't have a convenient regex to specify on one command. Say you have a directory of 100 files, and you want to copy about 15 of them elsewhere. It's just a lot easier in midnight commander to select them than to type out all their names.
And then there's stuff like selecting all files that have certain permissions, etc. No doubt you can do this from the command line, but again: Convenient when you don't know how.
Bulk renaming of files - again: I don't remember how to do this on the command line, and it's dangerous if I screwup.
Easily navigate any compressed files and copy stuff into/out of it.
> You don't need to memorize lots and lots of command line options.
But instead, the keyboard shortcuts for the file manager.
> Bookmarking directories (local and remote), although there are command line ways to do this.
For example zoxide. And depending on the usage pattern, it might turn out more flexible and easier to interconnect with other things.
> Say you have a directory of 100 files, and you want to copy about 15 of them elsewhere.
What is your typical use case for doing this?
I can quickly think of two situations where I needed to do that:
One I was copying a selection of photos for my uncle to a folder which I was going to burn on a CD. I am right now not sure whether his laptop still has a CD drive.
The other was I was developing some windows library and I needed to make a zip package for other people to test it, because there was still no installer.
I think I am not that unusual that generally I try to avoid making copies of the same data to different places; I try to use version control instead.
I was going to respond individually, but I realized we're looking at this the wrong way.
If you compare bash of today with that of 20 years ago, a lot of extensions/features have been added. On top of that, people use 3rd party tools to enhance their command line experience - you yourself mentioned zoxide. Lots of people make use of fzf. Imagine someone asking what the benefit of fzf is over using the command line - you likely will say that there's a false dichotomy - fzf is a command line tool to enhance your experience.
Likewise, midnight commander really is just that. You don't have to choose between the two. When running mc, you have full access to the command line. If you wish, you can just make the panels disappear and invoke them with a keybinding whenever you want to use them. I assume ranger will have similar capability.
It's not mc or the command line. It's mc and the command line.
Of course: In the same way as using fzf or zoxide means memorizing more. In the same way that using a modern shell means memorizing more. At my work there are a lot of people who don't know you can search your bash history with Ctrl-R because they learned the shell before that was a feature (or in most cases, before it was enabled by default).
My point is that the separation between mc and the command line is an artificial one. If you don't want to learn, you can always stick to an ancient shell and not learn all the new features. If you are willing to learn, then don't make a distinction between mc and shell features. It's basically: Here are N new useful things to learn, and perhaps I'll want to learn some of them. It's not: Here are N shell features to learn, and M other tools to learn.
Of course, you always have to ask yourself if learning it is a good use of your time. I myself have not learned any new shell featuresin a decade - I don't know what the new features are (I have, though, learned new shells). At some point, I realized there are too many things to learn and I need to strategize. I tried learning ranger a year or two ago. I definitely saw its power, but of all the things I wanted to learn, it was low on my list, so I dropped it. OTOH, I did learn dired recently, as I've always been a heavy Emacs user and I had neglected learning it all this time. mc is still better, though, but dired does have some capabilities that mc doesn't have. I started using autojump this year - now you tell me about zoxide. Maybe one day I'll look into it, but not today.
When I was a beginner, I liked Norton Commander a lot. Together with Midnight Commander (mc) on Linux, it belongs to the family of "orthodox" file managers which ranger is derived from. All these come with a visual display of the files in the current directory and are fast to navigate.
The command line tools are very fast to type and more powerful than Midnight Commander, if you took the time to learn them. I do really not think it is a issue that one needs to look up flags which one uses very rarely.
But, they might need more time for discovery of files. But the latter is only a issue if you do not work mostly on files you know well. For many software developers, this does not happen that often.
Also, the CLI tools will be present right away on all systems you work on, which us very useful if you often log in to servers or embedded systems.
Also, if you need to explore unknown directory trees, there are alternatives. For example, in certain cases, I am using Emacs dired a lot, especially when editing Makefiles, because then I have the exact file names already in my kill ring.
Now, ranger is more powerful than Midnight Commander, for example it can do a correct "copy/paste" operation with pasting symlinks, or hard links. And it can do that with a set of files which were hand-picked from different directories.
That is nice, but again it is something which one might not use very often. It is a bit similar like tmux having some, let's say, 150 key bindings but you only remember the ten or twelve you actually use often.
And this is where I run into a problem, or more neutrally said, into a region of diminishing returns: I could put energy and time into not only learning tools like ranger, but also use and deliberately practise them. But this needs time and effort. And this kind of time is a scarce resource, after all, I could learn more of emacs, say, magit (which is a truly fantastic git front end), or stumpwm key bindings (a window manager which works much like emacs), or learn whether "lz" is really better than "bzip2", or of one hundred other things. And my reasoning so far is that if I forgot such efforts after using them some time, they are actually not that useful for me. Because the human mind has the convenient feature of only remembering things which are either important, or used very often.
And in the specific case of ranger, this might be totally different if for the next week I have the task of tidying up and cleaning out a folder tree with 1000 folders and 10,000 files, for my successor on a project.
I find Ranger a lot easier, in Vifm I always have the feeling that 1 wrong keepress can have massive consequences without having any idea what happened/how to undo it.
Perhaps that's just me not knowing vifm well enough...
Someone knows if you can replace that vim interface with ranger itself, BTW? That could be quite handy in a pinch (having a split dedicated to ranger, for instance).
> Launch ranger using a keybinding from my shell (`bind` or `~/.inputrc` for bash, `bindkey` for zsh), which when combined with the previous technique allows me to very quickly switch folders (also combined with bookmarks) and get my bearings
> `:filter` to filter the items in the current folder (supports regex and has a live preview which updates as you type, can get laggy in large folders)
> `:flat` to flatten directory structures (-1 for infinite depth)
> `m<key>` to bookmark something, which you can jump to with `'<key>` (apostrophe)
> `om` to sort by last modification time, `os` to sort by size
> `dc` to recursively find the size of a directory (can be slow)
> `C-n` to create new tabs and `gt`/`gT` to switch back and forth between tabs which can be useful for copying/moving files
I also use `:bulkrename` a lot. It just opens a list of filenames in vim for modification, which makes it extremely simple to use regexes, macros, visual block modifications to rename a batch of files to your liking.
As well as `~` to switch from tabs to split-panes.
I'm just missing jumping to a file/folder by typing a few letters, as I have yet to get started with plugins like someone suggested me ( https://news.ycombinator.com/item?id=23507694 ).
Edit: someone wrote about `f` below, that looks like a very good answer.
Ah, and a little too eager to produce image previews for huge svg or png files (~20M), while leaving the background process when I change files. That can suck up huge amounts of RAM.
30 comments
[ 4.7 ms ] story [ 26.0 ms ] threadhttps://github.com/jarun/nnn
If that's not enough, can you be more specific?
I do think file managers might be very useful for previewing files.
I find it also quite useful when doing some housekeeping and cleaning, as while moving around you can mark several items to delete or move them all at once.
Feels like a sentence like this doesn't explain much. I assume you are not moving files around all day, so where is the productivity exactly in a tool like Midnight Commander? What it allows you to do?
Bookmarking directories (local and remote), although there are command line ways to do this.
Being able to quickly view the contents of multiple files (that don't have a simple pattern in the filename). Frankly, any operation you want to do on multiple files that don't have a convenient regex to specify on one command. Say you have a directory of 100 files, and you want to copy about 15 of them elsewhere. It's just a lot easier in midnight commander to select them than to type out all their names.
And then there's stuff like selecting all files that have certain permissions, etc. No doubt you can do this from the command line, but again: Convenient when you don't know how.
Bulk renaming of files - again: I don't remember how to do this on the command line, and it's dangerous if I screwup.
Easily navigate any compressed files and copy stuff into/out of it.
But instead, the keyboard shortcuts for the file manager.
> Bookmarking directories (local and remote), although there are command line ways to do this.
For example zoxide. And depending on the usage pattern, it might turn out more flexible and easier to interconnect with other things.
> Say you have a directory of 100 files, and you want to copy about 15 of them elsewhere.
What is your typical use case for doing this?
I can quickly think of two situations where I needed to do that:
One I was copying a selection of photos for my uncle to a folder which I was going to burn on a CD. I am right now not sure whether his laptop still has a CD drive.
The other was I was developing some windows library and I needed to make a zip package for other people to test it, because there was still no installer.
I think I am not that unusual that generally I try to avoid making copies of the same data to different places; I try to use version control instead.
If you compare bash of today with that of 20 years ago, a lot of extensions/features have been added. On top of that, people use 3rd party tools to enhance their command line experience - you yourself mentioned zoxide. Lots of people make use of fzf. Imagine someone asking what the benefit of fzf is over using the command line - you likely will say that there's a false dichotomy - fzf is a command line tool to enhance your experience.
Likewise, midnight commander really is just that. You don't have to choose between the two. When running mc, you have full access to the command line. If you wish, you can just make the panels disappear and invoke them with a keybinding whenever you want to use them. I assume ranger will have similar capability.
It's not mc or the command line. It's mc and the command line.
But does using both not mean one has to memorize more?
My point is that the separation between mc and the command line is an artificial one. If you don't want to learn, you can always stick to an ancient shell and not learn all the new features. If you are willing to learn, then don't make a distinction between mc and shell features. It's basically: Here are N new useful things to learn, and perhaps I'll want to learn some of them. It's not: Here are N shell features to learn, and M other tools to learn.
Of course, you always have to ask yourself if learning it is a good use of your time. I myself have not learned any new shell featuresin a decade - I don't know what the new features are (I have, though, learned new shells). At some point, I realized there are too many things to learn and I need to strategize. I tried learning ranger a year or two ago. I definitely saw its power, but of all the things I wanted to learn, it was low on my list, so I dropped it. OTOH, I did learn dired recently, as I've always been a heavy Emacs user and I had neglected learning it all this time. mc is still better, though, but dired does have some capabilities that mc doesn't have. I started using autojump this year - now you tell me about zoxide. Maybe one day I'll look into it, but not today.
When I was a beginner, I liked Norton Commander a lot. Together with Midnight Commander (mc) on Linux, it belongs to the family of "orthodox" file managers which ranger is derived from. All these come with a visual display of the files in the current directory and are fast to navigate.
The command line tools are very fast to type and more powerful than Midnight Commander, if you took the time to learn them. I do really not think it is a issue that one needs to look up flags which one uses very rarely.
But, they might need more time for discovery of files. But the latter is only a issue if you do not work mostly on files you know well. For many software developers, this does not happen that often.
Also, the CLI tools will be present right away on all systems you work on, which us very useful if you often log in to servers or embedded systems.
Also, if you need to explore unknown directory trees, there are alternatives. For example, in certain cases, I am using Emacs dired a lot, especially when editing Makefiles, because then I have the exact file names already in my kill ring.
Now, ranger is more powerful than Midnight Commander, for example it can do a correct "copy/paste" operation with pasting symlinks, or hard links. And it can do that with a set of files which were hand-picked from different directories.
That is nice, but again it is something which one might not use very often. It is a bit similar like tmux having some, let's say, 150 key bindings but you only remember the ten or twelve you actually use often.
And this is where I run into a problem, or more neutrally said, into a region of diminishing returns: I could put energy and time into not only learning tools like ranger, but also use and deliberately practise them. But this needs time and effort. And this kind of time is a scarce resource, after all, I could learn more of emacs, say, magit (which is a truly fantastic git front end), or stumpwm key bindings (a window manager which works much like emacs), or learn whether "lz" is really better than "bzip2", or of one hundred other things. And my reasoning so far is that if I forgot such efforts after using them some time, they are actually not that useful for me. Because the human mind has the convenient feature of only remembering things which are either important, or used very often.
And in the specific case of ranger, this might be totally different if for the next week I have the task of tidying up and cleaning out a folder tree with 1000 folders and 10,000 files, for my successor on a project.
Or, to sum it all up with some XKCD reference:
Is it worth the time? https://xkcd.com/1205/
https://vifm.info/
Perhaps that's just me not knowing vifm well enough...
I just made a video about it yesterday at: https://www.youtube.com/watch?v=oFc2kr734rs
> Using ranger to change directories (see: https://github.com/ranger/ranger/wiki/Integration-with-other...)
> Launch ranger using a keybinding from my shell (`bind` or `~/.inputrc` for bash, `bindkey` for zsh), which when combined with the previous technique allows me to very quickly switch folders (also combined with bookmarks) and get my bearings
> `:filter` to filter the items in the current folder (supports regex and has a live preview which updates as you type, can get laggy in large folders)
> `:flat` to flatten directory structures (-1 for infinite depth)
> `m<key>` to bookmark something, which you can jump to with `'<key>` (apostrophe)
> `om` to sort by last modification time, `os` to sort by size
> `dc` to recursively find the size of a directory (can be slow)
> `C-n` to create new tabs and `gt`/`gT` to switch back and forth between tabs which can be useful for copying/moving files
As well as `~` to switch from tabs to split-panes.
I'm just missing jumping to a file/folder by typing a few letters, as I have yet to get started with plugins like someone suggested me ( https://news.ycombinator.com/item?id=23507694 ).
Edit: someone wrote about `f` below, that looks like a very good answer.
Ah, and a little too eager to produce image previews for huge svg or png files (~20M), while leaving the background process when I change files. That can suck up huge amounts of RAM.