I made my own commands for any package manager task!

Ima cover all NEEDED tasks.
anyone else hate having to write more than two letters for something to work? Say no more! In this post, I will show Dwell commands, and compare them to Deb Debian packaging. But realize, I am placing a layer of encryption with making tons of alias on it in order for these to work on Konsole on Kubuntu(which is why I am using Deb packaging, instead of something else, like dnf Fedora or zwpper OpenSUSE)
Installing apps would be “mi” instead of “apt-get install”
Updating apps would be “mu” instead of “apt-get install” (Deb packaging has no unique update command for apps)
Removing apps would be “mr” instead of “apt-get remove”
Updating the package list would be “up” instead of “apt-get upgrade”
Updating the system would be “us” instead of “apt-get upgrade”
Searching by package name would be “sn” instead of “apt-cache search”
Searching by pattern name would be “sp” instead of “apt-cache search” (I regret using a Ubuntu based distro, it is because of KDE, used to deb packaging, and wanted ease of use for family with something reliable cough cough Ubuntu)
Searching by file name would be “sf” instead of “apt-file search”
Listing packages installed would be “sl” instead of “dpkg -l”
Listing repos would be… wait… when did package managers have this… I thought it was “ls”… nvm I guess I will use “rl” although I can just use ls
Adding repos… “ra” and removing repos… “rr”
The reason why I shortened the commands is because my hands are sick from typing a lot in the terminal(although I should use Ubuntu gui? :wink: ), and because I wanted to make all packaging commands short yet meaningful. As a challenge, try seeing why I picked those two specific letters per command.

1 Like

Have you checked that all of these 2-letter aliases are not also Unix commands?

I gave up aliases, just another layer of things to remember

1 Like

but it’s easy to remember. I made up these aliases from distrowatch which was comparing package managers doing basic tasks, and I’m like… “wait this can be done with two letters” and then made up the two letter commands. They are easy to figure.
m is for software management, r is for removal, so what does that mean? app removal!

I have nothing against it.
I used to use ‘h’ for ‘history’ and various aliases for ‘ls–F’ and ‘ls -l’

1 Like

Hi all, :wave:

Good point, Neville. :blush:

I have just 3 aliases (or functions in the fish-shell).

  • alias RuheToggle # I created that one for toggling my Big Ben chimes on and off in crontab
  • alias yy ‘env EXA_COLORS=da=33:di=35 exa -lg’
  • alias yyyy ‘env EXA_COLORS=da=33:di=35 exa --tree --level=3’

Whereas “RuheToggle” was clear not to be taken up by the system I made sure yy and yyyy were not taken either by just punching them into the terminal.

Both appeared in red colour in the fish-shell, so it was clear they didn´t represent a command. Otherwise they would´ve appeared in blue.

So I could go ahead with the creation of the aliases. :laughing:

Thanks for your word of caution, Neville.

Many greetings from Rosika :slightly_smiling_face:

2 Likes

I wonder how fish commands are different from bash.

https://fishshell.com/docs/3.0/tutorial.html

interesting… fish is different.

1 Like

That is nice. I suppose I would have used which

Ruhe means call… so you use the chimes for an alarm clock?

Cheers,
Neville

1 Like

Ruhe = Silence

:laughing:

2 Likes

Correct. Call is rufen… My vocab is failing again
So it is a reference to toggling off the chimes?

1 Like

I have only four aliases, two of them are 'cause I’m always mistyping grep as either Grep (i.e. capitialised immedately following holding down shift for the | pipe) and “gerp”, and one to eliminate all the GARBAGE that modern linux distros present (who even gives a rat’s A if some snap or tempfs bogus READ ONLY garbage “object”, is full [it’s ALWAYS full]) when you type “df -h” :

alias dfx='df -h -x squashfs -x tmpfs -x devtmpfs'

But also - on RPM based distros, I also have :
alias rename=prename

Debian family have the CPAN / perl “rename” command by default that accepts regex (i.e. just like sed) for renaming files, but “rename” on RPM distros is an entirely different kettle of fish, with about 5% of the functionality and power of the CPAN “rename”.

