Efficient system exploration/navigation on Linux?

Efficient system exploration/navigation on Linux?

I've been using unix and the command line for some time already, but my main method for navigating through files and directories is still cd path; ls; cd path; ls.... This is not effective at all. Visually it is very difficult to get an overview of a directory. No images, no colors to differentiate files and folders. I still am much more productive using a file browser, when I want to explore.

I can't comprehend how so many people live without a graphical file browser at all. Is there some trick that I am missing?

答案1

  • ls --color helps a lot. Put alias ls=ls --color in your ~/.bashrc to make it permanent each time you log in or open the terminal.

  • Install Midnight Commander - it's a text-mode file manager.

I can't comprehend how so many people live without a graphical file browser at all. Is there some trick that I am missing?

One must use the right tool for the job. The command line is versatile but there are instances where it's use is not indicated or warranted.

If I have an SSH login to a Linux system on a Windows and really need to do some hardcore exploring or drag-drop file managing, I'll login via WinSCP and use that as a file manager. I usually have WinSCP on any system I have PuTTY on.

Working natively on a Linux system (not SSH'd via Windows) I'm not ashamed to use nautilus when needed. If you are working in a minimal desktop that doesn't have a good file manager rox-filer is decent and usually an apt-get away.

答案2

I'm sure there are any number of utilities to assist with this in Linux, and it is largely a matter of personal preference. My personal favorite is (naturally) one that I wrote for myself: wdir (http://willus.com/archive/#cmdline). There are two options I use a lot--one is the -r option to recursively list all files in a directory tree (by default it sorts by date). I like this much better than ls -lR because each file is listed with its complete subpath. The other is -sum to sum up the disk usage of all subdirectories one level down. It may not be quite what you want, but I've found it very effective for finding files quickly and also for quickly determining folders which are taking up a lot of space or have a lot of files. Output is colored by type but not presently configurable like ls --color. Note that you have to double-quote wildcards for it, e.g. wdir "*.txt".

答案3

1) If you want to get to certain directories quickly, create links to them. There are two types of links - symbolic links: Refer to a symbolic path indicating the abstract location of another file - hard links : Refer to the specific location of physical data. Use the ln command. For soft (symbolic) links,

ln -s {target-filename} {symbolic-fileorfoldername}

Hard links can only be created for actual data, i.e. not for directories.

These two combined should keep you from using a lot of "cd" commands and explicit file paths to things you use often. However, keep in mind that the navigation is almost identical from the Windows command line as it is in linux. So if you use a GUI in Windows, why not in Linux too, one of the bazillion-or-so file explorer programs?

2) I believe that 'ls' is by default color-enabled, but if yours isn't, you can easily configure the color options to differentiate files, folders, etc.

The configuration file for the ls color command is /etc/DIR_COLORS for Linux. You can modify those colours if you want. You can also define a shell variable "COLORS" then use that file (use echo $COLORS to check). There are many references such as http://www.cyberciti.biz/tips/where-is-color-of-ls-command-defined.html or http://how-to.wikia.com/wiki/How_to_set_the_colors_displayed_with_the_ls_command

答案4

Yes, navigating with only the terminal commands can be a pain at times. I think most people use GUI file managers for most practical uses. Some of the more popular ones are Nautilus, Dolphin, and Thunar. If you prefer working with terminals or don't have access to a GUI you may want to try ranger, which displays your files in a tree-structure right in the terminal. This is my favorite way of browsing files since it has vi-like key bindings, color support, tabs, and file previewing and opening.

相关内容