Autoria de Alberto Federman Neto, albfneto
Atualizado em: 7 de Julho de 2018.
1 . INTRODUÇÃO:
Todos conhecem o Shell Bash (padrão na maioria dos GNU/Linux) e Emuladores de Terminal, como o Konsole (do KDE), o Gnome-Terminal (do GNOME), o TWM e o xterm (do X-Window) etc…
Mas existem várias Shell e vários tipos de Terminal e se pode trocá-los, para variar.
2 . VÁRIOS TERMINAIS:
Existem vários Emuladores de Terminal diferentes:
Cansou de Konsole e GNOME-Terminal? Existem Outros Terminais, Escolha o Seu.
20 Useful Terminal Emulators for Linux.
Top 7 Open Source Terminal Emulators.
Top 6 Best Linux Terminal Emulators.
Alguns desses Emuladores de Terminal são suspensos, como o Yakuake, o Guake:
Terminal Guake com Comandos Personalizados.
e o Tilda:
Tilda, Console Semelhante aos Jogos em Primeira Pessoa.
Terminais Estilo Guake, Para Linux.
3. VÁRIAS SHELL:
Também existem várias Shells, além do conhecido Bash: sh, csh, tsh etc… etc…
Evolution of The Unix. Linux Shells.
Inclusive, os Shell são muito personalizáveis, bem modificáveis.
4. OBJETIVO DO ARTIGO:
Algumas pessoas sabem, gosto de testar pacotes e de variar, usar vários ambientes gráficos.
Também gosto de variar o Terminal. Uso Terminator, Yakuake, Guake, Tilda, Konsole, Gnome-Terminal, Mate-Terminal, Terminal do XFCE, LXTerminal, Mrxvt, Aterm, Eterm e às vezes, até Xterm simples.
Também gosto de variar o Shell. Uso três Shells: Bash, Zsh e Fish.
O presente Artigo é uma atualização, complemento de experimentos que fiz, variando a Shell e o Terminal:
5. VOCÊ TAMBÉM PODE FAZER!
Para você mudar seu Terminal ou a Shell, é simples! Instale os pacotes dos Terminais que quiser e instale os pacotes das Shell que quiser.
Para variar de Terminal, abra o seu “Terminal” padrão (da distro) e digite o comando, nome do terminal que quer usar. Exemplo, “mrxvt” , “terminator” etc…
Para variar a Shell, parecido: Abra um “Terminal” qualquer (pode ser o novo, que acabou de instalar) e digite. como comando, o nome do novo Shell: csh, zsh, fish etc…
PRONTO!
Não precisa remover os pacotes dos Terminais e da Shell Bash, originais. Eles podem coexistir pacificamente, e você pode usar um dia um(a), outro dia outro(a).
Aliás, nem é aconselhável remover o Bash e o Terminal Originais. Em muitas Distros, Terminais e Shell são dependências essenciais, e sua remoção, pode deixar o sistema inutilizado.
Não é o objetivo desta Dica, detalhar como se instala e configura os novos Terminais que instalou, ou configurar, personalizar e usar as novas Shell.
Mesmo porque fiz extensos e detalhados Artigos de como se faz para variar o Terminal e para configurar as Shell que uso: Bash, Zsh e Fish. Consulte:
Zsh (Z Shell), uma Alternativa ao Bash.
Consulte Também estes Artigos, de outros Autores:
Terminal Powerline e Configurar Bash, Fish e Zsh.
Fish Shell no Slackware (Serve Para outras Distros, com Modificações).
6. SCREENSHOTS:
Agora algumas telas…
Na Figura 1, o Terminal é o Terminator, o configurador dele, e o Shell é o meu mais recente Bash modificado, através da edição clássica do arquivo ~/.bashrc (Tal como submetí recentemente ao VOL, Viva o Linux quando sair, ATUALIZAREI AQUI):
Nesta outra imagem, o Terminal é o Mrxvt, aberto com o Shell Zsh:
O Zsh foi configurado através do uso do pacote Oh-My-Zsh com o Tema chamado “Dallas”
Partes da configuração contém sincronização de tempo (usando NTP e serviço NTPD). Meu Arquivo /etc/ntp.conf é este.
Detalhes: Sincronizando o Linux com a Hora Legal Brasileira, Usando NTP.br.
Servidor NTP. Configuração e Ajuste de Data e Hora.
Para sincronizar tempo, especialistas recomendam que se use o programa ntpd, e não o antigo ntpdate, menos preciso e obsoleto.
Essa parte, NTP, da configuração do Zsh foi copiada-colada do meu Arquivo do Bash (Veja Item 7)
Para instalar e configurar o Zsh, veja no meu Artigo.
Na terceira imagem, em cima, é um terminal suspenso Tilda, com o meu Shell Bash personalizado e, em baixo, é um terminal Eterm (que tem papeis de parede aleatórios, sempre um diferente) no qual se acabou de ativar o Shell Fish
Você pode ver, na janela em baixo, as linhas acima são o meu Bash e as linhas embaixo, meu Fish.
Para configurar o Shell Fish, consulte este Artigo.
7. PRÉ-CONFIGURADOS E EXEMPLOS:
Para preguiçosos de plantão, que não querem, eles próprios, configurar tudo…. Podem usar como exemplos, os meus arquivos de configuração de Shell, já prontos.
Para o BASH, gravar em ~/.bashrc :
# /etc/skel/.bashrc # # This file is sourced by all *interactive* bash shells on startup, # including some apparently interactive shells such as scp and rcp # that can't tolerate any output. So make sure this doesn't display # anything or bad things will happen ! # Teste de Bash, em Sabayon, deixar: # Test for an interactive shell. There is no need to set anything # past this point for scp and rcp, and it's important to refrain from # outputting anything in those cases. if [[ $- != *i* ]] ; then # Shell is non-interactive. Be done now! return fi # Put your fun stuff here. # Arquivo de Configuração para Bash. # # Grave em /home/usuario/.bashrc # # Atualização e modificação destes: # # http://www.vivaolinux.com.br/etc/bashrc-2 e # http://www.vivaolinux.com.br/etc/bashrc-6 # # Por Albfneto <albfneto@fcfrp.usp.br>, VOL, 2017. Versão 16. # # O Original foi baseado numa modificação do Arquivo Default do Sabayon Linux 13 e no Arquivo publicado # por Giga Tesla Boy: # http://www.vivaolinux.com.br/etc/bashrc-1 #Também inclue partes de Bashs modificados para Arch Linux: # https://wiki.archlinux.org/index.php/Color_Bash_Prompt#.2Fetc.2FDIR_COLORS # E destas configurações: # http://www.linuxandlife.com/2011/12/how-to-customize-command-prompt.html # # Cores diferentes para diretórios, arquivos etc...: Aparência modificada. # Boas Vindas. echo ' _ ' echo ' *v* *** BEM VINDO AO '`hostname`' ***' echo ' /(_)\ ' echo ' ^ ^ ' `date` echo ' ' #Sistema echo ' ' echo ' *** Sistema: '`uname -a`' ***' echo ' ' echo ' *** Usuario: '`who -m`' ***' echo ' _ ' # Checa a Hora do Brasil, lista servidores NTP e ajusta Teclado: echo ' _ ' echo ' *** Hora do Brasil e Servidores: ***' echo ' _ ' ntpq -p echo ' _ ' setxkbmap -model abnt2 -layout br -variant abnt2 echo ' _ ' echo '*** PRONTO, OK, EIS SEU TERMINAL, DIGITE SEU COMANDO: ***' date # Caso não queira Itens repetidos no bash_history # edite este .bashrc e adicione a linha: export HISTCONTROL=ignoreboth # Tem muitos comandos uteis e quer um historico maior das coisas?, Aumente aqui export HISTSIZE=1000 # Côres Gerais: export LS_OPTIONS='--color=auto' eval `dircolors` alias ls='ls $LS_OPTIONS' alias ll='ls $LS_OPTIONS -l' alias l='ls $LS_OPTIONS -lA' #desativa sincronização vertical: export vblank_mode=0 # Côres Básicas do Prompt Inicial Simples, se quiser usar, descomente # PS1="\[\e[0;39m\]\u\[\e[m\] \[\e[1;34m\]\w\[\e[m\] \[\e[0;94m\]\$ \[\e[m\]\[\e[0;32m\]" # Outros Prompts modificados descomente para usar: # tambem tem este: # PS1="\[\e[36;1m\]\u@\[\e[32;1m\]\H> \[\e[0m\]" # E Este, que eu usava antes # PS1="\[\e[1;36m\]\u@ [\e[1;32m\]\H \[\e[1;34m\]--->>>[\[\e[1;33m\]\d \[\e[1;35m\]\t \[\e[1;37m\] ] \n\[\e[1;35m\] [\[\e[1;34m\] O DIRETORIO E= \[\e[1;32m\]\w \ [\[\e[1;35m\]------->" # Estes, por Carla Schroder: # https://www.linux.com/learn/how-make-fancy-and-useful-bash-prompt-linux # PS1='\[\e[1;36m\]\d \[\e[1;32m\]\t \[\e[1;33m\]\u@\[\e[1;35m\]\h:\w\$\[\e[0;31m\] ' # PS1='\[\e[1;36m\]\d \[\e[1;32m\]\t \[\e[1;33m\]\u@\[\e[1;35m\]\h:\w\$\[\e[0;31m\] ' # Modificado de Joshua Price. # https://www.maketecheasier.com/8-useful-and-interesting-bash-prompts/ PS1="\n\[\033[34m\] DATA, HORA, UTC E ANO: $(/bin/date)\n\[\033[32m\] ESTOU NO DIRETORIO: \w\n\[\033[1;31m\]\u@\h: \[\033[1;35m\]\$(/usr/bin/tty | /bin/sed -e 's:/dev/::'): \[\033[1;36m\]\$(/bin/ls -1 | /usr/bin/wc -l | /bin/sed 's: ::g') Arquivos, Tamanho Total: \[\033[1;33m\]\$(/bin/ls -lah | /bin/grep -m 1 total | /bin/sed 's/total //')b\[\033[0m\] $ \[\033[1m\]"
Para o ZSH, gravar em ~/.zshrc :
# Path to your oh-my-zsh configuration. ZSH=$HOME/.oh-my-zsh # Set name of the theme to load. # Look in ~/.oh-my-zsh/themes/ # Optionally, if you set this to "random", it'll load a random theme each # time that oh-my-zsh is loaded. ZSH_THEME="dallas" # Example aliases # alias zshconfig="mate ~/.zshrc" # alias ohmyzsh="mate ~/.oh-my-zsh" # Set to this to use case-sensitive completion # CASE_SENSITIVE="true" # Comment this out to disable bi-weekly auto-update checks # DISABLE_AUTO_UPDATE="true" # Uncomment to change how often before auto-updates occur? (in days) # export UPDATE_ZSH_DAYS=13 # Uncomment following line if you want to disable colors in ls # DISABLE_LS_COLORS="true" # Uncomment following line if you want to disable autosetting terminal title. # DISABLE_AUTO_TITLE="true" # Uncomment following line if you want to disable command autocorrection # DISABLE_CORRECTION="true" # Uncomment following line if you want red dots to be displayed while waiting for completion # COMPLETION_WAITING_DOTS="true" # Uncomment following line if you want to disable marking untracked files under # VCS as dirty. This makes repository status check for large repositories much, # much faster. # DISABLE_UNTRACKED_FILES_DIRTY="true" # Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*) # Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ # Example format: plugins=(rails git textmate ruby lighthouse) plugins=(git) source $ZSH/oh-my-zsh.sh # Customize to your needs... # export PATH=$PATH:/usr/local/bin:/usr/bin:/bin:/opt/bin:/usr/x86_64-pc-linux-gnu/gcc-bin/4.7.3:/opt/sublime-text2:/opt/nvidia-cg-toolkit/bin:/usr/games/bin:/opt/cuda/bin:/opt/cuda/libnvvp # Adaptado a partir de meu Bash: #Welcome msg echo ' _ ' echo ' *v* *** BEM VINDO AO '`hostname`' ***' echo ' /(_)\ ' echo ' ^ ^ ' `date` echo ' ' #Sistema echo ' ' echo ' *** Sistema: '`uname -a`' ***' echo ' ' echo ' *** Usuario: '`who -m`' ***' echo ' _ ' # Checa a Hora do Brasil, lista servidores NTP e ajusta Teclado: echo ' _ ' echo ' *** Hora do Brasil e Servidores: ***' echo ' _ ' ntpq -p echo ' _ ' setxkbmap -model abnt2 -layout br -variant abnt2 echo ' _ ' echo '*** PRONTO, OK, EIS SEU TERMINAL, DIGITE SEU COMANDO: ***' date # Teste de Shell, default no Sabayon: # Test for an interactive shell. There is no need to set anything # past this point for scp and rcp, and it's important to refrain from # outputting anything in those cases. if [[ $- != *i* ]] ; then # Shell is non-interactive. Be done now! return fi
Agora, em 2018, mas uma modificação de ZSH.
No caso deste meu segundo ZSH modificado (de 2018), eu usei Oh-My-Zsh , e traduzí e modifiquei as cores de um dos Temas: fino-time.zsh-theme . O arquivo de tema modificado salvei como: fino-timemod.zsh-theme, e ele deve ser salvo obrigatoriamente na pasta: . ~/oh-my-zsh/themes , e pode editar, se baseando no meu, com estas linhas:
# fino-timemod.zsh-theme . Tema para ZSH, Oh-My-Zsh. # modificado do Tema fino-time.zsh-theme # por albfneto <albfneto@fcfrp.usp.br>, Brasil, versão 2, 2018. # Use with a dark background and 256-color terminal! # Meant for people with RVM and git. Tested only on OS X 10.7. # You can set your computer name in the ~/.box-name file if you want. # Borrowing shamelessly from these oh-my-zsh themes: # bira # robbyrussell # # Also borrowing from http://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/ function virtualenv_info { [ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') ' } function prompt_char { git branch >/dev/null 2>/dev/null && echo '⠠⠵' && return echo '○' } function box_name { [ -f ~/.box-name ] && cat ~/.box-name || echo ${SHORT_HOST:-$HOST} } local rvm_ruby='‹$(rvm-prompt i v g)›%{$reset_color%}' local current_dir='${PWD/#$HOME/~}' local git_info='$(git_prompt_info)' PROMPT="╭─%{$FG[040]%}%n%{$reset_color%} %{$FG[239]%}em:%{$reset_color%} %{$FG[033]%}$(box_name)%{$reset_color%} %{$FG[239]%}no dir:%{$reset_color%} %{$terminfo[bold]$FG[226]%}${current_dir}%{$reset_color%}${git_info} %{$FG[206]%} Data e Hora: %{$FG[243]%} %D - %* ╰─$(virtualenv_info)$(prompt_char) " ZSH_THEME_GIT_PROMPT_PREFIX=" %{$FG[239]%}no dir: %{$reset_color%} %{$fg[255]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" ZSH_THEME_GIT_PROMPT_DIRTY="%{$FG[202]%}✘✘✘" ZSH_THEME_GIT_PROMPT_CLEAN="%{$FG[040]%}✔"
Para esse ZSH, uso em conjunto, este meu novo arquivo ~/.zshrc, modificado:
# Arquivo de configuração do ZSH, modificado. # Por albfneto, <albfneto@fcfrp.usp.br> 2018, versão 3. # não mudei, minha shell padrão é Bash: # If you come from bash you might have to change your $PATH. # export PATH=$HOME/bin:/usr/local/bin:$PATH # Path to your oh-my-zsh installation. export ZSH="/home/albfneto/.oh-my-zsh" # Tema ZSH, que modifiquei: # Set name of the theme to load. Optionally, if you set this to "random" # it'll load a random theme each time that oh-my-zsh is loaded. # See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes ZSH_THEME="fino-timemod" # Set list of themes to load # Setting this variable when ZSH_THEME=random # cause zsh load theme from this variable instead of # looking in ~/.oh-my-zsh/themes/ # An empty array have no effect # ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" ) # Uncomment the following line to use case-sensitive completion. CASE_SENSITIVE="true" # Uncomment the following line to use hyphen-insensitive completion. Case # sensitive completion must be off. _ and - will be interchangeable. # HYPHEN_INSENSITIVE="true" # Uncomment the following line to disable bi-weekly auto-update checks. # DISABLE_AUTO_UPDATE="true" # Uncomment the following line to change how often to auto-update (in days). export UPDATE_ZSH_DAYS=30 # Uncomment the following line to disable colors in ls. # DISABLE_LS_COLORS="true" # Uncomment the following line to disable auto-setting terminal title. # DISABLE_AUTO_TITLE="true" # Uncomment the following line to enable command auto-correction. ENABLE_CORRECTION="true" # Uncomment the following line to display red dots whilst waiting for completion. COMPLETION_WAITING_DOTS="true" # Uncomment the following line if you want to disable marking untracked files # under VCS as dirty. This makes repository status check for large repositories # much, much faster. # DISABLE_UNTRACKED_FILES_DIRTY="true" # Uncomment the following line if you want to change the command execution time # stamp shown in the history command output. # The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" HIST_STAMPS="dd/mm/yyyy" # Would you like to use another custom folder than $ZSH/custom? # ZSH_CUSTOM=/path/to/new-custom-folder # Aqui são Plugins interessantes do ZSH, que adicionei além do GIT. # Veja: https: // github.com/robbyrussell/oh-my-zsh/wiki/Plugins # Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*) # Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ # Example format: plugins=(rails git textmate ruby lighthouse) # Add wisely, as too many plugins slow down shell startup. plugins=( git compleat dirhistory history last-working-dir sudo systemd ) source $ZSH/oh-my-zsh.sh #adicionado para auto completar, veja em: # https: // stackoverflow.com/questions/24005133/ubuntu-14-04-apt-aptitude-autocompletion-with-oh-my-zsh-not-working # User Configuration setopt completealiases # export MANPATH="/usr/local/man:$MANPATH" # You may need to manually set your language environment # export LANG=en_US.UTF-8 # Preferred editor for local and remote sessions # if [[ -n $SSH_CONNECTION ]]; then # export EDITOR='vim' # else # export EDITOR='mvim' # fi # Compilation flags # export ARCHFLAGS="-arch x86_64" # ssh # export SSH_KEY_PATH="~/.ssh/rsa_id" # Set personal aliases, overriding those provided by oh-my-zsh libs, # plugins, and themes. Aliases can be placed here, though oh-my-zsh # users are encouraged to define aliases within the ZSH_CUSTOM folder. # For a full list of active aliases, run `alias`. # # Example aliases # alias zshconfig="mate ~/.zshrc" # alias ohmyzsh="mate ~/.oh-my-zsh"
Em resumo, configurei pelo Oh-My-Zsh e depois traduzí para Português do Brasil, e mudei as cores do tema. Vejam como ficou minha tela, usando o arquivo acima. Só não descobrí ainda, como a data pode ser exibida no “formato Brasileiro”, com DIA/MES/ANO.
Para o FISH, ele pode gravar os arquivos em vários locais, as vezes, mais de um.
Depende até da versão do Fish. Como vários arquivos são binários, é mais fácil configurar na interface gráfica ou no Oh-My-Fish, seguindo Meu Artigo. Também muitos outros detalhes em meu outro Artigo: “Personalizando o Shell Fish“.
8. SHELL MUDOU SOZINHA. COMO CONSERTAR.
Neste artigo, viram que gosto de variar o Shell, mas sempre mantenho o Bash como Shell Padrão.
Em meus testes mais recentes, notei que principalmente o Shell Zsh , eventualmente troca sozinho, passando a ser o Shell padrão.
Se acontecer com você, para consertar isto, primeiro saia do Zsh com o comando “bash” e depois execute este comando:
$ chsh --shell=/bin/bash $USER
Se não resolver, abra seu terminal, seja ele Konsole, GNOME-Terminal, Xfwm4-Terminal etc… vá nas configurações do perfil e troque novamente para “bash”. Exemplo, no Konsole:
Claro está que isso é só para quem não quiser que o Zsh passe a ser o Shell principal.
Nice! eu gosto de variar o uso de shells, por padrão eu utilizo o ZSH, que pode ser visto aqui mesmo:
E também gosto de usar o FISH, porque sou o mantenedor deste no SlackBuilds.
CurtirCurtir
Eu to tentando jogar pela steam no sabayon pelo kde mas a steam fecha nem chega a abrir alguem sabe resolver ?
CurtirCurtir