Zsh

Zsh is a powerful shell that operates as both an interactive shell and as a scripting language interpreter. While being compatible with Bash (not by default, only if issuing emulate sh), it offers advantages such as improved tab completion and globbing.

The Zsh FAQ offers more reasons to use Zsh.

Configure Zsh

Although Zsh is usable out of the box, it is almost certainly not set up the way most users would like to use it, but due to the sheer amount of customization available in Zsh, configuring Zsh can be a daunting and time-consuming experience.

Simple .zshrc

Included below is a sample configuration file, it provides a decent set of default options as well as giving examples of many ways that Zsh can be customized. In order to use this configuration save it as a file named .zshrc.

 Tip: Apply the changes without needing to logout and then back in by running source ~/.zshrc.

Here is a Condres .zshrc:

source /usr/share/zsh/site-contrib/powerline.zsh
zstyle ':completion:*' menu select 

Add new line:

source /usr/share/zsh/site-contrib/powerline.zsh
zstyle ':completion:*' menu select
# shell opts
setopt autocd
setopt completealiases
setopt histignorealldups
setopt histfindnodups
# alias
alias l='ls'
alias la='ls -A'
alias ll='ls -lA'
alias ls='ls --color=auto'
alias pac='sudo pacman --color auto'
##############################################################################
# History Configuration
##############################################################################
HISTSIZE=5000 #How many lines of history to keep in memory
HISTFILE=~/.zsh_history #Where to save history to disk
SAVEHIST=5000 #Number of history entries to save to disk
#HISTDUP=erase #Erase duplicates in the history file
setopt appendhistory #Append history to the history file (no overwriting)
setopt sharehistory #Share history across terminals
setopt incappendhistory #Immediately append to the history file, not just when a term is killed

Configuring .zsh_history

create file to /home/user/ and save file name to .zsh_history

Configuring .zsh_history root

Copy files .zshrc and .zsh_history in the root of the roor user.

cd /home/user
sudo cp -rv .zshrc .zsh_hystory /root 

Close the terminal and you can now have the history of the commands you had previously sent

Calogero Scarnà
Calogero Scarnà
Articoli: 299

Newsletter

Inserisci il tuo nome e il tuo indirizzo email qui sotto e iscriviti alla nostra newsletter