SHARE WITH THE CLASS: What aliases are you using?

From bash to zsh and everywhere in between, show me yours and I'll show you mines. Inspire others or get some feedback.

Simply copy & paste the output of alias in your terminal or add some comments to explain things for others.

Edit: Kbin users, click 'More' on a comment and use the fediverse link to read responses that have funky formatting

Mambert,

I Alias “sudo !!” with “plz”

Cwilliams,
uberrice,

For me it’s stfu

FluffyPotato,

I rawdog every single command, I use no aliases at all.

RaivoKulli,

Metal

redxef,

I couldn’t even work if I had aliases in my muscle memory. Imagine ssh’ing to a server and every second command you issue doesn’t exist because it’s some weird alias you set up for yourself.

I’ll stick with the “pure” command and use tab completion.

That’s also part of the reason why I don’t use some of the fancy new tools like ripgrep and exa.

duncesplayed,

Yeah, I remember when Linux was first becoming cool, in the mid-to-late 90s. There was a lot of folk wisdom going around, and one of them was “make an alias rm=‘rm -i’ so you don’t accidentally delete anything!”

And then there was the (correct, IMHO) counter-wisdom of “no, that actually makes it more likely to accidentally delete something, because one day you’re going to be on a machine where that alias doesn’t exist, but you’ve become dependent on it existing”.

I don’t mind creating aliases to add colour or change formatting a little bit or something, but don’t make an alias to keep yourself safe, because it’ll probably backfire on you.

RaivoKulli,

You couldn’t even work if you made a few longer commonly used commands convenient aliases? Well alright.

I can’t imagine how you feel about bash scripts lol.

namingthingsiseasy,

Not the person you responded to, but sure. Breaking muscle memory is extremely grating.

Also, it’s pretty easy to type long commands with little typing. If you use ctrl+r to search backward in your history, you can easily recall long commands - and also, you can use ctrl+x,ctrl+e to edit the current command line in $EDITOR so you can edit long commands. These two tricks make it very easy to type long commands quickly with very little typing.

RaivoKulli,

it’s pretty easy to type long commands with little typing

Big if true

iHUNTcriminals,

What… I didn’t know this was a thing.

So I could make be “sudo gimme-dat-new-new” Instead of “sudo DNF upgrade -y”

Vilian,

you can just put “gimme-dat-new-new”

s20,

alias gimmie-dat-new-new=‘sudo dnf upgrade -y’

Although you should probably look over your upgrade before applying it as a general good practice. But, hey, I do this myself (dnfup instead of gimmie-dat-etc.), so I can’t talk too much shit.

ETA: If you want it to be a persistent alias, though, you gotta add it to your .bashrc

macallik, (edited )

(Bash-Specific)

App-Specific

alias battery='upower -i $(upower -e | grep 'BAT') | grep -E "state|to\ full|percentage"' # Get the battery level of my laptop server when I ssh into it

alias audio="yt-dlp -f 'ba' -x --audio-format mp3" # Download the audio version of a youtube video

alias wttr="curl wttr.in/Chicago" # Get the weather of my city in the terminal

Terminal Navigation

alias ba2sy="cp ~/.bash_aliases ~/Sync/" # copy my current iteration of my aliases to my shared syncthing folder so that it's accessible across devices

alias sy2ba="cp ~/Sync/.bash_aliases ~/" # replace the current iteration of my aliases w/ the synced version from my syncthing folder

alias mba='micro .bash_aliases' # open my aliases file in the modernized version of 'nano'

alias reload="source ~/.bashrc" # Quickly refresh my system so that the latest alias file is loaded

alias l='exa --group-directories-first -hlras modified --no-user --icons' # exa is a prettier version of ls. Options toggled: Human-readable, long format, reverse output, show hidden files/folders, sort by modified, hide the 'user' column since I'm the only one that uses the computer, and show the icons to make it look fancy```

Replaced Commands

alias cat='batcat --theme=ansi ' # Replace generic output of cat w/ a formatted version. This is bat (batcat in Debian)

alias rm='trash ' # Instead of auto-deleting files, put them in the 'trash' bin for 30 days, then delete.

Server & Docker-related

alias lazy='/home/macallik/.local/bin/lazydocker' # Run Docker

alias pad='ssh MyPad20334' # shorthand to ssh into my server
babeuh,

exa is unmaintained, as per the the developer you should use eza instead.

macallik,

Thanks for the heads up

