Moment For Technology

14 replacements for common command-line tools!

Posted on May 28, 2023, 2:28 a.m. by Ms. Sandra Henderson
Category: The back-end Tag: The programmer The front end The back-end

Author: JackTian

Source: Public account "Jie Ge's IT Journey"

ID: Jake_Internet

Please contact authorization for reprinting (wechat ID: Hc220088)

A replacement for 14 common command-line tools!

Hi, I'm Jack.

In Linux operating system, ls (list) can be said to be our daily high usage command, it is mainly used to display the target list, the output information can be highlighted in color, to partition different types of files. The syntax, options, examples, and extensions of ls[^1] are not covered here.


LSD [^2] is a replacement for the LS command written in Rust, adding colors, ICONS, tree views, more formatting options, and more. It can be installed on Archlinux, Fedora, macOS, FreeBSD, Windows, Android, Ubuntu, Debian and many other operating systems.

# # the curl - LO, DPKG -i lsd_0. 21.0 _amd64. DebCopy the code

Second, the broot

Broot [^3] is also a substitute for the LS command written in Rust. It's a new way to view and navigate a directory tree compared to LSD, and broot is the file manager on the terminal.

When it comes to terminal file managers, please refer to: 4 super easy terminal file managers, improve your use efficiency!

Characteristics of Broot:

  • Get an overview of a catalog, even a large catalog
  • Find a directory and CD
  • The structure of the file hierarchy is never lost when searching
  • Operate files, manage files, preview files
  • Apply standard or personal shortcuts to files
  • Replace the ls
  • Sort them to see how much space they take up
  • Checking Git Status

Use of broot:

With Broot, you can first list information about files in the current directory.

# br -sdph
Copy the code
  • -s: Displays the file size
  • -d: Displays the file time
  • -p: Displays file permissions
  • -h: Displays hidden files

According to the above results, the subdirectories of Broot are expanded in a tree structure by default. On this interface, you can search (enter the search term), copy (cp the copied file name ), delete rm, change the file name (mv the new file name ), and exit the q basic file.

Exa [^4] is an open source alternative to LS.

Third, zoxide

Zoxide [^5] is a more intelligent alternative to the CD command. It remembers the directory you use most often, so you can "jump" to that directory with just a few keystrokes.

Zoxide runs on Linux, macOS, Windows, BSD, Android and other operating systems, just like CD.

# zoxide /etc
Copy the code

If you frequently enter the /etc directory with Zoxide, you can write only part of the path and it will automatically find the match you use most often. Simply type the command: z e and it will automatically match e to /etc to enter the directory.

# z e
Copy the code

Four, FZF

FZF [^6] is a general purpose interactive command line fuzzy finder that can be used with any list, file, history command, process, host name, bookmark, Git commit, etc. It can be installed in Debian 9+, Ubuntu 19.10+, Fedora, Arch Linux, FreeBSD, OpenBSD, openSUSE, and many other Linux distributions.

# # the curl - LO, DPKG -i Fzf_0. 24.3 1 _amd64. DebCopy the code

FZF can be used in conjunction with find's alternative fd[^7] tool, which is not described in detail here.

If you use fuzzy search to find the file name containing debug, run the following command and enter debug.

# find . -type f | fzf
Copy the code

Fifth, ripgrep (rg)

Ripgrep (rg)[^8] is an alternative to the grep command. It is a line-oriented search tool that recursively searches for regular expression patterns in the current directory. It can be installed on Windows, Linux, and macOS.

The Ripgrep GitHub repository also compares The same file and a single large file using ripgrep, git grep, ugrep, The Silver Searcher, ACK, and GNU grep benchmarks. In terms of time, ripgrep search time is the fastest.

Among other things, ripgrep has default filtering, fewer errors, Unicode support, and highlighting with line numbers and search terms.

# apt install ripgrep
Copy the code

Ripgrep is similar to grep. For example, if I want to search all sh files containing the string yum, run the following command:

# rg yum *. Sh 9: CD /etc/ymp.repos. d/ 22:yum clean all 23:yum makecache 25:echoCopy the code

[^9] The ack and ag tools used in Linux are not included in this list.

Six, procs

Procs [^10] is an alternative to the ps command written in Rust. Procs supports color highlighting, multi-column keyword search, and other features to display process information. Procs can be installed on Linux, macOS, and Windows operating systems.

Procs installation:

Arch Linux

# sudo pacman -S procs
Copy the code


# sudo dnf install procs
Copy the code


# sudo rpm -i
Copy the code

You can run the following command using procs to display information about all processes.

# procs
Copy the code

Search with non-numeric/keyword, add any keyword as parameter option, USER will be automatically matched to COMMAND by default, add columns that match non-numeric keyword, nonnumeric_search can use option in configuration file.

By default, numeric values are considered a full match and non-numeric values are considered a partial match. Add columns that match numeric keywords. Numeric_search can use options in the configuration file.

If there are some keywords, you can use the command line option to specify the logical operation between the keywords.

  • --and: Displays processes that match all the keywords
  • --or: Displays the process that matches any keyword
  • --nand: The procedures are displayed unless they match all the keywords
  • --nor: Displays the process unless it matches any keyword

See more: 7 Tools to replace the top command! And 11 tools to replace the top command!

Seven, the diff - so - fancy

Diff-so-fancy [^11] is an alternative to Git Diff, a Command line tool based on a Node implementation that renders beautiful differences to your terminal, helping to improve code quality and help find defects faster.

Installation of diff-so-Fancy:

# npm install -g diff-so-fancy
Copy the code

3. The use of diff-so-fancy:

It can be called directly from the command line

# git diff --color | diff-so-fancy
Copy the code

