Muestra las diferencias entre dos versiones de la página.
| Ambos lados, revisión anterior Revisión previa Próxima revisión | Revisión previa | ||
|
wiki2:linux_commands [2019/02/09 11:10] alfred [Others] |
wiki2:linux_commands [2020/05/09 09:25] (actual) |
||
|---|---|---|---|
| Línea 27: | Línea 27: | ||
| </code> | </code> | ||
| ===== apt ===== | ===== apt ===== | ||
| - | Instalar: ''apt install <package>'' | ||
| - | Listar paquetes: ''apt list --<param> <?package>'', param=(installed|upgradeable|all-versions) | + | === Install === |
| + | ''apt install <package>'' | ||
| - | Mirar distantas versiones de un paquete: ''apt-cache policiy <package>'' | + | === Reinstall === |
| + | ''sudo apt-get install opera-stable --reinstall'' | ||
| - | Instalar un paquete en una versión concreta: ''apt install <package>=<version>'' | + | === Remove === |
| + | ''sudo apt-get purge opera-stable'' | ||
| + | |||
| + | === Get the source code === | ||
| + | ''sudo apt-get source opera-stable'' | ||
| + | |||
| + | === Listar paquetes === | ||
| + | ''apt-cache search keyword'' | ||
| + | |||
| + | ''apt-cache search .'' | ||
| + | |||
| + | === Listar paquetes instalables, upgradables... === | ||
| + | |||
| + | ''apt list --<param> <?package>'', param=(installed|upgradeable|all-versions) | ||
| + | |||
| + | === Listar versiones de un paquete === | ||
| + | |||
| + | ''apt-cache policiy <package>'' | ||
| + | |||
| + | === Ver información concreta de un paquete === | ||
| + | ''sudo apt-cache show "opera-stable"'' | ||
| + | |||
| + | === Instalar una versión concreta === | ||
| + | |||
| + | ''apt install <package>=<version>'' | ||
| + | |||
| + | === Update or upgrade === | ||
| You just need to do ''apt-get install --only-upgrade <packagename>''. This will upgrade only that single package, and only if it is installed. If you wish to install the package if it doesn't exist, or upgrade it if it does, you may leave out ''--only-upgrade''. | You just need to do ''apt-get install --only-upgrade <packagename>''. This will upgrade only that single package, and only if it is installed. If you wish to install the package if it doesn't exist, or upgrade it if it does, you may leave out ''--only-upgrade''. | ||
| Línea 61: | Línea 88: | ||
| * For changing the user and the group recursively: ''chown www-data: -R .'' | * For changing the user and the group recursively: ''chown www-data: -R .'' | ||
| + | ===== findmnt ===== | ||
| + | To display mounted data: | ||
| + | <code> | ||
| + | findmnt | ||
| + | </code> | ||
| + | Other options: | ||
| + | <code> | ||
| + | # List format | ||
| + | findmnt -l | ||
| + | # Showing disk usage | ||
| + | findmnt –D | ||
| + | # fstab | ||
| + | findmnt -s | ||
| + | # filter by type: | ||
| + | findmnt -t ext4 | ||
| + | findmnt -t xfs | ||
| + | # filter by device: | ||
| + | findmnt -S /dev/vda3 | ||
| + | # filter by mounted point: | ||
| + | findmnt -T / | ||
| + | </code> | ||
| ===== tail ===== | ===== tail ===== | ||
| To see the last lines of a file. | To see the last lines of a file. | ||
| * For maintaining it reading it use ''-f'' parameter. | * For maintaining it reading it use ''-f'' parameter. | ||
| + | |||
| + | |||
| + | ===== tree ===== | ||
| + | To see a tree of only directories until 3rd level: | ||
| + | |||
| + | <code> | ||
| + | tree -d -L 3 | ||
| + | </code> | ||
| + | |||
| + | The next will also give you the disk space used: | ||
| + | <code> | ||
| + | tree --du -h | ||
| + | </code> | ||
| + | ===== xargs ===== | ||
| + | To send output as parameters: | ||
| + | <code> | ||
| + | $ echo 'one two three' | xargs mkdir | ||
| + | $ ls | ||
| + | one two three | ||
| + | </code> | ||
| + | |||
| + | **Script example** for creating .cbz files from folders inside the current path: | ||
| + | <code> | ||
| + | ls -1 | xargs -I {} zip {}.cbz -r {} | ||
| + | </code> | ||
| + | ===== Zip and unzip ===== | ||
| + | <code> | ||
| + | zip -r app.old.zip app/ | ||
| + | </code> | ||
| ===== Others ===== | ===== Others ===== | ||
| Línea 69: | Línea 146: | ||
| * glances -> easy to use monitoring command | * glances -> easy to use monitoring command | ||
| * tree -> to show the folder tree | * tree -> to show the folder tree | ||
| + | * watch -> wait showing a command output | ||
| + | * shutdown now -> turn the computer off | ||
| + | * i3lock -c 000000 -> turn the screen off | ||
| + | * xdotool -> for sending via command line keys, texts... to the GUI | ||
| + | ==== Tips for commands ==== | ||
| + | **!<command>** will execute the <command> with the parameters you executed last time: remember the command name e.g. !ls will execute your last “ls -lrt” , !vim will open your last file without typing full command. | ||
| + | **!!** will execute the last command. | ||
| ====== Move on the paths ====== | ====== Move on the paths ====== | ||
| Línea 95: | Línea 178: | ||
| ====== Others ====== | ====== Others ====== | ||
| + | ===== Close others sessions ===== | ||
| + | :!: It's not recommended to do this for root; it could close all the current running processes. | ||
| + | <code> | ||
| + | pkill -KILL -u user | ||
| + | </code> | ||
| + | ===== Create cbz from folders ===== | ||
| + | <code> | ||
| + | ls -1 $* | xargs -I {} zip "{}.cbz" -r "{}" | ||
| + | </code> | ||
| ===== Clear and reset ===== | ===== Clear and reset ===== | ||
| You can do ''Ctrl+l'' to clear the screen which is the same than ''clear'' command. | You can do ''Ctrl+l'' to clear the screen which is the same than ''clear'' command. | ||