ranger

刚从windows系统转到ubuntu的时候,总觉得ubuntu文件系统的文件系统很难用。在terminal和文件系统中切换感觉成本相当的高,而且ubuntu的文件系统非常难用,换了几个文件系统,都不理想。直到我发现ranger在terminal中的文件系统,相当好用,相当强大。下面我来介绍一下ranger。

先来看看效果:
ranger

1. 在ubuntu下安装:

1
sudo apt-get install ranger caca-utils highlight atool w3m poppler-utils mediainfo

安装了除了ranger之外的其他软件,主要是用来预览文件用的。安装好ranger以后,运行

1
2
ranger // 进入
q // 退出

ii ranger在安装目录有自己的配置文件,你可以把复制到自己的文件目录下,通过命令:

1
ranger --copy-config=all

配置文件的目录位置在:

1
cd ~/.config/ranger

2. 使用技巧

ranger的操作是vim-style。平时使用vim的话,会十分顺手。如果你使用terminal是xterm或者其它支持多256色的终端,则可以预览图片。因为我使用的是yakuake,研究了半天都不知道怎么才可以预览图片,这个问题先放在这里,以后有时间再解决。

导航操作:

正常移动

  • j = Move down
  • k = Move up
  • h = Move to parent directory
  • gg = Go to the top of the list
  • G = Go to the bottom of the list
  • -f = Page down
  • -b = Page up
  • J = Page down 1/2 page
  • K = Page up 1/2 page
  • H = Go back through navigation history
  • L = Go forward through navigation history
    目录快捷切换
  • gh = cd ~
  • ge = cd /etc
  • gu = cd /usr
  • gd = cd /dev
  • go = cd /opt
  • gv = cd /var
  • gm = cd /media
  • gM = cd /mnt
  • gs = cd /srv
  • gr = cd /
  • gR = cd to ranger’s global configuration directory
    我觉得这软件做的特别好的一点,当你在输入g的时候,它会跳出所有能和g配对的命令,而且还有相应的提示。提示信息非常人性化,一看就懂。

    文件操作:

    ranger的文件操作也是很方便:
  • i = Display file (useful if you’d like to view a text file in a pager instead of editing it)
  • l or E = Open file (opens file in default file-handler)
  • r = Open file with… (allows you to choose program to use)
  • o = Change sort order (follow by character in menu selection)
  • z = Change settings (commonly used toggle settings)
  • zh = View hidden files
  • = Select current file
  • t = Tag file (you can perform actions on tagged files)
  • cw = Rename current file
  • / = Search for files
  • n = Jump to next match
  • N = Jump to previous match
  • yy = Yank (copy) file
  • dd = Mark file for cut operation
  • = Delete selected file

    tab切换

    ranger也支持多tab:
  • -n = Create new tab
  • -w = Close current tab
  • = Next tab
  • = Previous tab

    通用命令

  • ? = View ranger man page
  • 1? = Keybindings help
  • 2? = Command help
  • 3? = Settings help
  • R = Reload current directory
  • Q = Quit

    外部调用接口

    ranger除了自己的支持,还有支持外部的shell调用
  • ! = Execute a command from the shell (non-ranger commands)
  • : = Execute a ranger command
  • du = Measure disk usage of current directory
  • chmod = Change permissions of current file

结束

应该还有很多方便的功能,以后再慢慢挖掘。