Using diff-so-Fancy in the above way is simple, but prints out all the results without differentiation. We can paginate the results by setting pager to configure git to diff-so-fancy all the difference output:

# git config --global core.pager " diff-so-fancy | less --tabs=4 -RFX " 
# git config --global interactive.diffFilter " diff-so-fancy --patch "
Copy the code

Configure the diff-so-Fancy as Git's default diff tool, and each time Git diff is executed, its execution results are printed.

Eight, the delta

Delta [^12] is a syntactic highlighting pager for git, diff, and grep output that allows for numerous changes to the layout and style of the diff.

Characteristics of delta:

  • Use color themes to highlight language syntax
  • Syntax highlights grep output from rg, git grep, grep, etc
  • Side-by-side view with line breaks
  • Line numbers can be displayed
  • Support merge conflict display
  • Support for Git's --color-moved feature
  • The N and N key bindings move between files in large differences
  • Code can be copied directly from the difference

Delta installation:

Delta can be installed on Arch Linux, Fedora, FreeBSD, OpenSUSE, Debian/Ubuntu, Windows and other operating systems. For details, refer to the Installation section of delta[^13] user manual.

Nine, McFly

Mcfly[^14] is an alternative to CTRL + R and is used primarily to search for records of Shell operations.

McFly features:

  • The bindingctrl+rTo launch a full-screen reverse history search
  • Written based on Rust, fast and secure
  • Type in search%To match any number of characters
  • Maintain normal Shell history files so you can stop using McFly at any time
  • Support for clearing any history items from the McFly database and Shell history files

Ten, choose

Choose [^15] is a substitute for the cut[^16] command to display the specified part of the line and delete the specified field in the file. Cut is often used to display the contents of a file, similar to the type command.

Choose characteristics:

  • Concise fields, simple syntax, python-like list slicing
  • Negative indexes start at the end of the line
  • Optional start/end index
  • Zero index
  • Reverse range
  • For sufficiently long inputs, slightly faster thancut, far faster thanawk
  • Regular expression field delimiters using Rust's regular expression syntax

Examples of cut:

# cat 2022.txt | cut -d " " -f 1
# cut -d " " -f 1 2022.txt
Copy the code

Choose from

# cat 2022.txt | choose 1
# choose 1 -i 2022.txt
Copy the code

Eleven, httpie

Httpie [^17] is an alternative to curl, a command-line HTTP client. Httpie's goal is to make CLI interaction with Web services as human as possible for testing, debugging, and generally interacting with apis and HTTP servers, allowing HTTP and HTTPS commands to create and send arbitrary HTTP requests using simple syntax, And can provide formatting and color output.

Curl PUT

# curl -X PUT -d hello=world
Copy the code

Httpie PUT request example

# http PUT hello=world
Copy the code

Custom HTTP methods, HTTP headers, and JSON data:

# http PUT X-API-Token:123 name=John
Copy the code

Build and print requests without sending in offline mode:

# http --offline hello=offline
Copy the code

Twelve, curlie

Curlie [^18] is a similar project to Httpie. Curlie increases the ease of use of httpie without sacrificing its features and performance. All curl options are syntax and output format from Httpie. But not a fan of Curl's idiosyncrasies, Curlie was the perfect choice.

Difference between curlie and Httpie:

  • Curlie is like curl, but unlike Httpie, the file header is written to stderr instead of stdout.
  • Output is not buffered, all formatting is done dynamically, easy to debug stream data;
  • Use the curl option to print the curl command.

Curlie's grammar:

# curlie [CURL_OPTIONS...]  [METHOD] URL [ITEM [ITEM]]Copy the code


# curlie
Copy the code

Custom methods, headers, and JSON data:

# curlie -v PUT X-API-Token:123 name=John
Copy the code

13, xh

Xh [^19] is a friendly and fast tool for sending HTTP requests, mainly as a single statically linked binary file with improved performance compared to Httpie. Curl is easy to install, supports HTTP / 2, uses curl flag built-in curl command conversion, and short help messages can be printed in cheat sheet style.

Xh syntax:

Copy the code

Examples of XH:

# send a GET request xh # send a POST request with the body {"name": "ahmed", "age": 24} xh name=ahmed age:=24 # send a queryString id=5  sort=true GET xh GET id==5 Sort ==true # send a GET request with a header named x-api-key, with the value: 66666 xh get x-api-key:66666 And pipeline will results to less xh put id: = 49 age: 24 | = less # download and save to the test. The json xh - d - o test. # json Request and Custom user agent xh user-agent:foobarCopy the code

14, dog

Dog [^20] is a command line open source DNS client, an alternative to the DIG command, with colorful output, understands command-line argument syntax, supports network transport over UDP, TCP, DNS-over TLS, and DNS-over HTTPS protocols, and can issue DNS queries.

Dog runs on Windows, MacOS, and Linux operating systems and supports 16 record types, including: A, AAAA, CAA, CNAME, HINFO, LOC, MX, NAPTR, NS, OPT, PTR, SOA, SRV, SSHFP, TLSA and TXT.

Example of dog:

# query domain dog using default Settings # view MX records dog MX # use specific naming server dog [email protected] address X.X.X.X # use TCP instead of UDP Dog [email protected] address X.X.X. x-tCopy the code

Refer to the Dog documentation for more information on dog installation, query options, send options, protocol options, and output options.









[8] ripgrep (rg) :





[13] delta: dandavison. Making. IO/delta/insta...








Recent original

And that's all for today.

If you think this article is useful to you, please like it, leave a comment or forward it, so that more friends can see it, because this will be my strongest motivation to continue to output more high-quality articles!

About (Moment For Technology) is a global community with thousands techies from across the global hang out!Passionate technologists, be it gadget freaks, tech enthusiasts, coders, technopreneurs, or CIOs, you would find them all here.