Share your alias AND/OR function

And there is CTRL-R which will also search from the beginning. But it always gives you the most recent command, whereas “hg xyz” shows you all of them.
Many ways to achieve the same result I guess…

1 Like

how about Ctrl+R

i have this on Portergos. It shows up everytime i open a terminal (is attached to bash and zsh)

Short version:
echo -e ",__, \n(oo)____ \n(__) )\ \n ||--|| *"

3 Likes

It’s very cute and I didn’t know about the -e option to echo :+1:

I have a fortune | cowsay -f bud-frogs in my ~/.bashrc printing green frogs with random quote/saying every time I use bash :grin:
2020-04-12-202758_1366x768_scrot

Some would say it’s horrible taste, but I just like it :slight_smile:

5 Likes

Thanks for those, I use the first 2 on my laptop

1 Like

Sorry if this is digging up an old thread, but I got a lot of use out of all of this, so thank you to everybody. For anybody trying to apply the updating mirrors part of things, “US” is what you want to put for United States (and I would guess “UK” for United Kingdom), do it as “United States” or “United_States” will give you an error.

After some cursory ‘testing’ of the reflector command, it appears to accept the ‘country codes’ that are used in setting locales. For instance, it appears that GB gets you the United Kingdom… as CA gets you Canada and so on.

You are correct, that makes sense why “US” works and “United States” doesn’t, but I did think that “UK” was standard for United Kingdom, but I’m an ocean away, so wtf do I know. :stuck_out_tongue:
Interesting that in the above examples entries like “Sweden” work, and still do for me.

I notice that many country names seem to work, but ISO country codes seem ALL to work OK. SE works for Sweden as well… and AU for Australia and so on (by name too). Maybe there is lookup table somewhere to explain it :grin: - but I’m not looking it up!

Since we are talking about this…

The Manjaro-specific command “pacman-mirrors” (that appears to be a reflector script) accepts continents. Aka “Europe” etc. I do not find any support for that in reflector… anyone knows for sure?

@manuel’s reflector-simple (and -auto) give one that capability with a GUI twist, I don’t think reflector itself has any idea though. I like (and use) the -simple, because it is so easy to try something different ‘on the fly’, whereas I lived with aliases for the task until then…

reflector should accept both country names and country codes, judging by this.

No idea about pacman-mirrors, is it possible to get it outside of Manjaro? :thinking:

reflector supports country names (must be quoted if it contain spaces!) as well as country codes. For example,

  reflector -c "United States" -c UK 
1 Like

Reflector AFAIK does not support the idea of continents.

For Antergos I created an app called reflector-antergos that had a notion of “continents” or “named countrygroups”. But after all that idea didn’t seem so great, so I didn’t support it in reflector-simple nor reflector-auto.

add - commit - push in one go

function acp() {
git add .
git commit -m “latest update”
git push
}

This thread contains so much useful information that I am bookmarking it. This is the real power of ‘Community’.

8 Likes

This item is more of a script than a function, but it seems to me that it fits here better than in a wiki entry! Essentially, it automates the Arch “Wayback Machine” or, as I have called it ShiftTime :grin: What this ‘Machine’ does essentially, is take your system back to the date that you specify - by reverting, or downgrading all the packages that have been updated after that date.

I decided I would try to make the script accessible, so here I will describe setting it up as a button in the Welcome app - although of course it would work fine if just called from the command line. Or, of course, you could carefully read the Archwiki entry on reverting your package status to a previous date, and follow the steps as they describe them.

Essentially, there are 2 pieces to the setup - the script itself, and the .desktop file that describes it. The locations they need to be in may have to be created if they do not already exist:

  1. $ mkdir -p ~/.local/share/applications
    This command will create this directory if it does not already exist. The following .desktop file goes in it - with the name ShiftTime.desktop suggested.
.desktop

[Desktop Entry]
Name=ShiftTime
Comment=Revert pkg state to a previous date.
GenericName=Revert pkg state to a previous date
Exec=RunInTerminal shifttime
Icon=system-software-install
Type=Application
NoDisplay=true
StartupNotify=true
Categories=Utility

  1. Then you create a file called shifttime with the following content:
ShiftTime script
#!/bin/bash
# This script enables an after-the-fact timeshift equivalent for Arch systems
# Give it a date (as in 2020-09-20) and it will use the Arch archive repos 
# to revert to that date's package state.
#
# 21 September 2020 - freebird54

echo "Select the date to revert your packages to. Press ENTER when ready"
read
REVERTDATE=`yad --calendar --date-format=%C%y/%m/%d`
echo " "
echo "Packages will be reverted to the state they were in on $REVERTDATE."
echo " "
echo "Ready to copy /etc/pacman.d/mirrorlist to backup"
sudo mv /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup_st
# building the repo entry for the specified date, and making it the mirrorlist temoporarily
echo "Server=https://archive.archlinux.org/repos/$REVERTDATE/\$repo/os/\$arch"  > /tmp/mirrorlistchk
sudo cp /tmp/mirrorlistchk /etc/pacman.d/mirrorlist
rm /tmp/mirrorlistchk
echo " "
echo "Here is the reversion mirrorlist"
cat /etc/pacman.d/mirrorlist
echo "If the date shown is correct please press ENTER"
read
echo " "
# run the 'downdate' command
sudo pacman -Syyuu
echo " "
echo "Restoring the backup mirrorlist..."
sudo cp /etc/pacman.d/mirrorlist.backup_st /etc/pacman.d/mirrorlist
echo " "
echo "Done. Press ENTER to exit."
read
  1. Make the file executable:
    $ chmod +x shifttime

  2. Copy the file to somewhere on your path:
    $ sudo cp shifttime /usr/bin

  3. Start up the Welcome app, choose the ‘Tips’ tab, and click on the Personal Command drag&drop button - which will open up a window. Open your File Browser, navigate to ~/.local/share/applications, and drag ShiftTime.desktop over to and drop it in the window that Welcome opened up.

  4. That’s it! Once Welcome comes back, it will have a Personal Commands tab (if it didn’t already) and ShiftTime will be waiting for you to click on the button showing its name to run the script. Pacman will be called to determine which packages need to be downgraded to revert your system to the way it was at the date you specified. You can interact with pacman as usual to decide whether or not to proceed with the downgrade. The pacman ‘control’ files that the script modifies will be returned to normal after the modified ones have been used.

Again, this does nothing you could not do directly yourself by following the Archwiki - but it saves typing (or looking it up again) if you happen to need it. This also shows how easy it is to add your own ideas to the buttons on the Welcome app! Essentially, for most things, all you need to do is create an appropriate .desktop file, and drop it in the drag&drop window. Enjoy, and I hope you don’t need it.

11 Likes

A really simple way to perform a full system update including Arch + AUR + Flatpak packages

alias YOUR_ALIAS='yay && flatpak update'

It combines ‘yay’ (that will perform ‘yay -Syu’ wich is similar to pacman -Syu + updating packages from the AUR) and ‘flatpak update’ (wich will update flatpak packages).

1 Like

It might be a good idea to add one thing:

flatpak uninstall --unused

To auto-clean the cache for flatpak since it doesn’t do that automatically. The --unused flag means it will only uninstall old packages no longer in use. So I suggest amending your alias like so:

alias YOUR_ALIAS="yay && flatpak update && flatpak uninstall -unused"

Providing you use flatpak of course :slight_smile:

2 Likes