linux文件软链接操作

cd /etc/alternatives

ll php*

lrwxrwxrwx 1 root root 15 Oct 23 15:24 php -> /usr/bin/php7.3*
lrwxrwxrwx 1 root root 31 Oct 23 15:00 php.1.gz -> /usr/share/man/man1/php7.3.1.gz

 删除软链接,相当删除win下的快捷方式

rm -rf php

 快捷方式删除、但/usr/bin/php7.3文件不删除

ll
lrwxrwxrwx 1 root root 31 Oct 23 15:00 php.1.gz -> /usr/share/man/man1/php7.3.1.gz

ll /usr/bin/php*
lrwxrwxrwx 1 root root      21 Oct 23 15:00 /usr/bin/php -> /etc/alternatives/php*
-rwxr-xr-x 1 root root 4488224 Sep  2 22:08 /usr/bin/php5.6*
-rwxr-xr-x 1 root root 4704192 Oct  8 14:29 /usr/bin/php7.3*

 建立php5.6的快捷方式

ln -s /usr/bin/php5.6 php
ll php*

lrwxrwxrwx 1 root root 15 Oct 23 15:24 php -> /usr/bin/php5.6*
lrwxrwxrwx 1 root root 31 Oct 23 15:00 php.1.gz -> /usr/share/man/man1/php7.3.1.gz
root@iZwz93telmwbh624e5zetqZ:/etc/alternatives# php -v
PHP 5.6.40-12+ubuntu16.04.1+deb.sury.org+1 (cli)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
    with Xdebug v2.5.5, Copyright (c) 2002-2017, by Derick Rethans
 

猜你喜欢

转载自www.cnblogs.com/hnhycnlc888/p/11727221.html