CLI Tools

Colorls

The ls command is one of the best way to view files, even beats Window’s dir . If you’re someone who wants to see more information quickly on your file directory and love color and emoji, this add-on to the CLI suits you. (If you prefer minimal, color-coded and speed, Exa could be an altenative to try out)

An example of colorls aliased to ls

Colorls installation is slightly complicated, so i’m going to break down the steps:

Install Ruby



# Or simply

$ sudo apt-get install ruby-full # If you're a Ruby dev, I recommend this: https://gist.github.com/jonyeezs/0cd34840004ca2052ff74378e15b39c0 # Or simply$ sudo apt-get install ruby-full

2. Install the fonts

The instructions given is base on the font i use: Ubuntu mono regular (which is the default). To find out your font go to Tweaks tool >Fonts > Monospace.

Now go to Nerd-Fonts and download the icons. Below are the commands to do that for Ubuntu mono regular.



cd ~/.local/share/fonts && curl -fLo "Ubuntu Mono Nerd Font Complete Mono.ttf" mkdir -p ~/.local/share/fontscd ~/.local/share/fonts && curl -fLo "Ubuntu Mono Nerd Font Complete Mono.ttf" https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/UbuntuMono/Regular/complete/Ubuntu%20Mono%20Nerd%20Font%20Complete%20Mono.ttf?raw=true

Now go back to Tweak > fonts. Re-select the monospace font to Ubuntu Mono Nerd Font Complete Mono.

3. Install colorls

gem install colorls

4. Include following code into ~/.zshrc

source $(dirname $(gem which colorls))/tab_complete.sh

alias ls='colorls --sd'

5. Profit by restarting your zsh: . ~/.zshrc

# Display as single line files

$ ls -1 # With hidden files

$ ls -a # With all information

$ ls -al # Display as tree structure whilst hiding files that maybe unnecessary to show

$ ls -tA

To update gem update colorls .

Enhancd

Enhances the humble cd command. It remembers your previous navigated directories and no more ../../../../ back pedal. An easy way to have a cd history.



$ sudo dpkg -i fzy_0.9-1_amd64.deb $ wget https://github.com/jhawthorn/fzy/releases/download/0.9/fzy_0.9-1_amd64.deb $ sudo dpkg -i fzy_0.9-1_amd64.deb $ git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf

# The following command will have prompts. Do as you will

$ ~/.fzf/install

$ echo 'source ~/.enhancd/init.sh' >> ~/.zshrc

$ echo 'ENHANCD_FILTER=fzy:fzf; export ENHANCD_FILTER' >> ~/.zshrc

$ echo "ENHANCD_HOOK_AFTER_CD='ls -A';export ENHANCD_HOOK_AFTER_CD" >> ~/.zshrc $ git clone https://github.com/b4b4r07/enhancd ~/.enhancd$ echo 'source ~/.enhancd/init.sh' >> ~/.zshrc$ echo 'ENHANCD_FILTER=fzy:fzf; export ENHANCD_FILTER' >> ~/.zshrc$ echo "ENHANCD_HOOK_AFTER_CD='ls -A';export ENHANCD_HOOK_AFTER_CD" >> ~/.zshrc

$ . ~/.zshrc # Most use scenarios # 1. View options in a search finder

$ cd # 2. List the last 10 navigated directories

$ cd - # 3. Navigate to parent directories

$ cd ..

TLDR

manual for curl with examples

Sometimes you want to see what a command does. Manuals can be long and hard to navigate. This basically makes it tldr. There’s an alternate that gives colors but its not often this gets used.

Here’s how to install:



$ sudo chmod +x /usr/local/bin/tldr $ sudo curl -o /usr/local/bin/tldr https://raw.githubusercontent.com/raylee/tldr/master/tldr $ sudo chmod +x /usr/local/bin/tldr

Yank

This allows you to copy parts of an output from a terminal. Had huge tables but just wanted to copy that one cell? Mouse drags can be a real drag! Install this

$ sudo apt-get install yank # To yank straight to clipboard add this alias to ~/.zshrc

alias yank='yank-cli -- xsel -b' # all other opts availabe through yank-cli

# Try these commands $ ls -lh | yank

$ ps ux | yank-cli | xargs kill

gkill

I do this alot in windows, kill processes. When things go sour and I want to end my relationship with a process that just won’t leave me, kill it. Gkill offers that in a nice interactive shell way. You’ll need to install go-lang first