Learn about Centmin Mod LEMP Stack today
Register Now

Sysadmin Yum update shortcut

Discussion in 'System Administration' started by BamaStangGuy, Apr 6, 2017.

  1. BamaStangGuy

    BamaStangGuy Premium Member Premium Member

    649
    187
    43
    May 25, 2014
    Ratings:
    +262
    Local Time:
    1:25 AM
    How can I make a shortcut to this command:

    Code:
    yum update -y --disableplugin=priorities --enablerepo=remi,city-fan.org
    in a similar way that ngxrestart is a shortcut?

    Something like pkgupdate or whatever.
     
  2. Sunka

    Sunka Well-Known Member

    1,140
    312
    83
    Oct 31, 2015
    Pula, Croatia
    Ratings:
    +508
    Local Time:
    8:25 AM
    Nginx 1.17.9
    MariaDB 10.3.22
    Maybe create alias for that?
    Code (Text):
    alias pkgupdate='yum update -y --disableplugin=priorities --enablerepo=remi,city-fan.org'
     
  3. eva2000

    eva2000 Administrator Staff Member

    44,426
    10,144
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,696
    Local Time:
    4:25 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    yum cmd aliases

    i.e.
    Code (Text):
    alias
    alias acme.sh='/root/.acme.sh/acme.sh'
    alias cmdir='pushd /usr/local/src/centminmod'
    alias cp='cp -i'
    alias egrep='egrep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias grep='grep --color=auto'
    alias l.='ls -d .* --color=auto'
    alias ll='ls -l --color=auto'
    alias ls='ls --color=auto'
    alias mv='mv -i'
    alias postfixlog='pflogsumm -d today --verbose_msg_detail /var/log/maillog'
    alias pwdh='echo -n "$HOSTNAME"; echo " $PWD"'
    alias rm='rm -i'
    alias top2='glances'
    alias wget='/usr/local/bin/wget'
    alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
     
  4. BamaStangGuy

    BamaStangGuy Premium Member Premium Member

    649
    187
    43
    May 25, 2014
    Ratings:
    +262
    Local Time:
    1:25 AM
    Will this survive a reboot?
     
  5. eva2000

    eva2000 Administrator Staff Member

    44,426
    10,144
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,696
    Local Time:
    4:25 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    from linked alias guides, aliases only survive reboots if placed in ~/.bashrc

    i.e. ~/.bashrc
    Code (Text):
    cat ~/.bashrc | grep alias
    # User specific aliases and functions
    alias rm='rm -i'
    alias cp='cp -i'
    alias mv='mv -i'
    alias wget='/usr/local/bin/wget'
    alias pwdh='echo -n "$HOSTNAME"; echo " $PWD"'
    alias postfixlog='pflogsumm -d today --verbose_msg_detail /var/log/maillog'
    alias top2="glances"
    alias cmdir='pushd /usr/local/src/centminmod'
    
     
  6. BamaStangGuy

    BamaStangGuy Premium Member Premium Member

    649
    187
    43
    May 25, 2014
    Ratings:
    +262
    Local Time:
    1:25 AM
    I guess I am confused on how the ones in CentminMod exist since I can't see them anywhere?
     
  7. eva2000

    eva2000 Administrator Staff Member

    44,426
    10,144
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,696
    Local Time:
    4:25 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    centmin mod command shortcuts are actual files not aliases :)
    Code (Text):
    cat /usr/bin/ngxrestart
    service nginx restart
     
  8. Sunka

    Sunka Well-Known Member

    1,140
    312
    83
    Oct 31, 2015
    Pula, Croatia
    Ratings:
    +508
    Local Time:
    8:25 AM
    Nginx 1.17.9
    MariaDB 10.3.22
    just add that command into .bashrc for root user or in user directory (if not root), and like eva said, it will be permanent alias
    Code (Text):
    nano /root/.bashrc

    Code (Text):
    alias pkgupdate='yum update -y --disableplugin=priorities --enablerepo=remi,city-fan.org'
     
  9. eva2000

    eva2000 Administrator Staff Member

    44,426
    10,144
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,696
    Local Time:
    4:25 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    with command aliases you can also make shortcuts to command nginx vhost specific tasks i.e.
    Code (Text):
    alias v1conf='nano -w /usr/local/nginx/conf/conf.d/domain.com.conf'
    alias v1sconf='nano -w /usr/local/nginx/conf/conf.d/domain.com.ssl.conf'
    alias v1log='pushd /home/nginx/domains/domain.com/log'
    alias v1pub='pushd /home/nginx/domains/domain.com/public'
    alias v1sdir='pushd /usr/local/nginx/conf/ssl/domain.com'
    

    typing:
    • v1conf invokes nano to edit domain.com.conf vhost file
    • v1sconf invokes nano to edit domain.com.ssl.conf vhost file
    • v1log changes to domain.com's log directory
    • v1pub changes to domain.com web root at public
    • v1sdir changes to domain.com's ssl/domain.com directory containing ssl cert files