1

For starting xampp i need to run below command.

sudo /opt/lampp/xampp start

Problem is:

I don't like to write /opt/lampp/xampp

Need Solution like:

sudo xampp start
  • want only xampp command instead of /opt/lampp/xampp.

1 Answers1

4

Please Use any single method, Both Methods are working correctly.

Method 1 : create symlink

You need to create xampp's symlink which will call /opt/lampp/xampp. To do that, run:

sudo ln -s /opt/lampp/xampp /usr/local/bin
  • This command will create xampp's symlink in /usr/local/bin folder.
  • Now terminal would be able to recognise xampp command as /opt/lampp/xampp.
  • You can run sudo xampp command now. :)

Method 2 : add command in shell file.

You need to create xampp's alias which will call /opt/lampp/xampp. To do that,

note : you can check your default shell using echo $SHELL command.

condition 1 : bash shell

nano .bashrc

add below line in bottom of .bashrc.

# Custom alias
alias xampp='sudo /opt/lampp/xampp'

enter image description here

  • then save it using Ctrl + s and Ctrl + x
  • now run below command :
source ~/.bashrc
  • You can run sudo xampp command now. :)

condition 2 : zsh shell

nano .zshrc

add below line in bottom of .zshrc.

# Custom alias
alias xampp='sudo /opt/lampp/xampp'

enter image description here

  • then save it using Ctrl + s and Ctrl + x
  • now run below command :
source ~/.zshrc
  • You can run sudo xampp command now. :)

Output after using any of single method.

xampp status