最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Linux鏈接命令的實(shí)例詳解

 更新時間:2017年08月30日 11:23:42   投稿:lqh  
這篇文章主要介紹了Linux鏈接命令的實(shí)例詳解的相關(guān)資料,希望通過本文大家能掌握Linux鏈接命令的使用方法,需要的朋友可以參考下

Linux鏈接命令的實(shí)例詳解

一 語法

ln -s [源文件] [目標(biāo)文件]
命令英文含義:link
功能描述:生成鏈接文件
選項(xiàng):-s 創(chuàng)建軟鏈接 

二 硬鏈接特征

原文件和硬鏈接文件刪除其中任何一個都沒問題。

三 硬鏈接實(shí)戰(zhàn)

[root@localhost ~]# cd test
[root@localhost test]# ls
bcd
[root@localhost test]# ln bcd abc.hard
[root@localhost test]# ll
total 0
-rw-r--r--.2 root root 0Jul1219:31 abc.hard
-rw-r--r--.2 root root 0Jul1219:31 bcd
[root@localhost test]# vi bcd
[root@localhost test]# cat abc.hard 
qwer 
[root@localhost test]# echo "dfd">> abc.hard 
[root@localhost test]# cat bcd 
qwer 
dfd
[root@localhost test]# ls -i
67170460 abc.hard 67170460 bcd
[root@localhost test]# rm bcd 
rm: remove regular file ?.cd?. y
[root@localhost test]# cat abc.hard 
qwer 
dfd
[root@localhost test]# ll -i
total 4
67170460-rw-r--r--.1 root root 10Jul1220:39 abc.hard

 四 軟鏈接特征

1、把原文件刪除,軟鏈接文件無法使用。

2、雖然軟鏈接文件的權(quán)限是777,但真正的權(quán)限還是由原文件決定。

3、創(chuàng)建軟鏈接時,如果原文件和目標(biāo)文件在一個目錄下,不用寫絕對路徑,否則原文件和目標(biāo)文件必須寫絕對路徑。所以原文件一定要寫絕對路徑。

五 實(shí)戰(zhàn)

[root@localhost test]# ls
abc
[root@localhost test]# ln -s abc abc.soft
[root@localhost test]# ll
total 0
-rw-r--r--.1 root root 0Jul1220:42 abc
lrwxrwxrwx.1 root root 3Jul1220:55 abc.soft -> abc
[root@localhost test]#in abc abc.hard
-bash: syntax error near unexpected token `in'
[root@localhost test]# ln abc abc.hard
[root@localhost test]# ll
total 0
-rw-r--r--. 2 root root 0 Jul 12 20:42 abc
-rw-r--r--. 2 root root 0 Jul 12 20:42 abc.hard
lrwxrwxrwx. 1 root root 3 Jul 12 20:55 abc.soft -> abc
[root@localhost test]# ls -i
67170460 abc 67170460 abc.hard 67170462 abc.soft
[root@localhost test]# echo 111 >>abc
[root@localhost test]# cat abc.soft 
111
[root@localhost test]# cat abc.hard 
111
[root@localhost test]# echo 222 >> abc.soft 
[root@localhost test]# cat abc
111
222
[root@localhost test]# cat abc.soft 
111
222
[root@localhost test]# rm -rf abc
[root@localhost test]# ll
total 4
-rw-r--r--. 1 root root 8 Jul 12 20:59 abc.hard
lrwxrwxrwx. 1 root root 3 Jul 12 20:55 abc.soft -> abc
[root@localhost test]# cat abc.hard 
111
222
[root@localhost test]# rm -rf abc.soft 
[root@localhost test]# ll
total 4
-rw-r--r--. 1 root root 8 Jul 12 20:59 abc.hard
[root@localhost test]# touch abc
[root@localhost test]# ln -s abc.soft
[root@localhost test]# ls
abc abc.hard abc.soft
[root@localhost test]# ll -i
total 4
67170462 -rw-r--r--. 1 root root 0 Jul 12 21:01 abc
67170460 -rw-r--r--. 1 root root 8 Jul 12 20:59 abc.hard
67170463 lrwxrwxrwx. 1 root root 8 Jul 12 21:01 abc.soft -> abc.soft
[root@localhost test]# rm -rf *
[root@localhost test]# ll
total 0
[root@localhost test]# touch abc
[root@localhost test]# ln -s abc abc.soft
[root@localhost test]# ll
total 0
-rw-r--r--. 1 root root 0 Jul 12 21:05 abc
lrwxrwxrwx. 1 root root 3 Jul 12 21:05 abc.soft -> abc
[root@localhost test]# ln -s abc /tmp/ab.soft
[root@localhost test]# ll /tmp
total 0
lrwxrwxrwx. 1 root root 3 Jul 12 21:06 ab.soft -> abc
drwxr-xr-x. 3 root root 16 Jul 12 19:33 japan
[root@localhost test]# ll /tmp
total 0
lrwxrwxrwx. 1 root root 3 Jul 12 21:06 ab.soft -> abc
drwxr-xr-x. 3 root root 16 Jul 12 19:33 japan
[root@localhost test]# rm -rf /tmp/ab.soft
[root@localhost test]# ln -s /root/test/abc /tmp/ab.soft
[root@localhost test]# ll /tmp
total 0
lrwxrwxrwx. 1 root root 14 Jul 12 21:08 ab.soft -> /root/test/abc
drwxr-xr-x. 3 root root 16 Jul 12 19:33 japan

六 硬鏈接和軟鏈接文件訪問示意圖

以上就是Linux鏈接命令的詳解,如有疑問請留言或者到本站社區(qū)交流討論,感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!

相關(guān)文章

最新評論

崇文区| 晋中市| 壤塘县| 鄂托克旗| 札达县| 秦皇岛市| 凌海市| 天津市| 宿州市| 霞浦县| 科技| 故城县| 崇明县| 马鞍山市| 明光市| 临武县| 永丰县| 太保市| 贡山| 湘阴县| 房产| 岳阳县| 潼关县| 玉环县| 香河县| 金门县| 平陆县| 平定县| 汤阴县| 健康| 七台河市| 汽车| 汤阴县| 玉溪市| 黔西| 信阳市| 阳新县| 阳江市| 太谷县| 连南| 开原市|