Saved Commands/Scripts
2026-04-01 14:02 UTC
Replies (18)
-
@Egonallanon@feddit.uk 2026-04-01 14:16
My go to is sticking what I can in my profile and making aliased commands for them all. Don’t have many for Linux quite yet but my PS profile is lapsed with dozens of these.
-
@async_amuro@lemmy.zip 2026-04-01 14:47
I selfhost ByteStash and then save anything I use frequently and reference it when I need it.
-
@bitman09@lemmy.ml 2026-04-01 17:04
Usually have kind of staging public area, and after some refinements some scripts are moved to its own repository and can be installed using bash package manager. Not my own invention but contains not yet merged code that can install scripts from github or gitlab Available scripts: Forrest tools: Tools aimed at simplify program execution Git mindset: git command extension gitlab.com/bit-man/git-mindset/-/…/git-tab.gif
-
@eskuero@lemmy.fromshado.ws 2026-04-01 18:07
Yes, it’s called export HISTSIZE=10000000
-
@promitheas@programming.dev 2026-04-01 19:20
Heres my ~/.bin directory: github.com/promitheas17j/dotfiles/tree/…/dot_bin Hopefully thats what youre asking for. My favourite ones are: bspwm-minimise.sh and bspwm-restore.sh which allow me to have window minimisation functionality in bspwm, which to my knowledge doesn’t exist natively check_last_update.sh which I have in my .zshrc and gives me a count of packages available to update with some basic colouring, as well as if I have a kernel mismatch and need to restart One that Im still working on but will for sure be my favourite once its done is parse_keybinds.sh and keybind_cheatsheet.sh, which go through some of the software I have and parse their config files to extract all the keybinds into a file with a specific format. The latter script then launches a rofi menu where I can fuzzy search keybinds based on software name and what I want to do but cant remember the binding for. So far Ive got sxhkd and lf, but I consider it a work in progress because I want to also parse neovim bindings, but sxhkd and lf are single file configs while neovim has bindings in multiple files spread across multiple subdirectories in its config directory.
-
@MidsizedSedan@lemmy.world 2026-04-02 09:59
I was going give my joke answer about how I just made a bash script to mount all my hard drives to mnt/[directories 1-13], instead of just mounting it through F-Stab, but this is NOTHING compared to your examples…
-
@LiveLM@lemmy.zip 2026-04-02 12:49
I used to keep them all in my .bashrc, later I moved to keeping the in a .scripts folder in my home, then I add it to my $PATH. Technically I could just make them all fish shell functions, but I figure it makes more sense to write regular bash (and keep them shell independent) than the odd ball fish syntax no one really shares online.
-
@CrabAndBroom@lemmy.ml 2026-04-02 15:12
I have a .scripts folder in home with a bunch of things. Most of them are for backups, aka they just rsync a bunch of things from different places into one place on my backup drive. I also have one called get_trailers that I can run in my Radarr folder which takes the names of any movie folders in there and uses yt-dlp to search and grab the trailers from Youtube and puts them in the correct folders alongside the movie.
-
@confusedpuppy@lemmy.dbzer0.com 2026-04-01 15:05
I have lots of scripts and aliases since I run a very mininal setup. The aliases are automatically set when I start a new shell and I have a shortcut command to `cat` the alias file so I can quickly view what aliases and functions I have saved. I also have a folder that contains all my notes and scripts. It's all organized and it acts as a staging area before I move any scripts to the proper location or device. I found a hobby in writing [scripts](https://codeberg.org/taters/). I've been spending a lot of time writing my own backup system that uses `rsync` and it's nearing completion which I'm excited about. It's been something I've been working building on and off since the new year began.
-
@fozid@feddit.uk 2026-04-01 17:43
Every machine I own has a scripts folder in the users home. It contains anything and everything, from starting and stopping services to changing settings, updating my boot order, literally anything I don't use often enough to alias, but know I will use at some point.
-
@felsiq@piefed.zip 2026-04-01 15:28
Not overly related to your question, but for #3 you should put your template .desktop file into the ~/Templates folder (create it if it doesn’t exist) and then you can make new ones with the right click -> Create New submenu in your file manager This works for anything btw, not specific to .desktop files
-
@thingsiplay@lemmy.ml 2026-04-01 14:59
I do write scripts and commands (and Bash aliases or functions) all the time. The scripts live in ~/.local/bin and are executable like any other program, as that directory is in my PATH variable. I have a projects directory where I archive them, and some of them are uploaded to my Github account. Some of them are later rewritten in Python and get a life on its own. 1. [yt-dlp-lemon](https://github.com/thingsiplay/yt-dlp-lemon): Simple wrapper to yt-dlp with only a subset of options. 2. [unwrap](https://github.com/thingsiplay/unwrap): Wrapper to marry GNU Parallel and 7-Zip for archive extraction. 3. [biggest](https://github.com/thingsiplay/biggest): List biggest files and folders. 4. [?](https://gist.github.com/thingsiplay/69aada6a57f829d9580d7b54f8a207a0): cheat .sh - The only cheat sheet you need. (Note, commands name is just `?`) 5. [woman](https://gist.github.com/thingsiplay/f71383569c10da17f772b9967f5a5767): Preview list for man documents. Besides my more simple scripts and aliases and functions. :::spoiler 6. system `update` and all `updates`: ```bash alias update='eos-update --yay' alias updates='eos-update --yay ; flatpak update ; flatpak uninstall --unused ; rustup self update ; rustup update' ``` ::: :::spoiler 7. Or a recent script to convert files to mp3 format: `tomp3` ```bash #!/usr/bin/env bash for file in "${@}"; do output="${file%.*}.mp3" if [[ -f "${output}" ]]; then continue fi ffmpeg -i "${file}" -b:a 320k "${output}" done ``` :::
-
@Zenlix@lemmy.ml 2026-04-02 09:33
I have a personal wiki instance hosted for that purpose. I collect knowlege in it, that I might need later and forget. Although I might not use dokuwiki, if I had so start the wiki again (would go to markdown).
-
@limerod@reddthat.com 2026-04-01 14:16
I simply have my most used commands in history. I just need to remember the command start and its done. Yay fish! But, I should start saving the commands in a file backup in case the command ever gets lost.
-
@MonkderVierte@lemmy.zip 2026-04-06 17:39
Sorry, late to the party. I like to use variations of them for debugging: ```sh red="$(tput setaf 1)" #green="$(tput setaf 2)" yellow="$(tput setaf 3)" blue="$(tput setaf 4)" reset="$(tput sgr0)" messg() { printf '%-20s\t%s\n' "$1" "$2"; } warn() { messg "${yellow}Warn${reset}:" "$1"; } error() { messg "${red}Error:" "$1" >&2; [ -n "$2" ] && exit "$2"; } # complain to STDERR and exit if given code debug() { [ -n "$debug" ] && messg "${blue}$1${reset}" "$2"; } [ "$debug" = "verbose" ] && set -x if [ -n "$debug" ]; then alias rm='rm -v' alias mv='mv -v' alias mkdir='mkdir -v' alias ln='ln -v' fi ``` And those for config/state management: ```sh get_state() { grep "$1" "$state_file" 2>/dev/null |cut -d':' -f2; } set_state() { printf '%s:%s\n' "$1" "$2" >> "$state_file"; } get_conf() { cut -d'#' -f1 "$config_file" |grep -- "$1" |cut -d"=" -f2- ; } set_conf() { #: gracefully sets config options #: meaning: changes value if key exists, creates it if not key="$1" value="$2" config="$config_file" if grep -Eq "${key}=" "$config" then sed -Ei "s/$key=.*/$key=$value/g" "$config" else printf '%s=%s\n' "$key" "$value" >> "$config" fi } ``` And a few more: ```sh isexec() { [ -x "$(command -v "$1" 2>/dev/null)" ]; } contains() { case "$1" in *${2}*) return 0;; *) return 1;; esac; } ```
-
@Thyazide@lemmy.world 2026-04-02 13:28
I use obsidian with the self hosted live sync plugin and have a couchdb instance setup on my homelab server. With external access via ssl certs (the only way to access couchdb outside a local network is to get real certs). Now I can hit my notes from all my devices and systems. While it's not 'scripts' exactly it contains a ton of documentation for things I do, plan to do and have done. Also use it as a store house for links to various things that I intend to pull in and refactor for my own use later. Or links to other larger repositories (book of secret knowledge, etc), stuff I've made public on GitHub like rules.d tutorials for some keyboards with web configuration. I think the only actual script I have on there is: ``` for f in *.mp3 *.m4a *.m4b *.opus; do [ -e "$f" ] || continue pre="${f%.*}" mkdir -p "$pre" mv "$f" "$pre/" done ``` Made it for moving loose audiobook files into individual folders.
-
@bradboimler@lemmy.world 2026-04-02 16:12
For anything more complicated than an alias, I tend to suck it up and write a program. I used to keep launcher scripts in ~/bin but I've recently taken to creating package manager packages for them. I've learned how to do that with NixOS and Arch Linux and I peeked at the Debian documentation.
-
@agentTeiko@piefed.social 2026-04-01 18:32
Tons they are all in Obsidian where the rest of my Brain lives