For Linux users, the ls
command has been a faithful companion for decades, diligently displaying directory contents. But in a world of vibrant interfaces and intuitive design, the black-and-white output of ls
can feel a bit… well, bland. Enter exa
command, a modern challenger aiming to revolutionize how we interact with our files.
Imagine a file browser infused with the power of the command line, with intuitive colors, informative details, and Git integration seamlessly woven in. That’s exa
command in a nutshell. It’s not just a prettier ls
; it’s a thoughtfully designed upgrade that enhances your workflow and makes working with files more enjoyable.
So, let’s dive into the world of exa
and explore its colorful potential. We’ll cover its core features, delve into its extensive options, and showcase how it simplifies everyday tasks with real-world examples.
Exa positions itself as a “modern replacement for ls
.” It displays file information in a colorful, user-friendly format, with intuitive defaults and extra features. Think of it as ls
on steroids, with a sprinkle of visual flair.
By default, exa
is a symphony of visual clarity. Files are color-coded based on their type (executables, symlinks, directories, etc.), making scanning directories a breeze. You can instantly identify important files like scripts or images without relying on file extensions. But exa
doesn’t stop at aesthetics. It displays essential information like file size, permissions, and timestamps, offering a concise overview without cluttering the terminal.
exa
paints your terminal with a spectrum of colors, effortlessly distinguishing file types, permissions, and Git status.Before we dive into the exa command’s capabilities, let’s ensure that it’s installed on your system. You can install exa using the package manager specific to your distribution. For example,
sudo pacman -S exa
sudo apt install exa
sudo dnf install rust-exa
sudo apt install exa
cargo install exa
Step1: Download the binary:
exa-linux-x86_64
).Step 2: Extract the archive:
tar xzf exa-linux-x86_64.tar.gz
Step 3: Move the exa
binary to a directory in your $PATH
(e.g., /usr/local/bin
).
sudo mv exa /usr/local/bin/
Step 4 (Man Page (Optional): Download the exa.1
man page and place it in /usr/share/man/man1
:
sudo mv exa.1 /usr/share/man/man1
Step 5: Verification:
Open a terminal and type exa --version
. If installed correctly, it should output the version information.
exa --version
While exa
shines with its default settings, it also boasts a powerful set of options for tailoring your experience. Let’s explore some of the most useful ones:
exa [options] [files or directories]
options
: These are various flags and parameters that modify the behavior of the exa
command.files or directories
: These are the files or directories you want exa
to operate on. If not specified, exa
will list the contents of the current directory.-l
(long format): Display extended file information, including permissions, owner, group, size, timestamps, and extended attributes.-a
(all files): Show all files, including hidden files (those starting with a dot).-t
(tree view): List files in a hierarchical tree structure, visually representing directory relationships.-h
(human-readable sizes): Display file sizes in human-readable units (e.g., “10M” instead of “10485760”).-g
(group directories): Group directories together, making it easier to scan directory structures.-i
(icons): Show icons next to file names based on file types.-s
(sort by size): Sort files by size, either in ascending or descending order.-r
(reverse sort): Reverse the sorting order of the files.-F
(classify): Append symbols to file names to indicate their types (e.g., “/” for directories, “*” for executables).-1
(one file per line): List each file on a separate line.‘exa’ allows you to customize the output format using the ‘-l’ flag. This provides a detailed list view, showing additional information such as permissions, owner, group, size, and modification time.
exa -l
The output will resemble:
-rw-r--r-- 1 user user 4096 Jan 1 00:00 file.txt
drwxr-xr-x 2 user user 4096 Jan 1 00:00 directory
lrwxrwxrwx 1 user user 4 Jan 1 00:00 symlink -> file.txt
To display file sizes in a human-readable format, use the ‘-h’ option:
exa -lh
This will show file sizes in kilobytes, megabytes, gigabytes, etc.
-rw-r--r-- 1 user user 4.0K Jan 1 00:00 file.txt
drwxr-xr-x 2 user user 4.0K Jan 1 00:00 directory
lrwxrwxrwx 1 user user 4 Jan 1 00:00 symlink -> file.txt
‘exa’ can display directory structures in a tree view using the ‘-T’ option:
exa -T
The output will represent the hierarchical structure of the directories.
.
├── directory
│ └── subdirectory
│ └── file.txt
├── file.txt
└── symlink -> file.txt
The ‘-s’ flag allows sorting files by different criteria, such as size, modification time, or name. For instance, to sort by size in reverse order:
exa -lsS
Output:
4096 Jan 1 00:00 directory
4096 Jan 1 00:00 symlink -> file.txt
0 Jan 1 00:00 emptyfile.txt
0 Jan 1 00:00 emptydirectory
0 Jan 1 00:00 file.txt
In this example, the files and directories are listed in descending order based on their sizes. The ‘directory’ and ‘symlink’ entries are at the top because they have a size of 4096 bytes, followed by an empty file (’emptyfile.txt’), an empty directory (’emptydirectory’), and finally, ‘file.txt’ with a size of 0 bytes.
‘exa’ supports various color schemes. Let’s use the ‘-l -C classic’ option to apply the ‘classic’ color scheme:
exa -l -C classic
Output:
drwxr-xr-x 2 user user 4096 Jan 1 00:00 directory
-rw-r--r-- 1 user user 0 Jan 1 00:00 emptyfile.txt
drwxr-xr-x 2 user user 0 Jan 1 00:00 emptydirectory
lrwxrwxrwx 1 user user 4 Jan 1 00:00 symlink -> file.txt
-rw-r--r-- 1 user user 0 Jan 1 00:00 file.txt
The ‘classic’ color scheme uses a combination of blue, green, and white for directories, regular files, and symbolic links, respectively. The color-coding enhances the visual representation of different file types.
‘exa’ provides Git status integration with the ‘–git (Git Status)‘ flag. Let’s use it to display Git status information:
exa --git
Output:
M file.txt
?? newfile.txt
In this example, ‘file.txt’ is marked with ‘M,’ indicating that it has been modified. ‘newfile.txt’ is marked with ‘??,’ indicating that it is an untracked file. This feature is beneficial for developers working with Git repositories, providing quick insights into the status of files.
‘exa’ allows you to filter files based on specific criteria. Let’s use the ‘–filter’ flag to display only files with a ‘.txt’ extension:
exa --filter '*.txt'
Output:
file.txt
emptyfile.txt
newfile.txt
In this example, the ‘–filter’ option filters and displays only the files with the ‘.txt’ extension. This is useful when you want to focus on specific types of files within a directory.
To display only files that have executable permissions, use the ‘-@’ flag:
exa -l -@
Output:
-rwxr-xr-x 1 user user 100 Jan 1 00:00 executable.sh
In this example, the ‘executable.sh’ file is the only one listed, and it has executable permissions, denoted by ‘rwxr-xr-x.’ This option helps identify executable files in a directory.
The ‘–git-ignore’ flag allows you to display files ignored by Git:
exa --git-ignore
Output:
.gitignore
ignoredfile.txt
In this example, ‘ignoredfile.txt’ is listed because it is specified in the ‘.gitignore’ file. This option is useful for confirming that files are being correctly ignored by Git.
‘exa’ provides the ‘–header’ option to customize the column headers in detailed listing mode:
exa -l --header "Permissions Size Date Modified Name"
Output:
Permissions Size Date Modified Name
-rw-r--r-- 0 Jan 1 00:00 emptyfile.txt
drwxr-xr-x 0 Jan 1 00:00 emptydirectory
lrwxrwxrwx 4 Jan 1 00:00 symlink -> file.txt
-rw-r--r-- 0 Jan 1 00:00 file.txt
In this example, the column headers are customized to display only ‘Permissions,’ ‘Size,’ ‘Date Modified,’ and ‘Name.’ This allows you to tailor the output to show specific information based on your preferences.
exa
Command:-l
, --long
: Display detailed file information in columns.-T
, --tree
: Show directory contents as a tree.-a
, --all
: Show hidden files.-h
, --human-readable
: Display file sizes in human-readable units.-g
, --grid
: Display files and directories in a grid.-s
, --sort
: Sort files by size, time, or name.-r
, --reverse
: Reverse the sorting order.-t
, --time
: Sort by time (modification time by default).--git
: Show Git status icons for tracked files.--icons
: Display icons for file types.--all
: Show all available file metadata.-1
, --oneline
: Display one entry per line.--header
: Add a header row to each column.--color
: Control when to use terminal colors (always, automatic, never).--color-scale
: Highlight different levels of file sizes with distinct colors.--group-directories-first
: Show directories before other files.--time-style
: Choose the format for timestamps.--level
: Number of directory levels to show in tree view.--recurse
, -R
: Recurse into directories.--no-permissions
: Don’t show file permissions.--no-user
: Don’t show file owner.--no-group
: Don’t show file group.-l
):-b
, --binary
: List file sizes with binary prefixes.-B
, --bytes
: List file sizes in bytes, without any prefixes.-g
, --group
: List each file’s group.-H
, --links
: List each file’s number of hard links.-i
, --inode
: List each file’s inode number.-m
, --modified
: Use the modified timestamp field.-S
, --blocks
: List each file’s number of file system blocks.-u
, --accessed
: Use the accessed timestamp field.-U
, --created
: Use the created timestamp field.-1
, --oneline
: Display one entry per line.-x
, --across
: Sort the grid across, rather than downwards.-0
, --null
: Separate entries with NUL characters.-v
, --version
: Show version information.-h
, --help
: Show help message.‘exa’ stands out as a versatile and user-friendly replacement for the traditional ‘ls’ command in Linux. Its intuitive features, colorful output, and integration with Git make it a valuable tool for both beginners and experienced users. By incorporating ‘exa’ into your daily workflow, you can enhance your file navigation and exploration experience on the Linux command line. Whether you’re a developer, sysadmin, or casual user, ‘exa’ brings a refreshing approach to listing directory contents in the terminal.
Ready to dive deeper into exa’s capabilities? Check out its official documentation for a comprehensive overview of options and features: https://the.exa.website/
Join the exa revolution and experience a more colorful, informative, and efficient way to navigate your Linux filesystem. Your terminal will thank you!
So, what are you waiting for? Give exa a try and see how it elevates your file listing experience. If you run into any questions or want to share your favorite exa configurations, don’t hesitate to drop a comment below! And remember, if you found this article helpful, please consider liking and sharing it with your fellow Linux enthusiasts. Let’s spread the word about this fantastic tool and make the terminal a more vibrant and informative place!
The post How To Install And Use exa Command in Linux appeared first on Linux Tutorial Hub.
2024 was the GenAI year. With new and more performant LLMs and a higher number…
Canonical’s Kubernetes LTS (Long Term Support) will support FedRAMP compliance and receive at least 12…
Welcome to the Ubuntu Weekly Newsletter, Issue 878 for the week of February 2 –…
At Canonical, we firmly believe that delivering an outstanding, customer-centric support experience is impossible without…
I want to share how to install osTicket v1.14 for Ubuntu 20.04 server. osTicket written…
Now I want to share how to install WordPress on ubuntu 20.04 server. WordPress is…