Do you use bash? If not, which one do you use? zsh, fish? Why do you do it?
Do you write #!/bin/bash or #!/bin/sh? Do you write fish exclusive scripts?
Do you have two folders, one for proven commands and one for experimental?
Do you publish/ share those commands?
Do you sync the folder between your server and your workstation?
What should've people told you what to do/ use?
good practice?
general advice?
is it bad practice to create a handful of commands like podup and poddown that replace podman compose up -d and podman compose down or podlog as podman logs -f --tail 20 $1 or podenter for podman exec -it "$1" /bin/sh?
Background
I started bookmarking every somewhat useful website. Whenever I search for something for a second time, it'll popup as the first search result. I often search for the same linux commands as well. When I moved to atomic Fedora, I had to search for rpm-ostree (POV: it was a horrible command for me, as a new user, to remember) or sudo ostree admin pin 0. Usually, I bookmark the website and can get back to it. One day, I started putting everything into a .bashrc file. Sooner rather than later I discovered that I could simply add ~/bin to my $PATH variable and put many useful scripts or commands into it.
For the most part I simply used bash. I knew that you could somehow extend it but I never did. Recently, I switched to fish because it has tab completion. It is awesome and I should've had completion years ago. This is a game changer for me.
I hated that bash would write the whole path and I was annoyed by it. I added PS1="$ " to my ~/.bashrc file. When I need to know the path, I simply type pwd. Recently, I found starship which has themes and adds another line just for the path. It colorizes the output and highlights whenever I'm in a toolbox/distrobox. It is awesome.
Nope. Shell scripts reside in Git repos on Gitlab/Gitea/Forgejo and are checked out using Ansible playbooks onto the servers as necessary.
For scripts? Python. Read this blog post by the great @isotopp@chaos.social. For interactive use? bash is just fine for me, though I've customized it using Starship and created some aliases to have colored/pretty output where possible.
Use shellcheck before running your scripts in production, err on the side of caution, set -o pipefail. There are best practices guides for Bash, use those and you'll probably be fine.
Be prepared to shave yaks. Take breaks, touch grass, pet a dog. Use set -x inside your Bash script or bash -x scriptname on the CLI for debugging. Remember that you can always fallback to interactive CLI to test/prepare commands before you put them into your script. Think before you type. Test. Optimize only what needs optimization. Use long options for readability. And remember: Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows your address.
Nope, it's absolutely not bad practice to create aliases to save you some typing in interactive shell. You shouldn't use them inside your scripts though, because they might/will not be available in other environments.
I switched to fish because it has tab completion
Yeah, so does Bash, just install it.
Oh, I also "curate" a list of Linux tools that I like, that are more modern alternatives to "traditional" Linux tools or that provide information I would otherwise not easily get. I'll post i
Tools
Debian-Packages available
mtr
iputils-tracepath
iproute2
zsh
httpie
aria2
icdiff
progress
diffoscope
atop
powertop
ntopng
ethtool
nethogs
vnstat
ss
glances
discus
dstat
logwatch
swatch
multitail
lynis
ncdu (du-clone), alias du="ncdu --color dark -rr -x --exclude .git --exclude node_modules"
tig ("ncurses TUI for git. It’s great for reviewing and staging changes, viewing history and diffs.")
qalc
-ttyrec
taskwarrior
ttytter
ranger
ipcalc
pandoc
moreutils
googler
weechat
pdftk
abcde
dtrx
tload
ttyload
cockpit
sar
ht (hte Hex Editor)
dhex
ack (grep-clone)
silversearcher-ag (grep-clone)
ripgrep ("recursively searches file trees for content in files matching a regular expression. It’s extremely fast, and respects ignore files and binary files by default.", https://github.com/BurntSushi/ripgrep)
exa (statt ls) https://the.exa.website/ ("replacement for ls with sensible defaults and added features like a tree view, git integration, and optional icons.")
restic ("backup tool that performs client side encryption, de-duplication and supports a variety of local and remote storage backends.", https://restic.net/)
jc (https://github.com/kellyjonbrazil/jc, CLI tool and python library that converts the output of popular command-line tools and file-types to JSON or Dictionaries. This allows piping of output to tools like jq and simplifying automation scripts.)
bat (cat-clone), alias cat='bat' ("alternative to the common (mis)use of cat to print a file to the terminal. It supports syntax highlighting and - git integration.", https://github.com/sharkdp/bat)
alt ("finding the alternate to a file. E.g. the header for an implementation or the test for an implementation. I use it paired with Neovim", https://github.com/uptech/alt)
hyperfine ("command line benchmarking tool. It allows you to benchmark commands with warmup and statistical analysis.", https://github.com/sharkdp/hyperfine)
podman ("alternative to Docker that does not require a daemon. Containers are run as the user running Podman so files written into the - host don’t end up owned by root. The CLI is largely compatible with the docker CLI.", https://podman.io/)
skim ("fuzzy finder. It can be used to fuzzy match input fed to it. I use it with Neovim and zsh for fuzzy matching file names.")
z ("tracks your most used directories and allows you to jump to them with a partial name.", https://github.com/rupa/z)
delta (https://github.com/dandavison/delta, A syntax-highlighting pager for git, diff, and grep output. VORSICHT: Paket einer anderen Software mit gleichem Namen unter Debian Bullseye als Paket verfügbar!)
map (https://github.com/soveran/map, Map lines from stdin to commands, gemütliche Variante von xargs mit einfacherer Syntax und weniger Funktionsumfang)
crush (https://github.com/liljencrantz/crush, Crush is a command line shell that is also a powerful modern programming language. Kann u.a. SQL-Statements)
musikcube (https://github.com/clangen/musikcube, cross-platform, terminal-based music player, audio engine, metadata indexer, and server in c++ with an ncurses TI, incl.Android App)
falsisign (https://gitlab.com/edouardklein/falsisign, For bureaucratic reasons, a colleague of mine had to print, sign, scan and send by email a high number of pages. To save trees, ink, time, and to stick it to the bureaucrats, I wrote this script.)
sniffnet (https://github.com/GyulyVGC/sniffnet, cross-platform application to monitor your network traffic with ease, Debian-Pakete von GitHub verfügbar)
ouch (https://github.com/ouch-org/ouch, It’s a CLI tool for compressing and decompressing for various formats. such as .tar .zip 7z .gz .xz .lzma .bz .bz2 .lz4 .sz .zst .rar)