200 lines
14 KiB
Markdown
200 lines
14 KiB
Markdown
# alias
|
|
|
|
##### (bash & zsh)
|
|
|
|
|
|
|
|
|
|
|
|
| | |
|
|
| -------------- | ------------------------------------------------------------ |
|
|
| **reload** | Recharge .zshrc |
|
|
| **change** | Edite .zshrc |
|
|
| **backupzsh** | Backup .zshrc .zsh_plugins.txt .zsh_plugins.sh .sh_aliases sur clicclac.info |
|
|
| **restorezsh** | Restaure .zshrc .zsh_plugins.txt .zsh_plugins.sh .sh_aliases depuis clicclac.info |
|
|
|
|
|
|
|
|
#### Répertoires, fichiers...
|
|
|
|
| | | |
|
|
| ---------------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
|
|
| **c** | `clear` | |
|
|
| **cd()** | `{ builtin cd "$@" && gls -lA --color; }`<br />`{ builtin cd "$@" && ls -la; }` | cd + ls |
|
|
| **cdf()** | `pwdf; cd "$(pwdf)"` | Changer le répertoire dans la fenêtre active du Finder |
|
|
| **cpb()** | `{ cp $@{,.bak} ;}` | Crée un backup (.bak) |
|
|
| **dus** | `du -schx * | sort -nr` | Taille des dossiers et fichiers du répertoire courant |
|
|
| **ex()** | | Extraire une archive |
|
|
| **ff()** | `{ /usr/bin/find . -name "$@" ; }` | Recherche dans le répertoire courante |
|
|
| **ffs()** | `{ /usr/bin/find . -name "$@"'*' ; }` | Recherche dans le répertoire courante (le nom commence par) |
|
|
| **ffe()** | `{ /usr/bin/find . -name '*'"$@" ; }` | Recherche dans le répertoire courante (le nom se termine par) |
|
|
| **hc** | `history -c` | Effacer l'historique |
|
|
| **l** | `gls -lA --color` (ls -la) | |
|
|
| **lh** | `gls -dla --color .*` (ls -a \| grep "^\."') | |
|
|
| **nano** | `nano -l` | N° de ligne dans nano |
|
|
| **path** | `echo -e ${PATH//:/\\n}` | |
|
|
| **qfind** | `find / -name` | find / |
|
|
| **x** | `exit` | Sortir |
|
|
| **s()<br />i()** | `{ pwd > ~/.save_dir ; }`<br />`{ cd "$(cat ~/.save_dir)" ; }` | Sauve le répertoire courante<br />Change le répertoire vers celui sauvegardé |
|
|
| **sha** | `shasum -a 256 ` | Calcule un checksum |
|
|
|
|
|
|
|
|
#### git
|
|
|
|
| | |
|
|
| --------- | ------------------------------------------------------------ |
|
|
| **ga** | git add |
|
|
| **gp** | git push |
|
|
| **gl** | git log |
|
|
| **gt** | git status |
|
|
| **gd** | git diff |
|
|
| **gc** | git commit -m |
|
|
| **gca** | git commit -am |
|
|
| **gb** | git branch |
|
|
| **gh** | git checkout |
|
|
| **gra** | git remote add |
|
|
| **grr** | git remote rm |
|
|
| **gpu** | git pull |
|
|
| **gcl** | git clone |
|
|
| **gta** | git tag -a -m |
|
|
| **gf** | git reflog |
|
|
| **acp()** | {<br/> git add .<br/> git commit -m "$1"<br/> git push<br/>} |
|
|
|
|
|
|
|
|
#### ssh serveurs
|
|
|
|
| | |
|
|
| -------------- | ----------------------- |
|
|
| **916e** | `ssh dsm916e` |
|
|
| **916** | `ssh dsm916` |
|
|
| **414** | `ssh dsm414` |
|
|
| **ovh** | `ssh ovh` |
|
|
| **11** | `ssh 1and1` |
|
|
| **pi3** | `ssh pi3` |
|
|
| **pi3e** | `ssh pi3e` |
|
|
| **sls** | `ssh vpssls` |
|
|
| **mbv** | `ssh vpsmbv` |
|
|
| **vps** | `ssh vps` |
|
|
| **asus** | `ssh asus` |
|
|
| **rebootasus** | `ssh asus /sbin/reboot` |
|
|
|
|
|
|
|
|
#### Réseau
|
|
|
|
| | | |
|
|
| --------------- | ------------------------------------------------------------ | ------------------------------- |
|
|
| **flushDNS** | `sudo killall -HUP mDNSResponder;sudo killall mDNSResponderHelper;sudo dscacheutil -flushcache` | |
|
|
| **ipinfo0** | `ipconfig getpacket en0` | Get info on connections for en0 |
|
|
| **ipinfo1** | `ipconfig getpacket en1` | Get info on connections for en1 |
|
|
| **lsock** | `sudo /usr/sbin/lsof -i -P` | Display open sockets |
|
|
| **lsockU** | `sudo /usr/sbin/lsof -nP | grep UDP` | Display only open UDP sockets |
|
|
| **lsockT** | `sudo /usr/sbin/lsof -nP | grep TCP` | Display only open TCP sockets |
|
|
| **myip** | `curl ifconfig.me` | IP publique |
|
|
| **netCons** | `lsof -i` | Show all open TCP/IP sockets |
|
|
| **openports** | `sudo lsof -i | grep LISTEN` | All listening connections |
|
|
| **ping** | `ping -c4` | |
|
|
| **pin()** | `ping -c4 "$1" | grep 'received';` | |
|
|
| **showblocked** | `sudo ipfw list` | All ipfw rules inc/ blocked IPs |
|
|
|
|
|
|
|
|
#### Développement web
|
|
|
|
| | | |
|
|
| ----------------- | ------------------------------------------------------------ | ------------------------------ |
|
|
| **apacheEdit** | `bbedit /usr/local/etc/httpd/httpd.conf` | Editer la config Apache |
|
|
| **apacheRelance** | `sudo apachectl stop ; sudo apachectl start` | Stop and start Apache |
|
|
| **apacheRestart** | `sudo apachectl -k restart` | Restart Apche gracefully |
|
|
| **apal** | `tail -f /usr/local/var/log/httpd/access_log` | Apache access_log |
|
|
| **apel** | `tail -f /usr/local/var/log/httpd/error_log` | Apache error_log |
|
|
| **editHosts** | `sudo edit /etc/hosts` | Editer le fichier hosts |
|
|
| **httpHeaders** | `/usr/bin/curl -I -L $@ ;` | Grabs headers from web page |
|
|
| **log2** | `less +F /usr/local/var/log/httpd/error_log` | Apache error_log |
|
|
| **multiapa** | `multitail -F /usr/local/etc/multitail.conf -cS apache /usr/local/var/log/httpd/error_log -cS apache /usr/local/var/log/httpd/access_log` | Apache access_log ET error_log |
|
|
| **mtapa** | `multitail -ci green /usr/local/var/log/httpd/access_log -ci red -I /usr/local/var/log/httpd/error_log` | Apache access_log ET error_log |
|
|
|
|
|
|
|
|
#### Soco-cli
|
|
|
|
| | |
|
|
| ------------------ | ------------------------------------------------------------ |
|
|
| **sonos-discover** | `/$HOME/Documents/venv/soco-cli/bin/sonos-discover -t 256 -n 1.0 -m 24` |
|
|
| **sfinfo** | `sonos Salon play_fav 'franceinfo'` |
|
|
| **sfi** | `sonos Salon play_fav 'france inter'` |
|
|
| **sk6** | `sonos Salon play_fav 'K6 FM'` |
|
|
| **srire** | `sonos Salon play_fav 'Rire et Chansons'` |
|
|
| **srtl** | `sonos Salon play_fav 'RTL'` |
|
|
| **sflow** | `sonos Salon play_fav 'Flow'` |
|
|
| **slist** | `sonos Salon list_favs` |
|
|
| **smeu** | `sonos Salon play_fav 'Meurice'` |
|
|
| **son** | `sonos Salon mute on` |
|
|
| **soff** | `sonos Salon mute off` |
|
|
| **sstart** | `sonos Salon start` |
|
|
| **sstop** | `sonos Salon stop` |
|
|
| **sv11** | `sonos Salon volume 11` |
|
|
| **sv13** | `sonos Salon volume 13` |
|
|
| **sv15** | `sonos Salon volume 15` |
|
|
|
|
|
|
|
|
#### Alias globaux
|
|
|
|
| | |
|
|
| --------- | ------------------ |
|
|
| **...** | `../..` |
|
|
| **....** | `../../..` |
|
|
| **.....** | `../../../..` |
|
|
| **C** | `| wc -l` |
|
|
| **DN** | `/dev/null` |
|
|
| **H** | `| head` |
|
|
| **LL** | `2>&1 | less` |
|
|
| **L** | `| less` |
|
|
| **LS** | `| less -S` |
|
|
| **NE** | `2> /dev/null` |
|
|
| **NUL** | `> /dev/null 2>&1` |
|
|
| **NS** | `| sort -n` |
|
|
| **RNS** | `| sort -nr` |
|
|
| **S** | `| sort` |
|
|
| **US** | `| sort -u` |
|
|
| **TL** | `| tail -20` |
|
|
| **T** | `| tail` |
|
|
| **X** | `| xargs` |
|
|
|
|
|
|
|
|
#### Divers
|
|
|
|
| | | |
|
|
| ----------------- | ------------------------------------------------------------ | -------------------------------------------------------- |
|
|
| **bashTools** | `/$HOME/Documents/Scripts/bash/bash_tools.sh` | |
|
|
| **dld()** | `{ pbpaste >> $HOME/Desktop/"$1".txt; }` | Recupère le presse-papier et le met dans un fichier .txt |
|
|
| **mailoptimiser** | `curl -sS https://raw.githubusercontent.com/pbihq/tools/master/MailDBOptimiser/MailDBOptimiser.sh | bash` | |
|
|
| **mkbuild** | `/$HOME/Documents/Scripts/bash/mkbuild.sh` | Mkdocs: |
|
|
| **mkserve** | `cd ~/project/ ; mkdocs serve` | Mkdocs: |
|
|
| **mt** | `multitail -F /usr/local/etc/multitail.conf` | Multitail |
|
|
| **quarantine** | `sudo xattr -rd com.apple.quarantine` | De-quarantine |
|
|
| **tolowercase** | `pbpaste | tr "[:upper:]" "[:lower:]" | pbcopy` | Convertit en minuscule |
|
|
| **touppercase** | `pbpaste | tr "[:lower:]" "[:upper:]" | pbcopy` | Convertit en majuscule |
|
|
| **txt** | `pbpaste | textutil -convert txt -stdin -stdout -encoding 30 | pbcopy` | Convert contents of clipboard to plain text |
|
|
| **typora** | `open -a typora` | Ouvrir un fichier markdow dans Typora |
|
|
| **up_kymsu** | `cd /$HOME/Documents/Scripts/kymsu2/ ; ./install.sh` | MàJ kymsu2 |
|
|
| **zshTools** | `/$HOME/Documents/Scripts/bash/zsh_tools.sh` | |
|
|
|
|
|
|
|
|
#### Autres
|
|
|
|
| Fonctions | | |
|
|
| ------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
|
|
| **backpi** | `sudo rsync -av --exclude ".*/" pi@192.168.1.100:/home/pi/ ~/RPi-backup` | |
|
|
| **bbshellcheck()** | | Vérifie la syntaxe des scripts bash |
|
|
| **listening()** | | Affiche les ports |
|
|
| **portainer** | `docker run -d -v "/var/run/docker.sock:/var/run/docker.sock" -p 9000:9000 portainer/portainer` | |
|
|
| **pwdf()** | | Prints the path of the front Finder window. Desktop if no window open |
|
|
| **upd_nvm()** | | Mise-à-jour de nvm |
|
|
|