r/voidlinux • • Jul 09 '21

Rate my aliases

Post image
93 Upvotes

18 comments sorted by

25

u/Puzzleheaded_Swan_74 Jul 09 '21

maybe i'd change xi alias because it is already provided by xtools package which contains useful commands regarding xbps-src and xbps. https://github.com/leahneukirchen/xtools

17

u/iwahkas Jul 09 '21

Some will interfere with xtools

5

u/No-Command-791 Jul 09 '21

Not bad. I'd recommend adding aliases for xbps-query -Rs and -s as well.

3

u/bluesecurity Jul 09 '21

shorter than vpm... but I'm happy with vpm for now

3

u/hirekb Jul 10 '21

Aliases are nice but completion is also nice :/

3

u/[deleted] Jul 10 '21 edited Jul 10 '21

As people keep saying, and it is true, it interferes with xtools. Also, it makes no sense to alias xi as xbps-install when you should just map it as xbps-install -S. Granted, I suppose that might could cause dependency issues, technically, but I haven't had an issue with it.

I, though I don't use it, have a system of platform-agnostic aliases I use and have them aliased based on what is available in /bin:

  • distupgrade - Upgrades all available packages

  • force - Reinstall

  • install - Install packages (conflicts with the most useless piece of junk in /usr/bin; I hate the install command, just use cp and mkdir -p and stop being lazy. I have seen so many missuses of install.)

  • o66 - Delete all orphan-packages (shorthand)

  • order66 - Same as above

  • query - Get information about a package

  • search - Search repo for packages descriptions/names

  • show - list all available packages

  • update - Refresh package database

  • upgrade - Upgrade selected package

I use Void primarily, so I have these set to the various XBPS utilities by default. However, if that isn't found, then it will check to see if pacman, apt, pkg (FreeBSD package manager), pkg_{add,info,delete,etc} (OpenBSD package manager utilities), dnf, etc. are available.

What I will probably do, though, is just take time, find all things I might use, and write a script to put on whatever system, call it pkg and put it in /usr/local/bin and just let it be an intermediary between whatever native tools there are.

It would be very satisfying to type in:

% pkg exec-o66

I know I personally, I don't uninstall packages too often. No matter how good the package manager is or how questionable, I have always had dependency issues when uninstalling junk. So I try to think long and hard about what I want to install and try it in a VM first. This is just for me, but I am happy Rocky Linux is now a thing, but I am not sure if I want to migrate my home server over OpenSUSE or Rocky. And if I go open SUSE, Zypper can't uninstall packages. But that is okay, really. It isn't hard to keep track of what you installed and just tell it to delete that. But you gotta keep good practice.

1

u/[deleted] Jul 09 '21

I need to adopt these xD

1

u/JJGadgets Jul 09 '21

Why not just have xisu as xu? The function is to update all packages anyway, so the “is” for install isn’t really necessary imo.

I also have xss aliased to sudo xbps-query -Rs to search for packages in the repository.

Other than that, nice.

1

u/FPiN9XU3K1IT Jul 09 '21

7/10. TIL you can show all aliases with alias, which is way more convenient than cat .bash_aliases (doesn't even autocomplete until you typed in more than half!).

1

u/[deleted] Jul 10 '21

Hi I would have preferred a code post so I could copy and paste but thanks for tips

1

u/cruvus Jul 10 '21

Ive been wanting to this, can I change it to 'pkg add deadbeef pkg update deadbeef etc'.? I dont see why every distro has to put zypper or xbps when pkg is the correct way lol.. 6/10 at least those are shorter

1

u/LonelyPassion Jul 23 '21

alias xbps-install="sudo xbps-install -Sy"

simple

1

u/Derivates7 Jul 27 '21

i agree with others about them interfering with xtools, this is what i use btw:

# arch-based
if test -x "`command -v 'pacman'`"; then
    alias \
        pkgf='pacman -Ss' \
        pkgi="sudo pacman --needed -Suy 'pacman' && sudo pacman -S" \
        pkgr='sudo pacman -Rns' \
        pkgu="sudo pacman --needed -Suy 'pacman' && sudo pacman -Suyy"

# void
elif test -x "`command -v 'xbps-install'`"; then
    alias \
        pkgf='xbps-query' \
        pkgi="sudo xbps-install -S 'xbps' && sudo xbps-install -S" \
        pkgr='sudo xbps-remove -Rf' \
        pkgu="sudo xbps-install -S 'xbps' && sudo xbps-install -Su"
fi

1

u/backtickbot Jul 27 '21

Fixed formatting.

Hello, Derivates7: code blocks using triple backticks (```) don't work on all versions of Reddit!

Some users see this / this instead.

To fix this, indent every line with 4 spaces instead.

FAQ

You can opt out by replying with backtickopt6 to this comment.

1

u/Impressive_Reality61 Aug 08 '21

For me useless, with the autocompletion with bash and tab, it’s not necessary

1

u/0ct0pu Jul 10 '21 edited Jul 10 '21

How hard is it to remember xbps-* commands instead of learning random 2 character aliases? Using your computer isn't a race, so saving a few keystrokes is not really necessary.

The xbps-* commands are longer, but they are also very powerful. While aliases don't remove the ability to just add some options, it might be confusing.

If you have multiple Linux systems and ssh between them, you will be confused where which aliases work or you will have to make sure your dotfiles are distributed everywhere (which can be painful, in some cases not even possible). If you login to root, all aliases will be gone (again, if you don't pay extra attention to that). Also, you will lose command completion (again, if you don't pay extra attention to that).

I use xi from xtools when I want to use the features it provides that xbps-install doesn't (automatic detection of local repositories). xbps-install still makes sense for me when I want to only use remote repositories. I also have xs aliased to fuzzypkg, but I probably wouldn't alias it to xbps-query -Rs.

0

u/NewAcanthocephala700 Jul 10 '21

Sounds familiar. Luke (smooth) smith also uses it.