Skip to content

Instantly share code, notes, and snippets.

@mpessolano
Last active November 12, 2021 14:46
Show Gist options
  • Select an option

  • Save mpessolano/4aa0426c6a7361344e1346c40b417d05 to your computer and use it in GitHub Desktop.

Select an option

Save mpessolano/4aa0426c6a7361344e1346c40b417d05 to your computer and use it in GitHub Desktop.
Linux tips & tricks

Comprimir y descomprimir archivos .tar.gz

  • Opciones:
-c Crear un nuevo archivo .tar.gz
-f Nombre del archivo
-v Muestra una descripción detallada del progreso de la compresión
-x Extraer el archivo
-z Compresión gzip
  • Comprimir:
tar -czvf project.tar.gz /datadrive/www/project \
--exclude=/datadrive/www/project/app/storage \
--exclude=/datadrive/www/project/vendor

tar -czvf project.tar.gz --absolute-names /datadrive/www/project \
--exclude=/datadrive/www/project/app/storage \
--exclude=/datadrive/www/project/vendor

tar -czvf html-project.tar.gz /datadrive/www/html/project \
--exclude=/datadrive/www/html/project/core
  • Listar contenido:
tar -tf project.tar.gz
  • Descomprimir:
tar -xzvf project.tar.gz

https://askubuntu.com/questions/392885/how-can-i-view-the-contents-of-tar-gz-file-without-extracting-from-the-command-l

Editor nano

yum install nano

env EDITOR=nano crontab -e

Eliminar archivos

  • Eliminar todos los archivos (excepto los archivos ocultos) y subdirectorios:
$ rm -rf /datadrive/moodledata/cache/*
$ cd /datadrive/moodledata/cache/
$ rm -rf *
  • Eliminar archivos ocultos:
$ cd /datadrive/moodledata/cache/
$ rm -rf .* 
  • Eliminar todos los archivos (incluyendo los archivos ocultos) y subdirectorios:
$ cd /datadrive/moodledata/cache/
$ rm -rf {*,.*}

https://www.cyberciti.biz/faq/linux-delete-all-files-in-directory-using-command-line/

Permisos de archivos y directorios

  • Permisos de escritura en un directorio:
chmod -R 777 dirname

Desactivar SELinux en RHEL 7

  • Ver estado actual de SELinux:
sestatus
  • Desactivar temporalmente:
setenforce 0
  • Desactivar permanentemente:
nano /etc/sysconfig/selinux

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing  - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled   - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
#     targeted - Targeted processes are protected,
#     minimum  - Modification of targeted policy. Only selected processes are protected.
#     mls      - Multi Level Security protection.
SELINUXTYPE=targeted

Enlaces útiles:

https://www.comoinstalarlinux.com/disable-selinux/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment