Skip to content

A collection of simple but useful Bash scripts so I don't have to remember the commands.

License

Notifications You must be signed in to change notification settings

bsteen/simple-scripts

Repository files navigation

simple-scripts

A collection of simple but useful Bash scripts so I don't have to remember the commands. Most scripts deal with .pdf or video file manipulation/conversion. Some scripts have become less "simple" over time as I add more functionality, but my goal is to make the code easy to understand over making it compact or efficient.

See LICENSE for details.

PDF Scripts

  • djvu2pdf.sh
    • Convert .djvu to .pdf
    • Requires ddjvu
  • ocr.sh
    • Perform optical character recognition (OCR) on an input image or PDF, output text to the console
    • Requires tesseract-ocr
  • pdf2png.sh
    • Convert .pdf to a set of .pngs
  • pdf2png2pdf.sh
    • Convert .pdf to .png and then back to .pdf
    • Useful for stripping hyperlinks and searchable text in PDFs
    • Requires imagemagick
  • pdfcombine.sh
    • Combine multiple .pdf files into a single .pdf
    • Requires pdftk

Video Scripts

  • avcomb.sh
    • Combine the audio stream of video 1 with the video stream of video 2
    • Requires ffmpeg
  • crop-vid.sh
    • Crop a video with a given start and end time
    • Requires ffmpeg
  • to-webm.sh
    • Converts a video container file (e.g. .mp4) to .webm format
    • Requires ffmpeg
  • vid2avi.sh
    • Convert a compatible video container file to .avi while trying to maintain good quality
    • Requires ffmpeg

Other Scripts

  • 2iso.sh
    • Converts a single file or folder into a .iso file
    • Requires mkisofs
  • hashmd.sh
    • Calculates the checksum/hashes of all the files in a folder and generates a Markdown-style table of the results.
    • Requires libarchive-zip-perl
    • See an example of the tables generated here
  • randstr.sh
    • Get 128 bytes of random data from /dev/urandom and print visible ASCII characters only
    • Passing -a makes only alpha-numeric characters print
    • Passing -A makes only alpha-numeric characters print, excluding O0lI
  • sha256-check.sh
    • --check if the calculated SHA256 sum of file equals the provided SHA256 sum string
    • Saves you from making a formatted file with the sum and filename then running sha256sum --check ...
    • Usage: ./sha256-check.sh <file> <SHA-256-str>
  • shredu.sh
    • Overwrites the specified file(s) with random data, then with all zeros, and then removes the file(s)
    • Has option to recursively shred all files in directory: -r
    • Uses the shred command
  • upgrade.sh
    • Fetch and update packages; then remove old packages
    • Uses apt-get package manager
  • zip-all.sh
    • Zip uncompressed files in a directory (depth=1) into their own ZIPs
    • Each file will be deleted after being successfully zipped
    • Usage: ./zip-all.sh <directory>
    • Requires 7zip
  • zip-optimizer.sh
    • Recompress all the ZIP archives provided using the highest compression level
    • Replaces the original ZIP archive if space is saved
    • Prints the space saved per file and the total space saved at the end
    • Usage: ./zip-optimizer ...
    • Requires 7zip

About

A collection of simple but useful Bash scripts so I don't have to remember the commands.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages