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?
alias more=“less -cX”
alias moer=more
alias meor=more
alias meor=more
alias mroe=more
alias More=morealias grpe=grep
alias gerp=grep
alias gpre=grepIn a big fan of the ‘fuck’ package for this. Try it out. Sudo apt install thefuck.
edit: oops got the name wrong; been a while since I installed it. Fuck.
The what, now?
googles hastily
Oohhhhh mmmmmyyyyyyy…
oh my
Have tou heard of the sl command?
choo chooo
Oh boy, my time to shine:
mkd
- Create directory and immediatelycd
into itdei
-docker exec -i
dps
-docker ps
mdocker
- Switch to minikube’s docker contextn
-nvim
n.
-nvim .
Node package managers
Exampes use
pnpm
but I have them foryarn
,npm
, andbun
toopi
-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 nameUsage:
createpgdb "postgres container" "db name"
I have similar ones for
dropdb
andpg_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'
I don’t know about your other questions but here’s my current list of aliases:
g
:git
, also several git aliases in my global gitconfig, so I can type “g s
” forgit status
e.g.y
:yarn
b
:bun
fu
:flatpak update
cu
:checkupdates
lg
:lazygit
n
:nnn
e
:kak
shutup
: anhdparm
incantation to spin down my noisy hard drive.
Also various forms of
ls
, likell
,la
, justl
, etc. (I madels
a function wrappingeza
in fish shell as well. I like eza over standard ls.)I use Nala for package management in my Debian systems. I’ve created aliases for ‘apt’ & ‘apt-get’ to use Nala instead.
Also ‘ll’ alias for ‘ls -lah’.
That’s about it though.
A humble and simple “c” for “clear” in the terminal.
CTRL+L works on most I’ve used
Certain aliases related to docker compose, just because it saves 2-3 words which never change.
Don’t overlook functions, they’re more versatile.
Yes, when I type
$installed
Come back with all installed packages with version removed. I use this for a system back up script
hgrep
history | grep
Because I can never remember what parameters to use for things so my history is a quick reference.
Have you tried fzf and it’s history integration? Ctrl+R and youre fuzzy finding through your history. I don’t know how I lives without it
That sounds fantastic. Thanks!
I use a few, but this one is the best and most used:
gg = "git log --branches --remotes --tags --graph --pretty='%C(yellow)%h %C(cyan)%cd %Cblue%aN%C(auto)%d %Creset%s' --date=relative";
alias ll = ‘ls -l’
alias kk = ‘ls -l’
alias jj = ‘ls -l’
Dyslexia sometimes hits hard.
I do.
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"
me:
wgup=“sudo wg-quick up wg0”
wgdown=“sudo wg-quick down wg0”
and some pacman cleaning command…
edit: forgot that it is markdowndeleted by creator