Linux

Info

  • How to get the OS version

    lsb_release -a
    uname -a
    cat /etc/os-release
    

  • How to redirect error output to a file

    command 2> error.log
    
  • How to restart a server from another server

    ssh -t username@server.com 'sudo reboot'
    

Archiving

  • How to arcchive a folder

    tar -czvf ARCHIVE.tar.gz /path/to/folder/to/archive
    
  • How to unarchive a tar.gz file

    tar -xvf ARCHIVE.tar.gz
    

Searching

  • How to find specific files recursively

    find . -name ".DS_Store" -type f
    
  • How to delete specific files recursively

    find . -name ".DS_Store" -type f -delete
    
  • How to count the number of files with an extension

    find . -type f -name "*.java" | wc -l
    
  • How to search recursively with grep

    grep -r --include "*.java" "SEARCH TEXT" .
    

Media

  • How to convert a PNG image to WebP with 80% quality

    cwebp -q 80 INPUT.png -o OUTPUT.webp
    
  • How to convert a MOV video to MP4

    ffmpeg -i INPUT.mov -c:v copy -c:a copy OUTPUT.mp4