paint-brush
How to Customize Your Shell for Efficiencyby@noaahhh
1,219 reads
1,219 reads

How to Customize Your Shell for Efficiency

by Nuh YurdusevenMarch 28th, 2023
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

This post has been written to create a beautiful and useful custom operating system shell setup for developers, data scientists, or everyone who wants to have an unusual Linux,\*nix, or macOS shell. This is a completely simple guide for the installation of the shell setup. To install the tools: install zsh and ohmyzsh.
featured image - How to Customize Your Shell for Efficiency
Nuh Yurduseven HackerNoon profile picture

Hi, this post has been written to create a beautiful and useful custom operating system shell setup for developers, data scientists, or everyone who wants to have an unusual Linux,*nix, or macOS shell. This is a completely simple guide for the installation of shell setup for the 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


The package manager installed the shell on the system.


To install ohmyzsh’s 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 -)"


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 


ZSH_THEME="fino-time"


You can find different themes on the pages.

Install Custom Plugins

zsh-autosuggestion

git clone https://github.com/zsh-users/zsh-autosuggestions.git $ZSH_CUSTOM/plugins/zsh-autosuggestions


zsh-syntax-highlighting

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


zsh-autocomplete

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


And add these to the plugins tuple in .zshrc


plugins = ( git
            sudo
            zsh-autosuggestions 
            zsh-syntax-highlighting 
            zsh-autocomplete
            )


Install pyenv for Python Version Control

Pyenv is a tool that can manage python environments and versions. It's a very useful tool for all types of developers. To install the tools:


git clone https://github.com/pyenv/pyenv.git ~/.pyenv


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


after that:


exec "$SHELL"


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


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

Usage

You can install many of the python, conda versions with these 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


After creating a virtual environment, it's usable with this command:


pyenv activate myenv
(myenv)$  

Also published here