this post was submitted on 11 Feb 2024
49 points (96.2% liked)

Linux

7641 readers
151 users here now

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.

founded 1 year ago
MODERATORS
49
Do you use aliases? (lemmy.world)
submitted 6 months ago* (last edited 6 months ago) by [email protected] to c/[email protected]
 

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?

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 5 points 6 months ago* (last edited 6 months ago)

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'