In Linux systems, file management is a very important operation, but the traditional ls command cannot meet the user's needs for file list display. At this time, a more powerful and easy-to-use tool is needed. Today, we will introduce a tool called exa, which can make your Linux file management simpler and more efficient.
exa command introduction
exa is a command line tool that can list directories and files in the specified path (if not specified, the current directory). This may sound familiar because that's what the ls command does.
exa is considered a modern replacement for the ancient ls command that has been around since the old days of UNIX. As claimed, it has more features and better default behavior than the ls command.
exa function
Here are some reasons why you should use exa instead of ls:
exa is as portable as ls (available on all major Linux distributions, *BSD and macOS)
Default color output
exa's differently formatted "verbose" output may appeal to Linux/BSD newbies
File queries are performed in parallel, which makes the performance of exa and ls comparable
Display the git staged or unstaged status of a single file
Another thing that makes exa different is that it is written in Rust. By the way, Rust has similar execution speed to C, but reduces memory errors at compile time so your software can execute quickly and safely.
Install exa on Linux system
exa has become popular recently as many distributions have started including it in their official software repositories. That said, you should be able to install it using your [distribution's package manager].
Starting with Ubuntu 20.10, you can use the apt command to install it:
sudo apt install exa
Arch Linux already has it, you just need to use the pacman command:
sudo pacman -S exa
Don't worry if it doesn't install through your package manager. After all it is a Rust package and you can easily install it with Cargo. Make sure you have Rust and Cargo installed on whatever distribution you are using or Ubuntu.
After installing Rust and Cargo, use this command to install exa:
cargo install exa
Use exa
exa has many command options, mainly for better formatted output and some improvements to improve comfort, such as the git staged or unstaged status of files, etc.
Below are some screenshots showing how exa works on your system.
Simply using the exa command will produce output similar to ls but with colors. This color thing might not be that appealing, since distributions like Ubuntu already provide colored ls output, at least in the desktop version. However, the ls command itself does not have colored output by default.
Screenshot of the output of the exa command without any additional flags
Please note that the options for the exa and ls commands are not the same. For example, while the -l option gives a long listing in both exa and ls, the -h option adds a column header instead of the human-readable option of ls.
As I mentioned before, exa has column headers for better "verbose" output
As I said before, exa already has built-in Git integration. The screenshot below gives a demonstration of the –git flag. Note that test_file shows -N in git's tracked column because it hasn't been added to the repository yet.
Demo how git flags work with exa
The examples below were not typed by my cat. It is a combination of options. exa has many options for you to try and explore.
A very colorful and detailed output with user-friendly verbose output
You can get the full list of options by running the following command in the terminal:
exa --help
However, if you want to understand what exa has to offer, you can check out the official documentation on its Git repository.
Is it worth switching from ls to exa?
For those new to UNIX-like operating systems, exa may be user-friendly, sacrificing ease of use in scripts for "ease of use" and appearance. Which shows more clearly is not a bad thing.
Anyway, ls is like a universal command. You can use exa for personal use, but when writing scripts, stick to ls. The difference in one [or more] flags between ls and exa can drive you crazy when the expected output does not match the actual output in either command.
I want to know what you think about exa. Have you tried it already? What was your experience with it?
Through the introduction of this article, we have learned about the basic usage of the exa tool and some common options and parameters. Compared with the traditional ls command, exa provides more rich information display and formatting options, making our file management easier and more efficient. If you are a Linux system administrator or developer, then please do not hesitate to upgrade to the exa tool quickly!
The above is the detailed content of Make your Linux file management easier - upgrade to exa tool. For more information, please follow other related articles on the PHP Chinese website!