Linux下 ln -s 軟連結用法

tolywang發表於2008-01-09

NAME
ln - make links between files

SYNOPSIS
ln [OPTION]... TARGET [LINK_NAME]
ln [OPTION]... TARGET... DIRECTORY
ln [OPTION]... --target-directory=DIRECTORY TARGET...

軟連結用法是: ln -s 實際存在的目標目錄 連結名稱(不存在的) 。

[root@DMDIDATAGUARD /]# cd /data
[root@DMDIDATAGUARD data]# ls
lost+found ocfs_arch1 ocfs_ctrl_redo ocfs_data ocfs_data2 ocfs_index oracle.dba
[root@DMDIDATAGUARD data]# ls -alh
total 48K
drwxr-xr-x 9 oracle dba 4.0K Jan 9 14:30 .
drwxr-xr-x 22 root root 4.0K Jan 9 14:34 ..
drwx------ 2 oracle dba 16K Jan 9 10:31 lost+found
drwxr-xr-x 2 oracle dba 4.0K Jan 9 14:30 ocfs_arch1
drwxr-xr-x 2 oracle dba 4.0K Jan 9 14:30 ocfs_ctrl_redo
drwxr-xr-x 2 oracle dba 4.0K Jan 9 14:30 ocfs_data
drwxr-xr-x 2 oracle dba 4.0K Jan 9 14:30 ocfs_data2
drwxr-xr-x 2 oracle dba 4.0K Jan 9 14:30 ocfs_index
drwxr-xr-x 2 oracle dba 4.0K Jan 9 14:30 oracle.dba

[@more@][root@DMDIDATAGUARD /]# ln -s /data/ocfs_data /ocfs_data
[root@DMDIDATAGUARD /]#
[root@DMDIDATAGUARD /]# ls -alh
total 217K
drwxr-xr-x 22 root root 4.0K Jan 9 14:34 .
drwxr-xr-x 22 root root 4.0K Jan 9 14:34 ..
-rw-r--r-- 1 root root 0 Jan 9 14:18 .autofsck
drwxr-xr-x 2 root root 4.0K Jan 8 03:56 bin
drwxr-xr-x 4 root root 1.0K Jan 8 04:00 boot
drwxr-xr-x 9 oracle dba 4.0K Jan 9 14:30 data
drwxr-xr-x 22 root root 116K Jan 9 14:18 dev
drwxr-xr-x 68 root root 8.0K Jan 9 14:18 etc
drwxr-xr-x 6 root root 4.0K Jan 8 05:47 home
drwxr-xr-x 2 root root 4.0K Jan 25 2003 initrd
drwxr-xr-x 11 root root 4.0K Jan 8 03:55 lib
drwx------ 2 root root 16K Jan 8 11:52 lost+found
drwxr-xr-x 2 root root 4.0K Aug 25 2005 misc
drwxr-xr-x 6 root root 4.0K Jan 8 04:00 mnt
lrwxrwxrwx 1 root root 15 Jan 9 14:34 ocfs_data -> /data/ocfs_data
drwxr-xr-x 3 root root 4.0K Jan 8 18:35 opt
dr-xr-xr-x 59 root root 0 Jan 9 14:17 proc
drwxr-x--- 13 root root 4.0K Jan 9 14:00 root
drwxr-xr-x 2 root root 8.0K Jan 8 03:56 sbin
drwxr-xr-x 3 root root 4.0K Jan 8 03:56 tftpboot
drwxrwxrwt 10 root root 4.0K Jan 9 14:18 tmp
drwxr-xr-x 5 oracle dba 4.0K Jan 8 18:11 u01
drwxr-xr-x 16 root root 4.0K Jan 8 03:52 usr
drwxr-xr-x 24 root root 4.0K Jan 8 03:56 var

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/35489/viewspace-996995/,如需轉載,請註明出處,否則將追究法律責任。

相關文章