0

I'm searching through a ton of packages between a vm and host to see which package is causing text input issues for steam. I frequently need to check for and install packages on the guest machine and it would be helpful to have one for alias pacman='sudo pacman -Syu', while also needing one for alias pacman='pacman -Qi'also.

I've tried:

alias pacman_qi='\pacman -Qi'
unalias pacman
alias pacman='sudo pacman -Syu'

to no avail. How may I write an rc file, which allows for both pacman and pacman_qi variations, without having to use sudo in pacman_qi? I'm trying to avoid having to input my password for pacman_qi, currently I would.

closed as unclear what you're asking by Stephen Harris, G-Man, Mr Shunz, Thomas, Gilles Jan 12 at 18:36

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    Since you're already using sudo, how about adding a new entry with the pacman command and the NOPASSWD option? That should prevent the password prompt from appearing. – Haxiel Jan 12 at 4:37
  • How would I input that to a bashrc? – ZeroPhase Jan 12 at 4:45
  • 2
    It's not a user-level configuration, so bashrc will not work. You'd have to modify the system's sudoers file. You can check this question for the details: unix.stackexchange.com/q/18830/173368 – Haxiel Jan 12 at 5:30
  • I'm not sure I'd want pacman running without sudo. Yeah, for this I could do that. I would like to find an alias I could use in my personal rc file, as well. Just in case there is a means of scripting Bash, like that. But thanks, that's a useful backup and a good use for other use cases. – ZeroPhase Jan 12 at 7:15
  • 1
    Can‘t you just give a specific name to the second alias as well? pacman_syu for instance. Tab completion works with aliases, so there isn’t too much additional typing. – nohillside Jan 12 at 7:34
-1

I test similar in Ubuntu. You can create a symlink and assign an alias to

ln -s n1 $(which nano)
alias nano2='nano -z'
alias nano1='./n1 -c'

The symlink should be in your PATH.

Not the answer you're looking for? Browse other questions tagged or ask your own question.