Creating symbolic link in linux for PHP which is installed via Xampp

sudo ln -s /opt/lampp/bin/php /usr/bin/php

This command creates a symbolic link (or shortcut) named php in the /usr/bin directory that points to the actual PHP binary file located in the /opt/lampp/bin directory.

Here is a breakdown of what each part of the command does:

  • sudo: This is a command that allows the user to execute a command with elevated privileges. In other words, it allows the user to execute the command as a superuser or administrator.
  • ln: This is the command that creates symbolic links (also known as soft links) between files or directories.
  • -s: This option specifies that we want to create a symbolic link.
  • /opt/lampp/bin/php: This is the path to the actual PHP binary file that we want to create a symbolic link to.
  • /usr/bin/php: This is the path where we want to create the symbolic link named php.

Therefore, by executing this command, we create a shortcut to the actual PHP binary file that can be accessed from anywhere on the system by simply running the command php. This can be useful for running PHP scripts or applications that require the PHP interpreter.

`find` comamnd in linux – part1


Not only you should be able to find files with specific string but also find based on type, empty, size, permission and more..

Once we find the files we should be able to execute linux commands on each and every result we got.

Following is the sample of find command explains what it can do.

find . -name “*.txt” -empty -type f -exec rm -rf {} \;

Explanition of above command

`find`     -> command

`.`            -> current directory, which means it is going to look in current directory and all subdirectories.

`-name`  -> mention the search specifications(you can write meta charectors also regular experssion) which you want look for, here look for all `.txt` files (*.txt)

`-empty` -> looking for only empty files which means it will ignore all “*.txt” files which contain any text in them.

`-type`      -> looking for only files(-f) but not folders, even though above specification(*.txt) narrow our search pretty much to files but it still good practice to mention type as well if are planning to search for only files but not folders with the search specification.

-exec -> this option will help you to execute any commands on each result of command till `-type -f`, you need to follow specific format to make sure it runs properly which is (-exec `any command` {} \), here in above example we have used remove command. In this format flower bracket kind of represent object which will store the result from the command till `type- f` and run the command for each result of the object.