Outils pour utilisateurs

Outils du site


logiciels:zsh

Zsh : shell Unix


Astuces

Je souhaite que tous mes fichiers pdf ne soient pas exécutables, y compris les sous-dossiers :

chmod -x /chemin_vers_dossier/**/*.pdf

Raccourci pour ce déplacer dans les dossiers : Je veux aller dans le dossier extra :

cd /etc/httpd/conf/extra

Avec zsh, je tape juste /e/h/c/ext et sur Tab+↵ Entrée :-P

Plugin oh-my-zsh

archlinux

Alias Function Description
:————:—————————————–:——————————————————————————————————————–
pacin sudo pacman -S Install specific package(s) from the repositories
pacins sudo pacman -U Install specific package not from the repositories but from a file
pacinsd sudo pacman -S –asdeps Install given package(s) as dependencies of another package
pacloc pacman -Qi Display information about a given package in the local database
paclocs pacman -Qs Search for package(s) in the local database
paclsorphans sudo pacman -Qdt' List all orphaned packages
pacmir sudo pacman -Syy Force refresh of all package lists after updating /etc/pacman.d/mirrorlist
pacre sudo pacman -R Remove the specified package(s), retaining its configuration(s) and required dependencies
pacrem sudo pacman -Rns Remove the specified package(s), its configuration(s) and unneeded dependencies
pacrep pacman -Si Display information about a given package in the repositories
pacreps pacman -Ss Search for package(s) in the repositories
pacrmorphans sudo pacman -Rs $(pacman -Qtdq)' Delete all orphaned packages
pacupd sudo pacman -Sy && sudo abs && sudo aur Update and refresh the local package, ABS and AUR databases against repositories
pacupd sudo pacman -Sy && sudo abs Update and refresh the local package and ABS databases against repositories
pacupd sudo pacman -Sy && sudo aur Update and refresh the local package and AUR databases against repositories
pacupd sudo pacman -Sy Update and refresh the local package database against repositories
pacupg sudo pacman -Syu Synchronize with repositories before upgrading packages that are out of date on the local system.
yaconf yaourt -C Fix all configuration files with vimdiff
yain yaourt -S Install specific package(s) from the repositories
yains yaourt -U Install specific package not from the repositories but from a file
yainsd yaourt -S –asdeps Install given package(s) as dependencies of another package
yaloc yaourt -Qi Display information about a given package in the local database
yalocs yaourt -Qs Search for package(s) in the local database
yalst yaourt -Qe List installed packages, even those installed from AUR (they're tagged as “local”)
yamir yaourt -Syy Force refresh of all package lists after updating /etc/pacman.d/mirrorlist
yaorph yaourt -Qtd Remove orphans using yaourt
yare yaourt -R Remove the specified package(s), retaining its configuration(s) and required dependencies
yarem yaourt -Rns Remove the specified package(s), its configuration(s) and unneeded dependencies
yarep yaourt -Si Display information about a given package in the repositories
yareps yaourt -Ss Search for package(s) in the repositories
yasu yaourt –sucre Same as yaupg, but without confirmation
yaupd yaourt -Sy && sudo abs && sudo aur Update and refresh the local package, ABS and AUR databases against repositories
yaupd yaourt -Sy && sudo abs Update and refresh the local package and ABS databases against repositories
yaupd yaourt -Sy && sudo aur Update and refresh the local package and AUR databases against repositories
yaupd yaourt -Sy Update and refresh the local package database against repositories
yaupg yaourt -Syua Synchronize with repositories before upgrading packages (AUR packages too) that are out of date on the local system

common-alias

# ls, the common ones I use a lot shortened for rapid fire usage
alias l='ls -lFh'     #size,show type,human readable
alias la='ls -lAFh'   #long list,show almost all,show type,human readable
alias lr='ls -tRFh'   #sorted by date,recursive,show type,human readable
alias lt='ls -ltFh'   #long list,sorted by date,show type,human readable
alias ll='ls -l'      #long list
alias ldot='ls -ld .*'
alias lS='ls -1FSsh'
alias lart='ls -1Fcart'
alias lrt='ls -1Fcrt'

alias zshrc='$EDITOR ~/.zshrc' # Quick access to the ~/.zshrc file

alias grep='grep --color'
alias sgrep='grep -R -n -H -C 5 --exclude-dir={.git,.svn,CVS} '

alias t='tail -f'

# Command line head / tail shortcuts
alias -g H='| head'
alias -g T='| tail'
alias -g G='| grep'
alias -g L="| less"
alias -g M="| most"
alias -g LL="2>&1 | less"
alias -g CA="2>&1 | cat -A"
alias -g NE="2> /dev/null"
alias -g NUL="> /dev/null 2>&1"
alias -g P="2>&1| pygmentize -l pytb"

alias dud='du -d 1 -h'
alias duf='du -sh *'
alias fd='find . -type d -name'
alias ff='find . -type f -name'

alias h='history'
alias hgrep="fc -El 0 | grep"
alias help='man'
alias p='ps -f'
alias sortnr='sort -n -r'
alias unexport='unset'

alias whereami=display_info

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

# zsh is able to auto-do some kungfoo
# depends on the SUFFIX :)
if is-at-least 4.2.0; then
  # open browser on urls
  _browser_fts=(htm html de org net com at cx nl se dk dk php)
  for ft in $_browser_fts ; do alias -s $ft=$BROWSER ; done

  _editor_fts=(cpp cxx cc c hh h inl asc txt TXT tex)
  for ft in $_editor_fts ; do alias -s $ft=$EDITOR ; done

  _image_fts=(jpg jpeg png gif mng tiff tif xpm)
  for ft in $_image_fts ; do alias -s $ft=$XIVIEWER; done

  _media_fts=(ape avi flv mkv mov mp3 mpeg mpg ogg ogm rm wav webm)
  for ft in $_media_fts ; do alias -s $ft=mplayer ; done

  #read documents
  alias -s pdf=acroread
  alias -s ps=gv
  alias -s dvi=xdvi
  alias -s chm=xchm
  alias -s djvu=djview

  #list whats inside packed file
  alias -s zip="unzip -l"
  alias -s rar="unrar l"
  alias -s tar="tar tf"
  alias -s tar.gz="echo "
  alias -s ace="unace l"
fi

# Make zsh know about hosts already accessed by SSH
zstyle -e ':completion:*:(ssh|scp|sftp|rsh|rsync):hosts' hosts 'reply=(${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) /dev/null)"}%%[# ]*}//,/ })'

Mon zshrc

zshrc
# Path to your oh-my-zsh installation.
ZSH=/usr/share/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="robbyrussell"
ZSH_THEME="powerline"
 
# Un petit prompt sympa
autoload -U promptinit
promptinit
#prompt adam2
#prompt_adam2_setup 8bit cyan green cyan white
 
# 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=13
 
# 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="mm/dd/yyyy"
 
# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder
 
# 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=(extract history systemd sudo archlinux common-aliases colored-man-pages dircycle)
 
ZSH_THEME="robbyrussell"
# User configuration
 
export PATH=$HOME/bin:/usr/local/bin:$PATH
# export MANPATH="/usr/local/man:$MANPATH"
 
 
# You may need to manually set your language environment
# export LANG=en_US.UTF-8
export LANG=fr_FR.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/dsa_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"
alias reds='redshift &'
alias cam='gst-launch-1.0 -v tcpclientsrc host=192.168.1.125 port=53000  ! gdpdepay ! rtph264depay ! avdec_h264 ! videoconvert ! autovideosink sync=false'
alias pidom="ssh pidom"
alias vps="ssh vps"
alias myip="dig +short myip.opendns.com @resolver1.opendns.com"
alias vpn="sudo ./vpnnord.sh"
alias bso='sh ./backup-vps.sh'
alias proxyvps="ssh -v -C -TND 41200 vps"
alias proxythun="proxychains thunderbird"
alias wttr='curl -4 http://wttr.in/Cosse-Le-Vivien'
alias mesdns='grep label /etc/pdnsd.conf'
alias dodo='poweroff'
alias server='sc-start mysqld httpd'
alias bit="curl -s http://api.coindesk.com/v1/bpi/currentprice.json | jq -r '.bpi'"
alias upg='sh .news.sh && yaupg'
alias orphans='sudo pacman -Rns $(pacman -Qtdq)'
 
# export perso
export PASSWORD_STORE_CLIP_TIME=20
export EDITOR='vim'
export VISUAL='vim'
 
ZSH_CACHE_DIR=$HOME/.oh-my-zsh-cache
if [[ ! -d $ZSH_CACHE_DIR ]]; then
  mkdir $ZSH_CACHE_DIR
fi
 
source $ZSH/oh-my-zsh.sh
logiciels/zsh.txt · Dernière modification: 2018/10/27 21:37 par cyriwiki