Autonomía digital y tecnológica

Código e ideas para una internet distribuida

Linkoteca. Linux


Holding down Alt and SysRq (which is the Print Screen key) while slowly typing REISUB will get you safely restarted. REISUO will do a shutdown rather than a restart.

Sounds like either an April Fools joke or some very strange magic akin to the old BIOS beeps we used to use to diagnose PC faults so bad that nothing would boot. Wikipedia comes to the rescue with an in-depth listing of all the SysRq keys.

R: Switch the keyboard from raw mode to XLATE mode
E: Send the SIGTERM signal to all processes except init
I: Send the SIGKILL signal to all processes except init
S: Sync all mounted filesystems
U: Remount all mounted filesystems in read-only mode
B: Immediately reboot the system, without unmounting partitions or syncing

Ghostscript is a great tool for compressing PDFs. In our tests it delivered the best compression ratio. Simply run:

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=out.pdf in.pdf

-dPDFSETTINGS can be any of:
/screen : low-resolution output, lowest output size
/ebook : medium-resolution output, medium output size
/printer OR /prepress : high-resolution with maximum output size

Run the Shrinkpdf script:

./shrinkpdf in.pdf out.pdf

The script is almost same as the explicit gs command above. However, it has one advantage – it does an output file size check.

Termtosvg es una herramienta en linea de comandos que nos permite grabar nuestras sesiones de terminal en un entorno de animación SVG. Se trata de un formato soportado por los principales navegadores web (Chrome, Firefox que fue pionero a principios de esta década, Safari…), con la excepción del Edge de Microsoft, algo que a los linuxeros tampoco nos preocupa demasiado.

Creado en Python y con licencia libre BSD (3-Clause), termtosvg nos recuerda en diferentes aspectos a herramientas como script o el más reciente asciicinema, siempre una referencia a la hora de hacer demostraciones y tutoriales.

Lo que se debe hacer es actualizar un directorio en la variable PATH la cual posiblemente al actualizar la rama se pudo desconfigurar.

sudo export PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin

Y luego para que esta asignacion no se pierda al reinciar el equipo. Se debe configurar la variable PATH de forma permanente editando el archivo de configuración de su shell de conexión. Como por lo general el shell BASH es el más utilizado, debe editar su archivo:

echo 'export PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin' >> /home/usuario/.bashrc
#!/bin/bash

####
# This script automatically creates user accounts with random passwords.
#
# Author: Russ Sanderlin
# Date: 01/21/15
#
###

if [ $# -lt 1 ]; then
echo "Please supply a user name"
echo "Example: " $0 "jsmith"
exit
fi

# Declare local variables, generate random password.

newuser=$1
randompw=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 8 | head -n 1)

# Create new user and assign random password.

useradd $newuser
echo $newuser:$randompw | chpasswd
echo "UserID:" $newuser "has been created with the following password:" $randompw

Password management should be simple and follow Unix philosophy. With pass, each password lives inside of a gpg encrypted file whose filename is the title of the website or resource that requires the password. These encrypted files may be organized into meaningful folder hierarchies, copied from computer to computer, and, in general, manipulated using standard command line file management utilities.

pass makes managing these individual password files extremely easy. All passwords live in ~/.password-store, and pass provides some nice commands for adding, editing, generating, and retrieving passwords. It is a very short and simple shell script. It’s capable of temporarily putting passwords on your clipboard and tracking password changes using git.

…a mechanism that installs updates automatically so you don’t have to worry about it. Obviously, this is meant for personal servers operated by hobbyists where convenience is more important than availability. In a professional environment, you would test new packages first because seemingly innocent changes may break complex applications.

Every user on a system may have their own crontab file. The location of the root and user crontab files are system dependant but they are generally below /var/spool/cron.

There is a system-wide /etc/crontab file, the /etc/cron.d directory may contain crontab fragments which are also read and actioned by cron. Some Linux distributions (eg, Red Hat) also have /etc/cron.{hourly,daily,weekly,monthly} which are directories, scripts inside which will be executed every hour/day/week/month, with root privilege.