I used to eschew using aliases for many years, but as installing or configuring a new OS somewhere, nearly anywhere, these days, involves setting up ZSH and oh-my-zsh, every new build I’m editing my ~/.zshrc anyway, so it’s an extra 10 seconds to find those lines and paste them in… Not that I have anytime in the last 2 years, but, even if I was setting up a Win10 or 11 machine, I’d be enabling WSL and installing ZSH and oh-my-zsh (and git).

2 Likes

Hi all, :wave:

@TerminalDweller :wink:

fish is great for me. It´s one of the first things (if not the very first one) I install when setting up a new system.

The fish syntax differs in some respects from the bash syntax but mostly (for everyday usage) there´s not much to learn.
What I like most about fish is that even for most complicated commands there´s not much need to create aliases.
Just type a keyword (or part of it), then “arrow up” and violà: there´s your command.

My favourite example:

set serial 57584C314135364855375855; and echo $(lsblk -o name,serial | grep $serial | awk '{print $1}'); and sleep 2; and sudo hdparm -B /dev/$(lsblk -o name,serial | grep $serial | awk '{print $1}'); and sleep 2; and sudo hdparm -B 254 /dev/$(lsblk -o name,serial | grep $serial | awk '{print $1}'); and sudo hdparm -B /dev/$(lsblk -o name,serial | grep $serial | awk '{print $1}'); and sleep 3; and sudo smartctl -A -d sat /dev/$(lsblk -o name,serial | grep $serial | awk '{print $1}'); and echo $status

All I have to do is: type “serial”, then “arrow up” and “enter”. :wink:

@Akito:

Thanks for providing the link. :hearts:

@nevj:

Hi Neville,

Well, I did it the following way:

With crontab -e I created the following entries:

00 0-11,20-23 * * * if [ ! -f /tmp/Ruhe ]; then XDG_RUNTIME_DIR="/run/user/1000" mplayer /media/rosika/f14a27c2-0b49-4607-94ea-2e56bbf76fe1/DATEN-PARTITION/Dokumente/Pausenzeichen/Big_Ben_chimes/Big-ben-chimes.mp3 > /dev/null 2>&1; fi
15 * * * * if [ ! -f /tmp/Ruhe ]; then XDG_RUNTIME_DIR="/run/user/1000" mplayer /media/rosika/f14a27c2-0b49-4607-94ea-2e56bbf76fe1/DATEN-PARTITION/Dokumente/Pausenzeichen/Big_Ben_chimes/Big_Ben_quarter_hour  > /dev/null 2>&1; fi
30 * * * * if [ ! -f /tmp/Ruhe ]; then XDG_RUNTIME_DIR="/run/user/1000" mplayer /media/rosika/f14a27c2-0b49-4607-94ea-2e56bbf76fe1/DATEN-PARTITION/Dokumente/Pausenzeichen/Big_Ben_chimes/Big_Ben_half_hour > /dev/null 2>&1; fi
45 * * * * if [ ! -f /tmp/Ruhe ]; then XDG_RUNTIME_DIR="/run/user/1000" mplayer /media/rosika/f14a27c2-0b49-4607-94ea-2e56bbf76fe1/DATEN-PARTITION/Dokumente/Pausenzeichen/Big_Ben_chimes/Big_Ben_three_quarters_of_the_hour  > /dev/null 2>&1; fi
00 12 * * * if [ ! -f /tmp/Ruhe ]; then XDG_RUNTIME_DIR="/run/user/1000" mplayer /media/rosika/f14a27c2-0b49-4607-94ea-2e56bbf76fe1/DATEN-PARTITION/Dokumente/Pausenzeichen/Big_Ben_chimes/Big-ben_bearbeitet/Big-ben-chimes_plus12_noon.mp3 > /dev/null 2>&1; fi
00 13 * * * if [ ! -f /tmp/Ruhe ]; then XDG_RUNTIME_DIR="/run/user/1000" mplayer /media/rosika/f14a27c2-0b49-4607-94ea-2e56bbf76fe1/DATEN-PARTITION/Dokumente/Pausenzeichen/Big_Ben_chimes/Big-ben_bearbeitet/Big-ben-chimes_plus1.mp3  > /dev/null 2>&1; fi
00 14 * * * if [ ! -f /tmp/Ruhe ]; then XDG_RUNTIME_DIR="/run/user/1000" mplayer /media/rosika/f14a27c2-0b49-4607-94ea-2e56bbf76fe1/DATEN-PARTITION/Dokumente/Pausenzeichen/Big_Ben_chimes/Big-ben_bearbeitet/Big-ben-chimes_plus2.mp3 > /dev/null 2>&1; fi
00 15 * * * if [ ! -f /tmp/Ruhe ]; then XDG_RUNTIME_DIR="/run/user/1000" mplayer /media/rosika/f14a27c2-0b49-4607-94ea-2e56bbf76fe1/DATEN-PARTITION/Dokumente/Pausenzeichen/Big_Ben_chimes/Big-ben_bearbeitet/Big-ben-chimes_plus3.mp3  > /dev/null 2>&1; fi
00 16 * * * if [ ! -f /tmp/Ruhe ]; then XDG_RUNTIME_DIR="/run/user/1000" mplayer /media/rosika/f14a27c2-0b49-4607-94ea-2e56bbf76fe1/DATEN-PARTITION/Dokumente/Pausenzeichen/Big_Ben_chimes/Big-ben_bearbeitet/Big-ben-chimes_plus4.mp3  > /dev/null 2>&1; fi
00 17 * * * if [ ! -f /tmp/Ruhe ]; then XDG_RUNTIME_DIR="/run/user/1000" mplayer /media/rosika/f14a27c2-0b49-4607-94ea-2e56bbf76fe1/DATEN-PARTITION/Dokumente/Pausenzeichen/Big_Ben_chimes/Big-ben_bearbeitet/Big-ben-chimes_plus5.mp3  > /dev/null 2>&1; fi
00 18 * * * if [ ! -f /tmp/Ruhe ]; then XDG_RUNTIME_DIR="/run/user/1000" mplayer /media/rosika/f14a27c2-0b49-4607-94ea-2e56bbf76fe1/DATEN-PARTITION/Dokumente/Pausenzeichen/Big_Ben_chimes/Big-ben_bearbeitet/Big-ben-chimes_plus6.mp3  > /dev/null 2>&1; fi
00 19 * * * if [ ! -f /tmp/Ruhe ]; then XDG_RUNTIME_DIR="/run/user/1000" mplayer /media/rosika/f14a27c2-0b49-4607-94ea-2e56bbf76fe1/DATEN-PARTITION/Dokumente/Pausenzeichen/Big_Ben_chimes/Big-ben_bearbeitet/Big-ben-chimes_plus7.mp3 > /dev/null 2>&1; fi

