Linux

  • https://www.youtube.com/watch?v=X8h304Jp9N8 Fedora Silverblue’s move to bootable OCI images: Linux will never be the same
  • io_uring #async
  • Alternatives to Apache Benchmark
  • listening for codes sent by the keyboard: sudo showkey
  • listening for codes sent by the mouse: sudo apt install evtest && sudo evtest
  • How to transform curl to ab
    • <curl> = <ab>
    • -H = -H: headers
    • --data-raw <json> = -p <file>.json: request body
    • --data @file = -p <file>.json: request body
  • How to print and redirect the stdout
    <command> | tee <filename>
    
  • Converting images from webp (or jpg, png, etc.) to jpg (or webp, png, etc) (Tweet)
    sudo apt install imagemagick
    convert <file>.webp <file>.jpg
    
  • How to resize images
    sudo apt install imagemagick
    
    # Reducing quality
    convert <input> -quality <n>% <output>
    
    # Keeping aspect ratio
    convert <input> -resize <w>x<h> <output>
    
    # Ignoring aspect ratio
    convert <input> -resize <w>x<h>! <output>
    
  • Listar e ordenar diretórios por tamanho
    du -sh * | sort -hr
    
  • Logar como outro usuário no terminal
    su $OTHER_USER
    
  • Gerar Lorem Ipsum pelo terminal
    sudo apt update && sudo apt install libtext-lorem-perl
    lorem -w 96  # 96 words
    lorem -s 8   # 8 sentences
    lorem -p 12  # 12 paragraphs
    
  • Captive Portals - Acessar WiFi que precisa de autenticação pelo browser
    ip --oneline route get 1.1.1.1 | awk '{print $3}' | xargs google-chrome
    
  • Formatar pendrive
    df -h
    # encontre o pendrive a ser formatado
    sudo umount /dev/sdXX
    sudo mkfs.vfat /dev/sdXX
    
  • Pendrive bootavel
    df -h
    # encontre o pendrive
    sudo umount /dev/sdXX
    cp image.iso /dev/sdXX
    sync
    
  • Comando time (POSIX)
    • real é o tempo total do processo, do início ao fim;
    • user é o tempo de CPU gasto em user-mode (fora do Kernel);
    • sys é o tempo de CPU gasto no Kernel (ex.: syscalls, alocação de memória, I/O, etc.);
    • user + sys é o tempo total de CPU do processo;
  • Ler o output de um processo
    less /proc/$PID/fd/1  #stdout
    less /proc/$PID/fd/2  #stderr
    
  • Inverter o teclado - Símbolos serem primários e os números secundários (créditos ao Vítor)
    xmodmap -pke | sed -nre 's/keycode  (1[0-9]) = ([^ ]*) ([^ ]*)/keycode \1 = \3 \2/p' | xmodmap -
    
  • How to use SSH as SOCKS5 proxy
    ssh -vCND localhost:9999 -i <path_to_id_rsa> <username>@<remote_server>
    
  • How to learn what type (DDR?) memory my computer uses?
    sudo dmidecode -t 17
    
  • Profiling zsh startup
    # .zshrc
    zmodload zsh/zprof
    ...
    zprof
    
  • Run command skipping alias
    \<command>
    

Debian Link to heading

  • How to validate a .desktop file
    desktop-file-validate ~/.local/share/applications/<file>.desktop
    
  • How to load .desktop files
    update-desktop-database ~/.local/share/applications/
    
  • How to install Apache Benchmark Package
    sudo apt install apache2-utils
    

GPU Link to heading

  • How to discover GPU. Options:

    lspci | grep VGA
    
    sudo lshw -C display
    
    sudo apt install mesa-utils
    glxinfo | grep "OpenGL vendor\|OpenGL renderer"
    
    sudo apt install inxi
    inxi -G
    
  • How to show Intel GPU usage

    sudo apt install intel-gpu-tools
    sudo intel_gpu_top
    

Network Link to heading

  • List used ports
    sudo netstat -tulpn | grep LISTEN
    
  • How to see the WiFi network name (SSID): iwgetid
  • How to test speed between two devices in a private network
    1. Install iperf on both devices: sudo apt install iperf3
    2. Run the server in one device: iperf -s
    3. Run the test in the other device: iperf -c <server-ip>
  • How to discover devices in the same network
    sudo apt update && sudo apt install nmap
    sudo nmap -sn 192.168.0.0/24
    
  • How to discover the open ports of a specific device:
    sudo nmap -p 1-65535 <ip>
    

Terminal Emulators Link to heading

ThinkPad Link to heading

  • Fix keyboard to work / (slash) key #troubleshooting - Source
    sudo dpkg-reconfigure keyboard-configuration
    

XFCE4 Link to heading

  • Window top part (minimize, maximize, close, etc.) disappeared #troubleshooting : xfwm4
  • Desktop icons disappeared #troubleshooting: xfdesktop
  • Dead keys stopped working #troubleshooting: setxkbmap -option
  • Sending notification
    notify-send "<title>" "<message>"
    
  • Customizing Keyboard shortcuts
    xfconf-query --channel xfce4-keyboard-shortcuts --property <property> --set <command> --create --type 'string'