RaivoKulli,

I wonder if you can be a madlad and symlink your bash-aliases to a synced file.

tvcvt,

Not a symlink, but you can add source /path/to/aliases one your bashrc file to load them from another file. I do that and keep all of my dot files in a hit repo.

darcy,
@darcy@sh.itjust.works avatar

vim grindset 💪


<span style="color:#62a35c;">alias </span><span style="font-weight:bold;color:#795da3;">q</span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#183691;">exit
</span><span style="color:#62a35c;">alias </span><span style="font-weight:bold;color:#795da3;">:q</span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#183691;">exit
</span><span style="color:#62a35c;">alias </span><span style="font-weight:bold;color:#795da3;">:wq</span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#183691;">exit
</span>
alper_celik,

I have :q to exit too since i was trying to exit shell with :q. I guess (n)vim users cant exit their shells :)

darcy,
@darcy@sh.itjust.works avatar

we spent so much time learning to exit vim, we forgot how to exit shell 😔

PseudoSpock,
@PseudoSpock@lemmy.dbzer0.com avatar

alias .=exit

gamma,
@gamma@programming.dev avatar

That would make my shell unusable, since some plugins use ./source.

PseudoSpock,
@PseudoSpock@lemmy.dbzer0.com avatar

./ and . Are two different things to your shell

gamma, (edited )
@gamma@programming.dev avatar

I know; I’m not talking about ./. I put the slash outside the inline codeblock in the parent comment.

My shell is setup with a chdir hook to [[ -r. /.autoenv.zsh ]] &amp;&amp; . ./.autoenv.zsh.

(Edit: Jerboa is bugged with “&” in codeblocks, that should be a “&&”, not &amp;&amp;)

PseudoSpock,
@PseudoSpock@lemmy.dbzer0.com avatar

Ah, ok. For me it was an alias common in the university labs back on Ultrix. Became a habit way back then.

megane_kun,

Some QoL stuff my good friend set-up for me.


<span style="color:#323232;"># ALIASES -- EXA
</span><span style="color:#323232;">alias ls='exa --group-directories-first --color=auto -h -aa -l --git'
</span><span style="color:#323232;">
</span><span style="color:#323232;"># ALIASES -- YAY
</span><span style="color:#323232;">alias yy='yay -Y --needed --norebuild --nocleanafter --nodiffmenu --noredownload --nocleanmenu --removemake --sudoloop'
</span><span style="color:#323232;">alias ya='yay -S --needed --norebuild --nocleanafter --nodiffmenu --noredownload --nocleanmenu --removemake --sudoloop'
</span><span style="color:#323232;">alias yu='yay -R --recursive --nosave'
</span><span style="color:#323232;">
</span><span style="color:#323232;"># ALIASES -- CP
</span><span style="color:#323232;">alias cp="cp --reflink=auto -i"
</span>

And then there’s a bunch of stuff from the output of alias, most of them are git aliases. Those which aren’t git-related are listed below:


<span style="color:#323232;">-='cd -'
</span><span style="color:#323232;">...=../..
</span><span style="color:#323232;">....=../../..
</span><span style="color:#323232;">.....=../../../..
</span><span style="color:#323232;">......=../../../../..
</span><span style="color:#323232;">1='cd -1'
</span><span style="color:#323232;">2='cd -2'
</span><span style="color:#323232;">3='cd -3'
</span><span style="color:#323232;">4='cd -4'
</span><span style="color:#323232;">5='cd -5'
</span><span style="color:#323232;">6='cd -6'
</span><span style="color:#323232;">7='cd -7'
</span><span style="color:#323232;">8='cd -8'
</span><span style="color:#323232;">9='cd -9'
</span><span style="color:#323232;">_='sudo '
</span><span style="color:#323232;">cp='cp --reflink=auto -i'
</span><span style="color:#323232;">egrep='grep -E --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn,.idea,.tox}'
</span><span style="color:#323232;">fgrep='grep -F --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn,.idea,.tox}'
</span><span style="color:#323232;">history=omz_history
</span><span style="color:#323232;">l='ls -lah'
</span><span style="color:#323232;">la='ls -lAh'
</span><span style="color:#323232;">ll='ls -lh'
</span><span style="color:#323232;">ls='exa --group-directories-first --color=auto -h -aa -l --git'
</span><span style="color:#323232;">lsa='ls -lah'
</span><span style="color:#323232;">md='mkdir -p'
</span><span style="color:#323232;">rd=rmdir
</span><span style="color:#323232;">run-help=man
</span><span style="color:#323232;">which-command=whence
</span>
macallik,

