Etiqueta: cli

ZSH configuration tricks

Zsh is a terminal for UNIX systems that can be tuned to help you do more work with less effort. In this article I will show you some things that are useful to me.

Usually all the Linux distributions used bash as a default terminal, but there are a lot of other terminals like zsh, csh,tcsh. Most of the time I used Linux I used the default terminal but I tried other terminals and discovered that I like zsh more than bash. You can try another terminal without configuring it as your default terminal, just install the zsh package and execute the zsh command.

Oh my zsh

On this article I used a framework for zsh called oh my zsh that extends the default zsh adding plugins and themes. You can easily install with one command:

sh -c "$(curl -fsSL"



When the zsh starts the terminal, reads the .zshrc file located on the root of your home directory.

The first parameter of configuration that I use is the oh my zsh plugins:


This enables the following plugins:

  • git: This is my favorite one,it adds a lot of alias to manage the git, you can check them here. Also , if you are on a git directory indicates if there are unstashed files.
  • python: Like git it adds some useful alias
  • pip: Adds cache on the available pip packages
  • virtualenvwrapper: Auto activates the virtualenv when you cd in a directory that have the same name as an existing virtualenv


On oh my zsh you can select the theme of your terminal. In my case my favorite is agnoster. You can set it like this:


If you wan to explore the available themes you can find the list here


On zsh, like in other terminals you can set an alias to shortcut a command. Mine are these:

alias p="ipython3"
alias s="ssh"

These are two applications that I use very often so in this way I can do “s” and enter to another machine.

In the case of python,it is because I use the ipython to do quick calculations or test code


When using WSL navigating to different folders can be tedious and repetitive because you are always typing /mnt/c… . To avoid repeating this you can configure the CDPATH variable

CDPATH is a variable that you can use to indicate to the shell where to check when you change of directory. I started using a hash, that is like an alias of a folder, but after I discovered CDPATH that is far better. I have it configured like this:

typeset -path cdpath
setopt auto_cd

On a Linux machine I use the CDPATH with the source directory to move quickly to my source code. You can add multiple directories separated by spaces


Tmux is a terminal multiplexer. This is the kind of tools where you don’t know that you need. This tool is useful when you may work with remote servers via terminal.

This allows you to:

  • Have multiple terminals on the same connection
  • Be able to disconnect from the terminal without terminating the running
  • Share terminal with other users

How to install

To install tmux you can run this command:

apt-get install tmux

How to use:

You can create a new tmux session this command:


You can attach to an existing running session :

tmux attach 

or a shorter version:

tmux a

Once you are on a tmux session you have the following shortcuts:

  • Control+b+c: Open a new window.
  • Control+b+d: Detach of a tmux session.
  • Control+n: Move to the next window.
  • Control+p: Move to the previous window.
  • Control+b+number: Move to the number window.
  • Control+b+”: Slit the window horizontally.
  • Control+b+%: Split the window vertically.
  • Control+b+$: Rename session
  • Control+b+s: Change the session

Share a tmux session

You can share a tmux session with another ssh session with the same user via ssh.

Also if you can’t share the ssh connection you can use tmate.

You can install tmate with this command:

apt-get install tmate

Once tmate is installed you can run the command:


This will give you a list of ways to share the tmux session

© 2022 Another dev

Tema de Anders NorenAmunt ↑