exa is a modern replacement for ls: brew install exa (macOS), sudo pacman -Sy –noconfirmm exa (Arch), apt install exa (Ubuntu).
Bat is a cat clone with wings, it supports syntax highlighting and Git integration.
ripgrep is a line-oriented search tool that recursively searches the current directory for a regex pattern.
Installation: brew install ripgrep (macOS), choco install ripgrep (Windows), pacman -S ripgrep (Arch), sudo apt-get install ripgrep (Debian, Ubuntu).
How do I find all files containing a specific text? Using grep: grep -rnw “/path/to/somewhere” -e “specificText” (-r: recursive; -n: line number; w: match the whole world). Using ripgrep: ripgrep “specificText/pattern” /path/
youtube-dl download videos from YouTube.com or other video platforms.
# Recursively delete files with a particular extension using the find command
find . -type f -name "*.ext" -exec rm -v {} \;
There are two parts:
find . -type f -name “.ext” . Search for regular files (-type -f, i.e., it excludes directories, symbolic links, etc.) with the .ext extension (-name “.ext”, e.g., txt, jpg, md, etc.) in the current directory (.)
-exec rm -v {} ; . This is the second part, it executes rm, i.e., remove each file found by the previous order (find). The {} is a placeholder for the found filenames. The ; indicates the end of the -exec command.
fzf is a general-purpose command-line fuzzy finder.
Installation: Windows (choco install fzf)
brew install fzf # macOS
$(brew --prefix)/opt/fzf/install # To install useful key bindings and fuzzy completion
git clone ‐‐depth 1 https://github.com/junegunn/fzf.git ~/.fzf # GNU/Linux
~/.fzf/install
Do you want to enable fuzzy auto-completion? ([y]/n) y
Do you want to enable key bindings? ([y]/n) y
Do you want to update your shell configuration files? ([y]/n) y
It will add this line (vim .bashrc): [ -f ~/.fzf.bash ] && source ~/.fzf.bash
Let’s find files ending with .md: fzf ‐‐query=.md$
Fuzzy search can be triggered with **: cd **<TAB>, cd ~/.config/cal**<TAB> (it searches for files and directories under ~/.config that match `cal`: /home/myUser/.config/calcurse), vim .config/default.yml**
You could use bat for this purpose. Use: fzf ‐‐preview ‘bat ‐‐color=always ‐‐style=numbers ‐‐line-range=:500 {}’
nvim .bash_aliases/.zsh_aliases: #Credits: Luke Smith.
alias prev="fzf ‐‐preview 'bat ‐‐style=numbers ‐‐color=always {}'"
searchEdit() { du -a ~/Dropbox/ ~/.config/ | awk '{print $2}' | fzf | xargs -r $EDITOR ; }
Copy and paste at the command line with xclip (GNU/Linux) or pbcopy (macOS):
It is a command-line clipboard manager. It enables you to copy the standard input from your terminal to your clipboard, so you can paste it to a GUI application (gedit, atom, brave, etc.)
Use. Copy a file into the clipboard: cat file | xclip -sel clip. Let’s copy a password to the clipboard: pass Root/Ocio/amazon.es | xclip -sel clip. To paste the text you just copied, you should use: xclip -selection clipboard -o