A collection of my daily used Bash scripts, which include multimedia processing, development environment setup, and productivity tasks. Note that some scripts contain hardcoded values and may need to be edited to work in other environments.
bash-scripts/
├── Root scripts (multimedia & utilities)
├── ambiente-desenvolvimento/ # Development environment setup
│ ├── setup.sh # Main setup menu
│ ├── scripts/ # Individual setup scripts
│ └── arquivos/ # Supporting files and binaries
└── lista-presença/ # Student attendance management
Downloads videos from a list of URLs and saves them as 720p MP4 files.
Usage:
./baixar-videos.sh <file-with-urls>Arguments:
<file-with-urls>: Text file with one URL per line
Requirements:
yt-dlp- YouTube and video downloader
Example:
# Create a file with URLs
echo "https://example.com/video1" > urls.txt
echo "https://example.com/video2" >> urls.txt
./baixar-videos.sh urls.txtConverts an image to WebP format with metadata stripping and file deletion.
Usage:
./converter-webp.sh <image-file>Arguments:
<image-file>: Path to the image file (jpg, png, etc.)
Requirements:
ImageMagick(magick command)
Features:
- Removes EXIF metadata and color profiles for smaller file size
- Deletes original file after successful conversion
Example:
./converter-webp.sh photo.jpg # Creates photo.webp and removes photo.jpgGenerates a favicon.ico file from an image with multiple resolutions.
Usage:
./gerar-favicon.sh <image-logo>Arguments:
<image-logo>: Path to the image file to use as favicon source
Requirements:
ImageMagick(magick command)
Features:
- Generates favicon with multiple resolutions: 64x64, 48x48, 32x32, 16x16
- Ensures transparent background
Example:
./gerar-favicon.sh logo.png # Creates favicon.ico in current directoryCreates optimized Open Graph (OG) images for social media sharing (1200x630px).
Usage:
./gerar-og.sh <original-image>Arguments:
<original-image>: Path to the original image
Requirements:
ImageMagick(magick command)
Features:
- Resizes to 1200x630px (standard OG dimensions)
- Center-crops to maintain aspect ratio
- Removes EXIF metadata
- Optimized compression (quality 85)
- Progressive JPEG encoding for faster loading
Output:
- Creates
<original-image-name>_og.jpg
Example:
./gerar-og.sh banner.png # Creates banner_og.jpgCleans exercise folders by keeping only C source files (.c) and headers (.h).
Usage:
./limpar-exercicios.shRequirements:
- Must be run from the parent directory containing exercise folders
findcommand
Features:
- Recursively removes all files except .c and .h
- Processes all subdirectories
- Prints status for each folder
Example:
# Directory structure
# exercices/
# ├── ex1/
# │ ├── main.c
# │ ├── helper.h
# │ ├── output.o (will be deleted)
# │ └── README.txt (will be deleted)
./limpar-exercicios.sh
# Result: Only .c and .h files remain in each exercise folderStops and resets a Docker container for a specific project.
Usage:
./reset-container.shRequirements:
Dockerinstalled and running- Project:
$HOME/Documentos/Projetos/matrix-blur-filter
Features:
- Stops the running container
- Removes the old container
- Rebuilds the Docker image
- Creates and runs a new container on port 3000
Configuration (hardcoded):
- Project path:
$HOME/Documentos/Projetos/matrix-blur-filter - Image name:
matrix-blur-app - Container name:
blur-app - Port:
3000:3000
Transcribes audio or video files to text using OpenAI's Whisper model.
Usage:
./transcrever.sh <input-file>Arguments:
<input-file>: Audio or video file (mp3, wav, mp4, etc.)
Requirements:
whisper.cpp- Built binary at$HOME/whisper.cpp/build/bin/whisper-cliggml-small.binmodel at$HOME/whisper.cpp/models/ggml-small.binffmpeg- For audio conversion if input is not WAV format
Features:
- Automatically converts non-WAV files to WAV format (16kHz, mono)
- Uses Portuguese language model
- Temporary files are cleaned up automatically
- GPU acceleration support (
-dev 1flag)
Installation:
- Follow the official whisper.cpp docs for the installation
- Download the
ggml-smallmodel
Example:
./transcrever.sh lecture.mp4
./transcrever.sh podcast.mp3Interactive menu for setting up the development environment. Allows installing components individually or all at once.
Usage:
cd ambiente-desenvolvimento
bash setup.shFeatures:
- Interactive menu with 6 options
- Install components individually or all together
Menu Options:
1) Install APT packages
2) Install Kate editor
3) Install LazyGit
4) Install FiraCode Nerd Font
5) Update all Snaps
6) Install everything
Installs system packages from a predefined list.
Usage:
bash scripts/pacotes-apt.shRequirements:
sudoprivilegesaptpackage manager (Debian/Ubuntu-based systems)
Features:
- Reads package list from
arquivos/pacotes-apt.txt - Updates package cache
- Installs all packages automatically
Installs FiraCode Nerd Font from a ZIP archive.
Usage:
bash scripts/fira-code-nerd-font.shRequirements:
unzipcommand- Font ZIP file at
arquivos/FiraCode.zip
Features:
- Extracts to
~/.local/share/fonts/FiraCode - Rebuilds font cache with
fc-cache
Installs Kate text editor via Flatpak with configuration backup.
The purpose of choosing Kate is that it is a lightweight editor with Clangd LSP and Vim motions support, making it a perfect choice for usage in my college's C classes.
Usage:
bash scripts/kate.shRequirements:
flatpakinstalled- User-level execution (no sudo/root)
arquivos/org.kde.kate.flatpakreffilearquivos/org.kde.kate.tar.gzconfiguration backup
Features:
- Installs Kate for the current user only
- Restores configuration from backup
- Sets up proper Flatpak permissions
- Prevents permission corruption by refusing to run as root
Note: This script will fail if run with sudo to prevent home directory permission issues.
Installs LazyGit CLI tool from a prebuilt binary.
Usage:
bash scripts/lazygit.shRequirements:
sudoprivileges- LazyGit binary at
arquivos/lazygit
Features:
- Installs to
/usr/local/bin/for system-wide access - Uses prebuilt binary (no compilation needed)
Updates all installed Snap packages.
Usage:
bash scripts/snap-update.shRequirements:
sudoprivilegessnapdinstalled
Features:
- Refreshes all installed snaps to latest versions
Generates attendance reports from a student list.
Usage:
cd lista-presença
# View student list with numbers
./gerar-lista-presenca.sh
# Generate attendance list for present students
./gerar-lista-presenca.sh 1 3 5 7
# Generate attendance list for absent students (reverse mode)
./gerar-lista-presenca.sh --reverse 2 4 6Arguments:
<student-numbers>: Space-separated student line numbers--reverse: Generate list of absent students instead of present
Input File:
alunos.txt- One student name per line
Output:
Lista de Presença <DD.MM>.txt- Generated attendance file with current date
Features:
- Displays numbered student list without arguments
- Supports normal mode (list present students)
- Supports reverse mode (list absent students)
- Automatically formats output filename with current date
Example:
# Input: alunos.txt
# 1 João Silva
# 2 Maria Santos
# 3 Carlos Costa
# Show all students
./gerar-lista-presenca.sh
# Output:
# 1 João Silva
# 2 Maria Santos
# 3 Carlos Costa
# Generate attendance for students 1 and 3
./gerar-lista-presenca.sh 1 3
# Creates: Lista de Presença 11.06.txt with João Silva and Carlos Costa
# Generate attendance for absent students (2)
./gerar-lista-presenca.sh --reverse 1 3
# Creates: Lista de Presença 11.06.txt with Maria Santos| Requirement | Scripts | Installation |
|---|---|---|
ImageMagick |
converter-webp, gerar-favicon, gerar-og | sudo apt install imagemagick |
yt-dlp |
baixar-videos | pip install yt-dlp or sudo apt install yt-dlp |
Docker |
reset-container | Official Docker installation guide |
whisper.cpp |
transcrever | Build from source (see script section) |
ffmpeg |
transcrever | sudo apt install ffmpeg |
flatpak |
kate | sudo apt install flatpak |
unzip |
fira-code-nerd-font | sudo apt install unzip |
| Standard tools | Most scripts | find, sed, date, bash (pre-installed) |
- Clone or download this repository:
git clone https://github.com/carvdev/bash-scripts.git
cd bash-scripts- Make scripts executable:
chmod +x *.sh
chmod +x ambiente-desenvolvimento/*.sh
chmod +x ambiente-desenvolvimento/scripts/*.sh
chmod +x lista-presença/*.sh-
Install required dependencies for scripts you'll use
-
Run desired scripts
This project is licensed under the MIT License
I do not expect for contribuitions in this repository, but feel free to do it, if you want.