Linux command alias and ln (alias and link command) usage

Source: Internet
Author: User
Tags aliases install php egrep

The alias command is used to set the name of the directive. We can use this command to simplify some of the longer commands. When using alias, the user must use single quotes ' to cause the original command to prevent special characters from causing an error

Today encountered a problem, I use the Yum way to install the PHP7 environment, including Nginx, PHP-FPM and so on, using the Remi Source, installation was successful, but the PHP Global environment variable is PHP70, that is, in the terminal originally command PHP is available, it must now be PHP It's 70.

directive: Alias

Set an alias for a directive

Syntax: # alias name= ' command line '

Parameters:
-P: Print aliases that appear (unique parameters)
If you do not add any arguments, list all current alias settings

Example: ermao@lost-desktop:~$ alias
Alias egrep= ' Egrep--color=auto '
Alias fgrep= ' Fgrep--color=auto '
Alias grep= ' grep--color=auto '
Alias l= ' LS-CF '
Alias La= ' Ls-a '
Alias Ll= ' Ls-alf '
Alias ls= ' ls--color=auto '
Description: User can use alias, custom instruction aliases. If you only enter an alias, you can list all current alias settings. The alias's effect only extends to the operation of the login. To automatically set an alias every time you log in, you can set an alias for the directive in/etc/profile or your own ~/.BASHRC.


Because you do not compile the installation, the Yum install installation of PHP, the way to change the file is not very good, here is useful to Linux command alias, execute the alias command:


[Root@iz94r80gdghz ~]# alias php= ' Php70 '
[Root@iz94r80gdghz ~]# PHP

So the PHP command can be used.

Another problem encountered, the use of composer, composer installation is correct, separate PHP composer.phar no problem, set it as a global call, in other directory input composer command, prompted the following error:

[Root@iz94r80gdghz bin]# composer

/usr/bin/env:php: No file or directory

This should be because composer default that PHP is installed in the/usr/local/bin/php path, but this Remi source of PHP is not the case, but there is a way to link the directory through the form of soft links.


[Root@iz94r80gdghz bin]# ln-s/usr/bin/php70/usr/local/bin/php
[Root@iz94r80gdghz bin]# composer

In this way, it can be used normally. This is also the use of Remi Source to install PHP encountered pits, or own hands-on compile installation more reliable.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.