DEV Community

Cover image for How to personalize the shell for developers - my custom setup
nuh yurduseven
nuh yurduseven

Posted on

How to personalize the shell for developers - my custom setup

Hi, This post has been written to create a beautiful and useful custom operating system shell setup for developers, data scientists or everyone who want to have unusual linux,*nix or macos shell. This is completely simple guide for installation of shell setup for best efficiency.

install zsh and ohmyzsh

 ## for Debian/Ubuntu
sudo apt-get install zsh

## for RHEL/Centos/Fedora
sudo yum install zsh
## for only Fedora 
sudo dnf install zsh


## for arch
sudo pacman install zsh
## for mac
brew install zsh
Enter fullscreen mode Exit fullscreen mode

The package manager installed the shell on the system.

to install ohmyzsh latest version:

#using curl
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
#or using wget
sh -c "$(wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"

Enter fullscreen mode Exit fullscreen mode

ohmyzsh installed under the /home/user directory as hidden. You can see the folder .oh-my-zsh and .zshrc config files. ohmyzsh will change zsh config file contents.

change the theme

Open .zshrc* config file with nano or vim and change themes:

nano ~/.zshrc
#or
vim ~./zshrc 
Enter fullscreen mode Exit fullscreen mode
ZSH_THEME="fino-time"
Enter fullscreen mode Exit fullscreen mode

You can find different themes from the pages

install custom plugins

zsh-autosuggestion

git clone https://github.com/zsh-users/zsh-autosuggestions.git $ZSH_CUSTOM/plugins/zsh-autosuggestions
Enter fullscreen mode Exit fullscreen mode

zsh-syntax-highlighting

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH_CUSTOM/plugins/zsh-syntax-highlighting
Enter fullscreen mode Exit fullscreen mode

zsh-autocomplete

git clone --depth 1 -- https://github.com/marlonrichert/zsh-autocomplete.git $ZSH_CUSTOM/plugins/zsh-autocomplete
Enter fullscreen mode Exit fullscreen mode

And add these to plugins tuple in .zshrc

plugins = ( git
            sudo
            zsh-autosuggestions 
            zsh-syntax-highlighting 
            zsh-autocomplete
            )
Enter fullscreen mode Exit fullscreen mode

install pyenv for python version control

Pyenv is a tool which can manage python environment and versions. It's very useful tool for all types developers.
To installation the tools:

git clone https://github.com/pyenv/pyenv.git ~/.pyenv
Enter fullscreen mode Exit fullscreen mode

and to define environment variables:

(for zsh)

echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc
echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zshrc
echo 'eval "$(pyenv init -)"' >> ~/.zshrc
Enter fullscreen mode Exit fullscreen mode

after that:

exec "$SHELL"
Enter fullscreen mode Exit fullscreen mode

To create python virtual-environments, virtualenv plugin installation is required.

git clone https://github.com/pyenv/pyenv-virtualenv.git $(pyenv root)/plugins/pyenv-virtualenv
Enter fullscreen mode Exit fullscreen mode

Usage

You can install many of python, conda versions with this tools easily. You can check github repositories for more information.

## install a python environment
pyenv install 3.8.5 
## create a virtual environment
pyenv virtualenv 3.8.5 myenv
Enter fullscreen mode Exit fullscreen mode

after create a virtual-environment, it's usable with this command.

pyenv activate myenv
(myenv)$  
Enter fullscreen mode Exit fullscreen mode

Top comments (0)