Good to see another exa user. Care to break down what yay does btw?

megane_kun, (edited )

Ah, yay is an AUR helper, though I personally see it as a pacman helper as well. Link here. Some of the flags and options that can be used for pacman can be used for yay, thus, some of the flags in the aliases I use are actually for pacman. Anyways, on to the breakdown.

alias yy=‘yay -Y --needed --norebuild --nocleanafter --nodiffmenu --noredownload --nocleanmenu --removemake --sudoloop’

This one is what I use to look up for packages. The result of runnning yy «search term» would be a list of packages matching the search term and prompting the user on which package(s) to install.

flag description
-Y performs yay-specific operations.
–needed (pacman) do not reinstall up to date packages
–norebuild skips package build if in cache and up to date
–nocleanafter do not remove package sources after successful build
–noredownlod skip pkgbuild download if in cache and up to date
–nodiffmenu don’t show diffs for build files
–nocleanmenu don’t clean build PKGBUILDS
–removemake remove makedepends after install
–sudoloop loop sudo calls in the background to avoid timeout

alias ya=‘yay -S --needed --norebuild --nocleanafter --nodiffmenu --noredownload --nocleanmenu --removemake --sudoloop’

This one is what I use for installing packages. Useful if I already know what package I would be installing.

flag description
-S (pacman, extended by Yay to cover AUR as well) Synchronize packages. Packages are installed directly from the remote repositories, including all dependencies required to run the packages.

alias yu=‘yay -R --recursive --nosave’

This one is what I use when uninstalling packages. I usually check the package name with something like yay -Qi «package-name-guess» beforehand.

flag description
-R (pacman, extended by Yay to also remove cached data about devel packages) Remove package(s) from the system.
–recursive (pacman) Remove each target specified including all of their dependencies, provided that (A) they are not required by other packages; and (B) they were not explicitly installed by the user. This operation is recurisve and analogous to a backwards –sync operation.
–nosave (pacman) Instructs pacman to ignore file backup designations. (This avoids the removed files being renamed with a .pacsave extension.)

