Modern Alternatives to Classic Linux Tools

Modern Alternatives to Classic Linux Tools

  • bat is nicer cat with syntax highlighting

  • fd is a replacement for the old find and that’s not amazing

  • gping is ping with a graph, in Rust

  • delta is like diff tool but even more like a syntax-highlighting pager for git, diff, and grep output. Try delta -s one.txt two.txt.

  • dust better du command which is used to show sizes of subfolders and such. Not impressed by results.

  • broot is alternative to tree but with much more

  • exa is a modern ls, but still not on Windows, site here but much better is lsd-rs/lsd: The next gen ls command jer ima čak i Windows instalaciju preko scoop a ubuntu preko https://apt.cli.rs/.

  • procs modern replacement for ps written in Rust. Interesting procs --watch

  • lazygit is simple terminal UI for git commands

  • dive is amazing CLI tool for exploring each layer in a docker image

  • sharkdp/hyperfine is CLI benchmarking tool

Core Utils

uutils/coreutils is cross-platform Rust rewrite of the GNU coreutils

Improve cd command

These tools are alternatives to the cd command, designed to save you time by reducing the amount of typing you need to do.

The original tool, Autojump used j command, was written in Python, but has likely been unmaintained. Its impact was such, however, that it paved the way for the creation of others, like rupa/z and rupa/v, which are written in bash script. These tools have been so successful that they have been ported to other systems in various forms (fasd, z.lua, zsh-z, ZLocation).

  • ZLocation is native PowerShell module, successor of “Jump-Location”
  • z is also PowerShell, and not sure why I decided on to go with ZLocation
  • z.lua also works the same in Lua
  • zoxide is the most modern one, in Rust, and as such should be faster than others. Install on Windows as it needs more config to me invoked with simple z. So I’m not using it right now, but using ZLocation
  • fasd is archived now
  • Jump-Location is a Powershell implementation of autojump’s j command, but has a successor now

If you encounter an error while removing ZLocation, such as ERROR Couldn't remove ... it may be in use., first uninstall it once, and when it fails, close the entire Terminal, then open a new Powershell and try again with the purge option. That would do it.

Trying zoxide, but must add govno: Invoke-Expression (zoxide init --hook prompt powershell | Out-String) zi is Z interactive

On Linux, as I’m running good-old bash, it is as simple as running:

apt install zoxide fzf
echo 'eval "$(zoxide init bash)"' >> ~/.bashrc

And on macOS zsh is default shell:

brew install zoxide
echo 'eval "$(zoxide init zsh)"' >> ~/.zshrc

For fzf, key bindings (Ctrl+T / Ctrl+R / Alt+C) and fuzzy auto-completion on Ubuntu are not enabled by default so you have to add in your ~/.bashrc:

echo '[ -f /usr/share/doc/fzf/examples/key-bindings.bash ] && source /usr/share/doc/fzf/examples/key-bindings.bash' >> ~/.bashrc
or
echo '[ -f /usr/share/bash-completion/completions/fzf ] && source /usr/share/bash-completion/completions/fzf' >> ~/.bashrc

ali čak ni to nije dovoljno jer ga možda nema: README.Debian says to source /usr/share/doc/fzf/examples/completion.bash, but file no longer exists · Issue #2790 · junegunn/fzf pa moram da ga download u svakom slučaju

if [[ ! -f /usr/share/doc/fzf/examples/completion.zsh ]]; then sudo curl https://raw.githubusercontent.com/junegunn/fzf/master/shell/completion.zsh -o /usr/share/doc/fzf/examples/completion.zsh sudo curl https://raw.githubusercontent.com/junegunn/fzf/master/shell/key-bindings.zsh -o /usr/share/doc/fzf/examples/key-bindings.zsh fi

if [[ ! -f /usr/share/doc/fzf/examples/completion.bash ]]; then sudo curl https://raw.githubusercontent.com/junegunn/fzf/master/shell/completion.bash -o /usr/share/doc/fzf/examples/completion.bash sudo curl https://raw.githubusercontent.com/junegunn/fzf/master/shell/key-bindings.bash -o /usr/share/doc/fzf/examples/key-bindings.bash fi

ali pošto prijavljuje grešku unknown option: --scheme=history, mora starija verzija (commit: 6dcf5c3):

curl https://raw.githubusercontent.com/junegunn/fzf/6dcf5c3d7d6c321b17e6a5673f1533d6e8350462/shell/key-bindings.bash -o /usr/share/doc/fzf/examples/key-bindings.bash

Napisao sam upustvo: Configuring Key Bindings and Fuzzy Auto-Completion in Ubuntu 22.04 · Issue #3395 · junegunn/fzf

The fzf and ubuntu docs don’t mention you have to.

Improve ls Command

Dok se exa ne pojavi na Windows, ovo mi je jedino rešenje:

Making functions permanent in Powershell

function ll { Get-ChildItem -Force @args }

Add to $profile.AllUsersAllHosts


CLI File Manager

  • mc aka Midnight Commander is the most famous one
  • lf is improved ranger, but multi-platform

The following ones are not available on Windows:

TUI libraries

TUI stands for “Text-based User Interface” or “Terminal User Interface”.

Notes on Some Specific Tools

none


For everyone interested there is a lot of modern command line tools I nowadays prefer over the old stuff:

bat: cat with highlight difftastic: better diff gdu: ncdu for ssds (disk space analyser) du-dust: like ncdu zoxide: modern cd fd: find alternative rg: ripgrep (grep) fzf: fuzzy finder jless: json viewer with mouse folding dra: download and install release assets lazygit: git TUI lazydocker: docker TUI yazi: file manager with image preview zellij: better tmux / screen starship: cross shell prompt config viddy: a replacement for watch that includes history

task: a Makefile alternative hyperfine: a benchmark tool vegeta: a load testing tool sd: a better: more intuitive sed jq: the well know JSON processor jc: convert the output of many CLI tools to JSON gron: make JSON greppable

ibraheemdev/modern-unix: A collection of modern/faster/saner alternatives to common unix commands. johnalanwoods/maintained-modern-unix: A collection of modern/faster/saner alternatives to common unix commands, which is maintained.


Linux CLI alternatives to ’tail -f'

If you are looking for a Linux CLI alternative to tail -f because you don’t have a way to clear the screen with a shortcut, there are several tools that you can try.

lnav aka The Logfile Navigator is an advanced and mature log file viewer with the repository at tstack/lnav. Can be launched without any parameters on file and the shortcuts are available by pressing “?” key. To clear the screen, you can use the “G” shortcut. While it provides many options, this one option should be sufficient for your current need.

rcoh/angle-grinder is a Rust tool for slicing and dicing logs on the command line. It can be installed using the command cargo install ag. However, the installation may take a while since it compiles the file.

MultiTail is similar to the original ’tail’, but it lets you view multiple files on the same screen.

colortail is essentially the same as tail, but with colorization added. It is an official tool, but it does not offer keyboard shortcuts, so it may not provide significant additional benefits. Additionally, its colorization may not be optimized for WordPress logs.

You can use commands like tailf (deprecated) or even less to monitor log files in real-time. There are also tools like generic colorizer garabik/grc, but that serves completely different purposes.

For the equivalent of tail -f, you could use less +F logfile, or even better, less +FG logfile to jump straight to the end of the file.

top alternatives

date 13. Feb 2023 | modified 05. Oct 2024
filename: Windows » CLI » Modern Linux Tools Alternatives