Mostra la pàginaRevisions anteriorsQuè hi enllaçaExporta a PDFTorna dalt Aquesta pàgina és només de lectura. Podeu veure'n el codi font, però no podeu canviar-la. Consulteu el vostre administrador si penseu que això és degut a algun error. ~~NOTOC~~ = BASH {{tag>linux pendiente wiki}} == related {{topic>linux +bash}} == cheatsheet * {{ :linux:bash:cli-cheat-sheet.pdf |}} == shell * ''/etc/shells'' * [[linux:bash:historyexpansion|]] * [[linux:bash:shellvariables|]] * [[linux:bash:ficherosinicio|]] * [[linux:bash:update-alternatives]] <callout type="info" title="Bash scripting cheatsheet" icon="true">https://devhints.io/bash</callout> <callout type="info" title="The Bash Hackers Wiki" icon="true">https://wiki.bash-hackers.org/start</callout> <callout type="warning" icon="true" title="Bash variables and command substitution">[[http://www.compciv.org/topics/bash/variables-and-substitution/]]</callout> <callout type="warning" icon="true" title="Parameter expansion">[[http://wiki.bash-hackers.org/syntax/pe?rev=1529675381]]</callout> <callout type="info" title="Glob" icon="true">[[https://en.m.wikipedia.org/wiki/Glob_(programming)]]</callout> <callout type="warning" icon="true" title="list of Unix binaries that can be exploited by an attacker to bypass local security restrictions">[[https://gtfobins.github.io/]]</callout> <callout type="info" title="Settings Shell Options" icon="true">https://bash.cyberciti.biz/guide/Setting_shell_options</callout> === comandos CLI * [[linux:bash:comandos]] * [[linux:bash:procesos]] <callout type="info" icon="true" title="SET build-in">[[https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html]]</callout> == scripting <callout type="info" icon="true" title="Guía rápida para principiantes">[[http://es.tldp.org/COMO-INSFLUG/COMOs/Bash-Prog-Intro-COMO/Bash-Prog-Intro-COMO.html]]</callout> <callout type="info" icon="true" title="Diferencia entre brackets y dobles brackets">https://www.baeldung.com/linux/bash-single-vs-double-brackets#:~:text=In%20this%20article%2C%20we%20discussed,we%20should%20prefer%20single%20brackets.</callout> * [[linux:bash:estructurasdecontrol|]] * [[linux:bash:arrays]] * [[linux:bash:indirectreferences]] * [[linux:bash:functions]] * [[linux:bash:debug]] * [[linux:bash:trap]] * Errores de novato: [[http://wiki.bash-hackers.org/scripting/newbie_traps]] * [[https://www.cyberciti.biz/programming/improve-your-bashsh-shell-script-with-shellcheck-lint-script-analysis-tool/]] * herramienta chequeo scripts: ''shellcheck'' * Diferencia entre **[** y **%%[[%%** : [[https://www.baeldung.com/linux/bash-single-vs-double-brackets#:~:text=In%20this%20article%2C%20we%20discussed,we%20should%20prefer%20single%20brackets.]] == shortcuts ^ shorcut ^ descripción ^ ^ bash ^^ | CTRL + ALT + E | expande alias | | CTRL + A | inicio de línea | | CTRL + E | final de linea | | CTRL + H | borra caracter izquierda | | CTRL + D | borra caracter cursor | | CTRL + U | borra del inicio al cursor | | CTRL + K | borra del cursor al final de línea | | CTRL + W | borra desde principio de palabra hasta cursor | | CTRL + Y | recupera lo último borrado | | CTRL + T | intercambia carácter del cursor con el carácter de la izquierda | | <esc> + T | intercambia 2 palabras | ^ emacs ^^ | CTRL + p | sube una linea, linea anterior | | CTRL + n | baja una linea, linea posterior | | CTRL + r | búsqueda recursiva hacía atrás en histórico comandos (''~/.bash_history'') | | CTRL + s | búsqueda recursiva hacía adelante en histórico comandos (''~/.bash_history'') | | META + p | | | META + n | | | META + < | | | META + > | | | CTRL + l | limpia pantalla | | CTRL + d | cierra sesión | ^ shorcut ^ descripción ^ ^ navegación ^^ | CTRL + A | principio línea | | CTRL + E | final de línea | | CTRL + XX | conmuta entre la posición actual del cursor y el principio de línea ? | | ALT + B | atrasa una palabra el cursor | | ALT + F | adelanta una palabra el cursor | ^ edición ^^ | ALT + U | uppercase caracter cursor | | ALT + L | lowercase caracter cursor | | ALT + C | capitalize caracter cursor y va al final de palabra | | ALT + D | borra palabra desde cursor hasta el final de la misma | | ALT + Del | borra palabra desde cursor hasta el principio de la misma | | ALT + T | intercambio palabra con la anterior | | CTRL + _ | undo | ^ historia ^^ ^ control del procesos ^^ | CTRL + C | interrumpe/mata | | CTRL + L | limpia pantalla | | CTRL + S | para salida por pantalla | | CTRL + Q | permitir salida por pantalla | | CTRL + D | marca EOF | | CTRL + Z | interrumpe/mata | /via: [[https://shortcutworld.com/Bash/linux/Bash_Shortcuts]] == Variables de entorno * ''HISTFILE'': Fichero donde se almacena el historial de comandos tecleados * ''HISTFILESIZE'': número de comandos que se guarda en el historial * ''HISTSIZE'': longitud máxima del fichero de historial * ''HISTIGNORE'': que comandos no se guardan en el historial de comandos. Lista de patrones separados por coma * ''HISTTIMEFORMAT'': ''HISTTIMEFORMAT='%F %T'''-> añade TIMESTAMP delante del comando * ''PS1'': prompt shell * [[linux:bash:ps1]] * ''EDITOR'': establece editor por defecto (para **less** o **crontab -e**, por ejemplo) * ''CDPATH'': establece directorios donde se hará búsqueda de directorios (que no sea el local) <code>export CDPATH=/var/www:/nas10 cd html (en lugar de) cd /var/www/html </code> == comandos abreviados y parámetros * <tab> -> completa nombre ficbero * 2x<tab> -> muestra opciones de completado (para comandos, para archivos) * (comando) -> abre nuevo bash y retorna. * ''(cd /tmp && ls)'' -> ejecuta el CD y el LS, pero al abrir sesión nueva, de deja donde estabas. * averiguar si comando es interno/externo o alias: ''type -a <comando>''<code bash>$ type -a ls ls is aliased to `ls --color=auto' ls is /bin/ls $ type -a cd cd is a shell builtin </code> https://www.cyberciti.biz/faq/linux-unix-bash-shell-list-all-builtin-commands/ linux/bash/start.txt Darrera modificació: 12/04/2023 05:59per mate