command line aliases to make repeated processes quicker. I’ve used them in the past and on specific programs but never on command line utilities.

like for instance with Debian, I’m repeatedly typing sudo apt-get install, so I aliased it: alias sagi=“sudo apt-get install” and it works pretty good.

Are there any best practices or aliases to avoid when using them? Other than known commands obviously. Are there popular alias lists out there?

1 point

OMZsh has some powerful auto complete if you care to look around. Their plugins are amazing for saving time.

permalink
report
reply
1 point
*

I’ve got a ton, most are already listed or along the same vein.

The two suggestions I have are not actual aliases but worth remembering:

  • Ctrl + Alt + E - turn your alias into its original command
  • \ - Place before your alias to run the original command’s meaning. Useful if you overwrite a default command (overwriting default commands is not recommended though… often the alias will ignore any options passed through and so let’s say you overwrite rm with another app that deletes files, then you forget that, and then try to delete some files using rm-i to get a prompt for each removed file. Often the alias will just operate as normal w/o a prompt saying that it ignored -i completely)
permalink
report
reply
2 points
*

Some of these demand that the terminal you use them with is kitty:

alias ipc='curl icanhazip.com'
# btop is *pretty* bloat!
alias htop='btop'
# I'm kinda proud of this oneliner. It's pointless, but it was fun. It displays a random square image when you run
# neofetch rather than the default ansi art
alias neofetch='filarr=(~/Media/Images/1x1/*.*) && fil=${filarr[$RANDOM % ${#filarr[@]}]} && neofetch --kitty $fil' 
# comics are an important part of my life
alias gd='cd ~ ; gallery-dl'
alias gde="cd ~ ; gallery-dl --chapter-filter 'lang == (\"en\")'"
alias yd='yt-dlp --sub-langs all --embed-subs --embed-chapters --progress --paths home:~/Downloads'
alias subl="/opt/sublime_text/sublime_text"
#exa is currently unmaintained. eza is a maintained fork. It installs a link to exa, but...
alias ls="eza --icons --hyperlink --group-directories-first --git"
alias lsblkv="lsblk -o \"NAME,KNAME,SIZE,TYPE,VENDOR,MODEL,MOUNTPOINT\""
alias icat="kitty +kitten icat"
alias mem="grep -e Dirty: /proc/meminfo; grep -e Writeback: /proc/meminfo"
alias flush="sync"
alias links="links https://www.duckduckgo.com"
alias q="qalc"
alias hf="history 1 | fzf"
# tile the first two kitty windows and resize all kitty windows to 915x945, redirecting any errors to /dev/null
alias tk="xdotool search --class kitty windowmove %1 30 105 windowmove %2 975 105 windowsize %@ 915 945 2>/dev/null"
# only ask for password once on long updates
alias yay="yay --sudoloop"
permalink
report
reply
1 point

Only for typos alias bim=“vim”

permalink
report
reply
6 points
*

Oh boy, my time to shine:

  • mkd - Create directory and immediately cd into it
  • dei - docker exec -i
  • dps - docker ps
  • mdocker - Switch to minikube’s docker context
  • n - nvim
  • n. - nvim .

Node package managers

Exampes use pnpm but I have them for yarn, npm, and bun too

  • pi - pnpm install
  • pd - pnpm run dev

fzf stuff

  • sdh - Search home directory (directories, recursive)

Meme

  • fuckyou - git push --force
  • nano - nvim

Misc

createpgdb - Create a postgres db on the given container with the given name

Usage: createpgdb "postgres container" "db name"

I have similar ones for dropdb and pg_dump. Here’s the command:

f() { local __user; if [ -z $3 ]; then __user=postgres; else __user=$3; fi; docker exec -i $1 createdb -U $__user $2; unset -f f; }; f'
permalink
report
reply

Linux

!linux@lemmy.world

Create post

Welcome to c/linux!

Welcome to our thriving Linux community! Whether you’re a seasoned Linux enthusiast or just starting your journey, we’re excited to have you here. Explore, learn, and collaborate with like-minded individuals who share a passion for open-source software and the endless possibilities it offers. Together, let’s dive into the world of Linux and embrace the power of freedom, customization, and innovation. Enjoy your stay and feel free to join the vibrant discussions that await you!

Rules:

  1. Stay on topic: Posts and discussions should be related to Linux, open source software, and related technologies.

  2. Be respectful: Treat fellow community members with respect and courtesy.

  3. Quality over quantity: Share informative and thought-provoking content.

  4. No spam or self-promotion: Avoid excessive self-promotion or spamming.

  5. No NSFW adult content

  6. Follow general lemmy guidelines.

Community stats

  • 1.4K

    Monthly active users

  • 555

    Posts

  • 4.2K

    Comments

Community moderators