I actually don’t know much about both yay and pacman myself, since the aliases were just passed onto me by the same friend who helped me (re-)install my system (long story) and set-up the aliases. Having looked all these up, however, I might make a few changes (like changing the –nocleanafter and –nocleanmenu options to their clean ones`).

soloner,

I like the idea of binding numbers to parent directory traversal. I do cd …/… a lot in one of my projects (switching between source code and terraform folder), it’d be handy to get out of the terraform folder by just typing 2.

megane_kun,

I actually would do cd … and then do a pwd (and so on, repeatedly) because I often get confused and have a very short attention span that the aliases ended up unused.

conkbin, (edited )

I got so much crap gathered throughout the years... some of them I don't even use, but, here they are:

#!/usr/bin/zsh
# vi: ft=zsh

#############
# zsh aliases
#############

# grep
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias zgrep='zgrep --color=auto'

# processes
#alias pss='ps auxww | grep -v grep | grep'   # show all processes with user, hide grep itself
alias top='top -i -e m -E m'                # hide inactive and zombie processes, show ram in MB

# update system
alias p='sudo pacman'
alias pu='paru -Sua --noconfirm'
# clean up
alias pc='sudo pacman -Rsn $(pacman -Qdtq) --noconfirm 2>/dev/null; paru -Sccd --noconfirm'

# lvim
alias nvim='lvim'
alias vim='lvim'
alias vi='lvim'
alias v='lvim'

# cpg & mvg
alias cp='/usr/bin/cpg -ig'
alias mv='/usr/bin/mvg -ig'

# other useful ones
alias rm='trash'
alias duu='du -d 1 -h'

# wayland
alias gparted='sudo /bin/env WAYLAND_DISPLAY="$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY"  XDG_RUNTIME_DIR=/user/run/0  /usr/sbin/gparted'

# edit configs
alias vcs="$EDITOR $XDG_CONFIG_HOME/starship/config.toml"     # starship
alias vca="$EDITOR $XDG_CONFIG_HOME/alacritty/alacritty.yml"  # alacritty
alias vct="$EDITOR $XDG_CONFIG_HOME/tmux/tmux.conf"           # tmux
alias vcv="$EDITOR $XDG_CONFIG_HOME/nvim/init.vim"            # neovim
alias vcl="$EDITOR $XDG_CONFIG_HOME/lvim/config.lua"          # lunarvim
alias vch="$EDITOR $XDG_CONFIG_HOME/hypr/hyprland.conf"       # hyprland
alias vcw="$EDITOR $XDG_CONFIG_HOME/waybar/config"            # waybar

# edit & source zsh configs
alias scz="source $ZDOTDIR/.zshrc"
alias vcz="$EDITOR $ZDOTDIR/.zshrc && source $ZDOTDIR/.zshrc"
alias vczo="$EDITOR $ZDOTDIR/options && source $ZDOTDIR/options"
alias vczb="$EDITOR $ZDOTDIR/bindkeys && source $ZDOTDIR/bindkeys"
alias vcze="$EDITOR $ZDOTDIR/exports && source $ZDOTDIR/exports"
alias vcza="$EDITOR $ZDOTDIR/aliases && source $ZDOTDIR/aliases"
alias vczc="$EDITOR $ZDOTDIR/completions && source $ZDOTDIR/completions"
alias vczf="$EDITOR $ZDOTDIR/functions && source $ZDOTDIR/functions"

# other cool toys
alias exa='exa --long --header --git --sort=name --group-directories-first'
alias ls='exa'
alias cat='bat -pp'
alias bat='bat --style=full'

# x11
# alias X='startx ${XDG_CONFIG_HOME}/X11/xinitrc'
# alias XX='~/.screenlayout/home2.sh'
# alias kb='setxkbmap -rules evdev -model pc105 -layout "ro,de" -variant "basic" -option "grp:shift_caps_toggle"'

# tmux
alias tmux="tmux -f $XDG_CONFIG_HOME/tmux/tmux.conf"
alias t="tmux new-session -A -s id"

# dmenu stuff
# alias dnm='networkmanager_dmenu'
# alias dbt='dmenu-bluetooth'

# other cli utils
alias pm='pulsemixer'

# locations
alias lab='cd ~/priv/code/lab'
alias own='cd ~/priv/code/own'
alias pixl='aft-mtp-mount ~/priv/pixl'

# cleanup home
alias irssi="irssi --home ${XDG_CONFIG_HOME}/irssi"
alias svn="svn --config-dir ${XDG_CONFIG_HOME}/subversion"
alias wget="wget --hsts-file=$XDG_DATA_HOME/wget-hsts"

# dotfiles
alias stowe="sudo stow -d $HOME/.dotfiles/etc/ -t /etc/"

# ansible
alias ansible-vault='EDITOR=lvim ansible-vault'

# acme
alias acme='acme.sh --home "$XDG_CONFIG_HOME"/acme.sh/'

# vscode
alias code='vscodium --enable-features=UseOzonePlatform --ozone-platform=wayland'

# time sync
alias synctime='echo "time now:" && date && sudo systemctl stop ntpd && sudo ntpd -gq && sudo systemctl start ntpd && echo "new time:" && date'

# nordvpn
alias nvro='sudo systemctl start nordvpnd && nordvpn c ro && nordvpn whitelist add subnet 10.0.0.0/8 && nordvpn set dns 10.10.10.10'
alias nvdown='nordvpn d && sudo systemctl stop nordvpnd'

# work
alias vpnup='nmcli con up vpn-work --ask'
alias vpndown='nmcli con down vpn-work'
alias vpn='nmcli con down vpn-work; nmcli con up vpn-work --ask'
alias vault-connect='source $HOME/work/secrets/vault.work'
alias terraform-connect='source $HOME/work/secrets/terraform.work'
alias teamsx='killall -15 teams'
alias adm='sudo mount /home/$HOME/work/adm'
alias mongo='ssh -L \*:27777:appserver:27017 jumphost'
macallik,

Good to see someone else using trash & bat. Kudos for the clean alias file w/ commented headers too! I just started doing it recently and it makes edits/additions so much easier

bnjmn,

Using trash is good… aliasing it to rm, maybe not so good

macallik,

Care to elaborate?

For me, it once caused an issue once when I thought I was deleting files to make space for /boot/efi/ being at capacity (dual booting issues at the time) when in actuality I was just moving files to an impromptu trash can created on /boot/efi (so the lack of space remained the same lol), but on numerous occasions, it has actually saved my ass and allowed me to retrieve documents that I realized I needed to look at again.

The only other quirk is it straight up ignores all options, so I've tried to delete interactively (rm -i) and then had to use trash-list to view the deleted files

bnjmn,

Maybe I’m being a little paranoid, but I DID accidentally delete a few directories with dotenvs in them, which is what led me to find trash in the first place. That experience really traumatized me… so to break the rm habit and make sure I don’t do that on ANY computer I set up abbr rm '# Don't use this! Use trash-cli instead’ # and abbr t trash.

conkbin,

I try to keep backups of almost everything, so even if I accidentally delete something and only notice after a clear the trash, there is still a chance I will recover the missing pieces.

conkbin,

Thanks. It's not the prettiest, but I try to keep an order of some kind... My zshrc was getting quite large, so I split it and when I did that I also put in some comments and headers.

ExLisper,

So I’ve checked and…


<span style="color:#323232;">alias la='ls -a'
</span><span style="color:#323232;">alias mplayer='mplayer -noautosub -alang en'
</span><span style="color:#323232;">alias ll='ls $LS_OPTIONS -lh'
</span><span style="color:#323232;">alias l='ls $LS_OPTIONS -lAa'
</span><span style="color:#323232;">alias x='startx'
</span><span style="color:#323232;">alias ekgi='ekg -i'
</span><span style="color:#323232;">alias glinks='links2 -g'
</span>

My god, this must be in my .bashrc since forever. I mean… links2? ekg? startx? It’s like archeology.

I will keep it there for future historians.

deo,

I will keep it there for future historians.

great, now i have spit coffee all over the place. thanks for the laugh!

garam,

<span style="color:#323232;">alias ls='ls --time-style=long-iso'
</span><span style="color:#323232;">alias la='ls -alh'
</span><span style="color:#323232;">alias ncdu='ncdu --color=off'
</span><span style="color:#323232;">alias wttr='curl wttr.in/?T0'
</span><span style="color:#323232;">alias vim='vimx'
</span><span style="color:#323232;">alias ipinfo='curl ipinfo.io --no-progress-meter | jq "del(.readme)"'
</span><span style="color:#323232;">alias pp="pkill -SIGSTOP -f "
</span><span style="color:#323232;">alias pc="pkill -SIGCONT -f "
</span>
darcy,
@darcy@sh.itjust.works avatar

what is vimx just wondering ?

CjkOvPDwQW,

Seems to be just normal vim, maybe some distros packages the binary (of vim with more options enabled at compile time) as vimx so that it doesn’t conflict with another vim package (as an example vim-tiny). www.systutorials.com/docs/linux/man/1-vimx/

But only @aram@lemmy.my.id, can answer that for us.

garam,

vimx support X/Wayland copy paste, using "+y or "+p

Like GVim, but on terminal… haha…

macallik,

Another wttr user 👏🏾👏🏾👏🏾

noli,

Hehe pp

garam,

pp = process pause = pkill -f SIGSTOP

I hate when Win10 idle/pause on KVM/QEMU still taking much CPU, and the only way to stop it using pp/pkill…

blog.benyamin.xyz/…/stop-windows-vm-cpu-usage-whi…

Krafting,
@Krafting@lemmy.world avatar

ussr

For connecting as root with a private key on my main server named Undine Sous Speed.

macallik,

The best alliases are little inside jokes that are easy to remember imo

turing_spider574,

alias nano=‘nano -l’

my only one, to have line numbers when searching for errors in log files

Exec,
@Exec@pawb.social avatar

Copying multiple lines will be more difficult. You can use Ctrl+C to display the current position, use page up/down for coarse navigation.

learnbyexample,
@learnbyexample@programming.dev avatar

<span style="color:#62a35c;">alias </span><span style="font-weight:bold;color:#795da3;">a</span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#183691;">'alias'
</span><span style="color:#323232;">
</span><span style="color:#323232;">a c=</span><span style="color:#183691;">'clear'
</span><span style="color:#323232;">a p=</span><span style="color:#183691;">'pwd'
</span><span style="color:#323232;">a e=</span><span style="color:#183691;">'exit'
</span><span style="color:#323232;">a q=</span><span style="color:#183691;">'exit'
</span><span style="color:#323232;">
</span><span style="color:#323232;">a h=</span><span style="color:#183691;">'history | tail -n20'
</span><span style="font-style:italic;color:#969896;"># turn off history, use 'set -o history' to turn it on again
</span><span style="color:#323232;">a so=</span><span style="color:#183691;">'set +o history'
</span><span style="color:#323232;">
</span><span style="color:#323232;">a b1=</span><span style="color:#183691;">'cd ../'
</span><span style="color:#323232;">a b2=</span><span style="color:#183691;">'cd ../../'
</span><span style="color:#323232;">a b3=</span><span style="color:#183691;">'cd ../../../'
</span><span style="color:#323232;">a b4=</span><span style="color:#183691;">'cd ../../../../'
</span><span style="color:#323232;">a b5=</span><span style="color:#183691;">'cd ../../../../../'
</span><span style="color:#323232;">
</span><span style="color:#323232;">a ls=</span><span style="color:#183691;">'ls --color=auto'
</span><span style="color:#323232;">a l=</span><span style="color:#183691;">'ls -ltrhG'
</span><span style="color:#323232;">a la=</span><span style="color:#183691;">'l -A'
</span><span style="color:#323232;">a vi=</span><span style="color:#183691;">'gvim'
</span><span style="color:#323232;">a grep=</span><span style="color:#183691;">'grep --color=auto'
</span><span style="color:#323232;">
</span><span style="font-style:italic;color:#969896;"># open and source aliases
</span><span style="color:#323232;">a oa=</span><span style="color:#183691;">'vi ~/.bash_aliases'
</span><span style="color:#323232;">a sa=</span><span style="color:#183691;">'source ~/.bash_aliases'
</span><span style="color:#323232;">
</span><span style="font-style:italic;color:#969896;"># sort file/directory sizes in current directory in human readable format
</span><span style="color:#323232;">a s=</span><span style="color:#183691;">'du -sh -- * | sort -h'
</span><span style="color:#323232;">
</span><span style="font-style:italic;color:#969896;"># save last command from history to a file
</span><span style="font-style:italic;color:#969896;"># tip, add a comment to end of command before saving, ex: ls --color=auto # colored ls output
</span><span style="color:#323232;">a sl=</span><span style="color:#183691;">'fc -ln -1 | sed "s/^s*//" >> ~/.saved_commands.txt'
</span><span style="font-style:italic;color:#969896;"># short-cut to grep that file
</span><span style="color:#323232;">a slg=</span><span style="color:#183691;">'&lt; ~/.saved_commands.txt grep'
</span><span style="color:#323232;">
</span><span style="font-style:italic;color:#969896;"># change ascii alphabets to unicode bold characters
</span><span style="color:#323232;">a ascii2bold=</span><span style="color:#183691;">"perl -Mopen=locale -Mutf8 -pe 'tr/a-zA-Z/𝗮-𝘇𝗔-𝗭/'"
</span><span style="color:#323232;">
</span><span style="font-style:italic;color:#969896;">### functions
</span><span style="font-style:italic;color:#969896;"># 'command help' for command name and single option - ex: ch ls -A
</span><span style="font-style:italic;color:#969896;"># see https://github.com/learnbyexample/command_help for a better script version
</span><span style="font-weight:bold;color:#795da3;">ch</span><span style="color:#323232;">() { whatis $1</span><span style="font-weight:bold;color:#a71d5d;">; </span><span style="color:#323232;">man $1 </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">sed -n </span><span style="color:#183691;">"/^s*$</span><span style="color:#323232;">2</span><span style="color:#183691;">/,/^$/p" </span><span style="font-weight:bold;color:#a71d5d;">; </span><span style="color:#323232;">}
</span><span style="color:#323232;">
</span><span style="font-style:italic;color:#969896;"># add path to filename(s)
</span><span style="font-style:italic;color:#969896;"># usage: ap file1 file2 etc
</span><span style="font-weight:bold;color:#795da3;">ap</span><span style="color:#323232;">() { </span><span style="font-weight:bold;color:#a71d5d;">for</span><span style="color:#323232;"> f </span><span style="font-weight:bold;color:#a71d5d;">in </span><span style="color:#183691;">"$</span><span style="color:#323232;">@</span><span style="color:#183691;">"</span><span style="font-weight:bold;color:#a71d5d;">; do </span><span style="color:#62a35c;">echo </span><span style="color:#183691;">"$</span><span style="color:#323232;">PWD</span><span style="color:#183691;">/$</span><span style="color:#323232;">f</span><span style="color:#183691;">"</span><span style="font-weight:bold;color:#a71d5d;">; done; </span><span style="color:#323232;">}
</span><span style="color:#323232;">
</span><span style="font-style:italic;color:#969896;"># simple case-insensitive file search based on name
</span><span style="font-style:italic;color:#969896;"># usage: fs name
</span><span style="font-style:italic;color:#969896;"># remove '-type f' if you want to match directories as well
</span><span style="font-weight:bold;color:#795da3;">fs</span><span style="color:#323232;">() { find -type f -iname </span><span style="color:#183691;">'*'"$</span><span style="color:#323232;">1</span><span style="color:#183691;">"'*' </span><span style="font-weight:bold;color:#a71d5d;">; </span><span style="color:#323232;">}
</span><span style="color:#323232;">
</span><span style="font-style:italic;color:#969896;"># open files with default application, don't print output/error messages
</span><span style="font-style:italic;color:#969896;"># useful for opening docs, pdfs, images, etc from command line
</span><span style="font-weight:bold;color:#795da3;">o</span><span style="color:#323232;">() { xdg-open </span><span style="color:#183691;">"$</span><span style="color:#323232;">@</span><span style="color:#183691;">" </span><span style="font-weight:bold;color:#a71d5d;">&</span><span style="color:#323232;">amp</span><span style="font-weight:bold;color:#a71d5d;">;></span><span style="color:#323232;"> /dev/null </span><span style="font-weight:bold;color:#a71d5d;">; </span><span style="color:#323232;">}
</span><span style="color:#323232;">
</span><span style="font-style:italic;color:#969896;"># if unix2dos and dos2unix commands aren't available by default
</span><span style="font-weight:bold;color:#795da3;">unix2dos</span><span style="color:#323232;">() { sed -i </span><span style="color:#183691;">'s/$/r/' "$</span><span style="color:#323232;">@</span><span style="color:#183691;">" </span><span style="font-weight:bold;color:#a71d5d;">; </span><span style="color:#323232;">}
</span><span style="font-weight:bold;color:#795da3;">dos2unix</span><span style="color:#323232;">() { sed -i </span><span style="color:#183691;">'s/r$//' "$</span><span style="color:#323232;">@</span><span style="color:#183691;">" </span><span style="font-weight:bold;color:#a71d5d;">; </span><span style="color:#323232;">}
</span>
noughtnaut,

What do you use the ascii to bold function for?

learnbyexample,
@learnbyexample@programming.dev avatar

I used to use it for posting on Twitter, with some keywords (like book title) in bold.

mysticallego,

My favorite one: alias upgrate=“sudo apt update && sudo apt upgrade”

macallik,

ahhh a pormanteau lol, I like it

bubstance, (edited )

A different way to do the usual …=“cd …” and endless chains of …=“cd …/…” types of aliases:

bash/ksh version:


<span style="color:#323232;">..() {
</span><span style="color:#323232;">    local count="${1:-1}"
</span><span style="color:#323232;">    local path="../"
</span><span style="color:#323232;">    while (( --count > 0 )); do
</span><span style="color:#323232;">        path="$path../"
</span><span style="color:#323232;">    done
</span><span style="color:#323232;">    cd -- "$path"
</span><span style="color:#323232;">}
</span>

zsh single-line version:


<span style="color:#323232;">..() { cd $(printf "../%.s" {1..${1:-1}}) }
</span>

These take the number of directories that you want to move up as an argument (e.g. … 3), otherwise they move you up one directory when used with no arguments.

macallik,

Thanks for sharing, likely will implement this!

adam,

There is a shell option for this (at least in zsh): setopt autocd. This allows you to change directories while omitting the cd in front

ProtonBadger,

Just some simple stuff:

Strix ~> alias
alias balanced 'asusctl profile -P balanced'
alias performance 'asusctl profile -P performance'
alias quiet 'asusctl profile -P quiet'
alias upd 'yay ; flatpak update'
  • All
  • Subscribed
  • Moderated
  • Favorites
  • linux@lemmy.ml
  • rosin
  • everett
  • thenastyranch
  • magazineikmin
  • ngwrru68w68
  • DreamBathrooms
  • hgfsjryuu7
  • Youngstown
  • slotface
  • PowerRangers
  • InstantRegret
  • khanakhh
  • kavyap
  • vwfavf
  • Leos
  • osvaldo12
  • GTA5RPClips
  • mdbf
  • Durango
  • ethstaker
  • tacticalgear
  • cisconetworking
  • tester
  • modclub
  • cubers
  • normalnudes
  • anitta
  • provamag3
  • All magazines