Command Shortcuts

When I started modifying the original Centmin script for my own needs, the first thing I did was add command shortcuts to Centmin Mod. Normally, to edit server configuration files or start/stop/restart services in SSH2 telnet, you need to type in lengthy commands.

With command shortcuts, if you opted to install them at Centmin Mod installation time, you'll be able to type a one word command to perform the entire action. Of course, the software needs to be installed for command lines to work i.e. memcached or csf need to have been installed. The command shortcuts invokes the nano linux text editor, you can read up more about nano here and here.

Below are a list of command shortcuts:

  • Edit php.ini = phpedit ( /usr/local/lib/php.ini )
  • Edit my.cnf = mycnf ( /etc/my.cnf )
  • Edit php-fpm.conf = fpmconf ( /usr/local/etc/php-fpm.conf )
  • Edit nginx.conf = nginxconf ( /usr/local/nginx/conf/nginx.conf )
  • Edit (nginx) virtual.conf = vhostconf - only edits /usr/local/nginx/conf/conf.d/virtual.conf not the additional vhost domain.com.conf files added later
  • Edit (nginx) php.conf = phpinc ( /usr/local/nginx/conf/php.conf )
  • Edit (nginx) drop.conf = dropinc ( /usr/local/nginx/conf/drop.conf )
  • Edit (nginx) staticfiles.conf = statfilesinc ( /usr/local/nginx/conf/staticfiles.conf )
  • nginx stop/start/restart = ngxstop/ngxstart/ngxrestart
  • php-fpm stop/start/restart = fpmstop/fpmstart/fpmrestart
  • mysql stop/start/restart = mysqlstop/mysqlstart/mysqlrestart
  • nginx + php-fpm stop/start/restart = npstop/npstart/nprestart
  • memcached stop/start/restart = memcachedstop/memcachedstart/memcachedrestart
  • csf stop/start/restart = csfstop/csfstart/csfrestart

Setting shortcut to centmin.sh directory

Centmin Mod command shortcuts use hard coded files in /usr/bin/shortcutname as they are known paths etc. But for normal short cuts you might want to use more common alias command via /root/.bashrc file.

  1. backup contents of /root/.bashrc
  2. then edit /root/.bashrc to add aliases which are short cuts to command line statements you commonly run. One alias line per command. So to change to Centmin Mod centmin.sh directory if it's installed at /usr/local/src/centmin-v1.2.3mod (change directory path for below commands accordingly if you downloaded to different directory) you would type these 2 commands as root user in SSH telnet session.

  alias cmod='pushd /usr/local/src/centminmod/'

  echo "alias cmod='pushd /usr/local/src/centminmod/'" >> /root/.bashrc

Second command adds the alias command (first command) to /root/.bashrc.

I used pushd instead of cd command to change to directory as pushd along with popd are very useful. Read about their usage at http://www.eriwen.com/bash/pushd-and-popd/ and http://linux.101hacks.com/cd-command/dirs-pushd-popd/

To see all your listed and active alias commands type the command below. By default CentOS already has some alias commands set which will also be listed:

  alias