So there´s an if-statement present before running the chimes.
Whether or not the chimes are played depends on whether or not there is the file /Ruhe present in /tmp.

I defined the following alias:
alias RuheToggle /media/rosika/f14a27c2-0b49-4607-94ea-2e56bbf76fe1/DATEN-PARTITION/Dokumente/zu_crontab/RuheToggle.sh

The shell-script (RuheToggle.sh) is this one:

#!/bin/bash

if [ -f /tmp/Ruhe ]
	then 
		rm /tmp/Ruhe
else
	touch /tmp/Ruhe
fi

So punching in the command RuheToggle would toggle the chimes on and off. :wink:

Here´s an example of how I use it:

RuheToggle; and ll /tmp | grep Ruhe; and /home/rosika/Desktop/Kopie_Skripte/tts_script_7_deLuxe_focal.sh; and RuheToggle; and ll /tmp | grep Ruhe

This command toggles the chimes off before running my tts-script (text-to-speech). I wouldn´t want the chimes to interfere with it. After the tts-script has finished the chimes are toggled on again.

And once again: I just type tts (thanks to fish), “arrow up” and “enter”. Couldn´t be more convenient for me. :smiley:

Many greetings from Rosika :slightly_smiling_face:

2 Likes

@TerminalDweller

Hi again, :wave:

I´ve just found some info regarding your question:

" Fish for bash users"; see: Fish for bash users — fish-shell 3.5.0 documentation

This is to give you a quick overview if you come from bash (or to a lesser extent other shells like zsh or ksh) and want to know how fish differs.

Many greetings
Rosika :slightly_smiling_face:

2 Likes

what do you think about this as a potential solution:

  • zatanas
2 Likes