Useful aliases in .bashrc?

Linux for blind general discussion blinux-list at redhat.com
Sun Dec 5 14:16:07 UTC 2021


Tim here. A couple from my collection:


Sometimes I type "cd .." too quickly, and miss the space or even a
period too, so these make my typos work as expected

  alias cd..='cd ..'
  alias cd.='cd ..'

I commonly jump to my MP3/podcast queue directory and run a command
(`biggest`) that finds all the files in the subdirectories and sorts
them all from smallest to largest (big ones that don't sound
interesting are the first on my chopping-block for saving time/space):

  alias mp3='pushd ~/Music/podcasts/; biggest -h | tail -20'

Also helping with podcasts I have

  alias ti='id3 -q "%_p%_f: %t"'

to give me the titles of podcasts I point it at.

I also keep my finances in ledger(1) format and have a number of
aliases around manipulating those

  alias fin='pushd ~/finances/ledger'
  alias le='pushd ~/finances/ledger; vim +$ $(date +%Y).txt'

  checking() {
    pushd ~/finances/ledger
    ledger -f only"$(date +%Y)".txt --pedantic register Checking "$@"
  }

  led() {
    pushd ~/finances/ledger
    ledger -f only"%(date +%Y)".txt --pedantic balance -l "commodity == 'USD'" not "Equity:Opening Balances" and not "^Income:" "$@"
  }


The "fin" alias just takes me to the directory; the "le" opens the
current year's data in vim and places the cursor at the bottom so I
can add new entries; the "checking" function gives me my checkbook
register (to which I can append "--cleared" for only those
transactions that have cleared); and the "led" function gives me a
hierarchical overview of all of my accounts and how they roll up.  I
also have a more complicated "pay" shell-function that will look for
the most recent transaction that matches some parameters and
re-create that transaction with today's date in my preferred format,
and set the amount to the specified quantity letting me do things like

  $ pay kroger 38.21

rather than manually find & copy the entire block, and update the
amounts.

Finally, I keep my calendar in remind(1) format so I have several
aliases that help me set all my preferred parameters

  alias 1='rem -g -q -iCOLOR=2 - at 2'
  for i in 2 3 4 5 6
  do
    alias $i='rem -g -q -iCOLOR=2 - at 2 "*"'$i
  done

so I can just type "1" for today's agenda or "3" for a 3-day agenda.
(I can ramble for hours on using remind and have a lengthy blog post
about it.  If you want a text-based workflow for your calendar, it's
*amazing*!)

Hopefully this gives you some more ideas,

-Tim


On December  5, 2021, Linux for blind general discussion wrote:
> Hi all,
> 
> 
> I have never really played with .bashrc, but have found it rather
> useful to add a few aliases to it.
> 
> 
> The one I find most useful so far is the alias to my "startwin.sh"
> qemu script. I use
> 
> 
> alias windows="sh ~/qemu/startwin.sh"
> 
> 
> instead of having to type, every time
> 
> 
> sh ~/qemu/startwin.sh
> 
> 
> If you have any useful aliases to share, please do?
> 
> 
> After all, why should we not make each other's lives a bit easier?
> 
> -- 
> Warm regards,
> 
> Brandt Steenkamp
> 
> Sent from Slint Linux using Thunderbird
> 
> _______________________________________________
> Blinux-list mailing list
> Blinux-list at redhat.com
> https://listman.redhat.com/mailman/listinfo/blinux-list
> 




More information about the Blinux-list mailing list