Linux下面究竟什么是symbolic link, 怎样创建一个symbolic link
2011-04-21 11:46
465 查看
A symbolic link, also termed a soft link, is a special kind of file that points to another file, much like a shortcut in Windows or a Macintosh alias. Unlike a hard link, a symbolic link does not contain the data in the target file. It simply points to another entry somewhere in the file system. This difference gives symbolic links certain qualities that hard links do not have, such as the ability to link to directories, or to files on remote computers networked through NFS. Also, when you delete a target file, symbolic links to that file become unusable, whereas hard links preserve the contents of the file.
To create a symbolic link in Unix, at the Unix prompt, enter the following command:
ln -s source_file myfile
Replace
Note: If you delete the source file or move it to a different location, your symbolic file will not function properly. You should either delete or move it. If you try to use it for other purposes (e.g., if you try to edit or execute it), the system will send a "file nonexistent" message.
To create a symbolic link in Unix, at the Unix prompt, enter the following command:
ln -s source_file myfile
Replace
source_filewith the name of the existing file for which you want to create the symbolic link (this file can be any existing file or directory across the file systems). Replace
myfilewith the name of the symbolic link. The
lncommand then creates the symbolic link. After you've made the symbolic link, you can perform an operation on or execute
myfile, just as you could with the
source_file. You can use normal file management commands (e.g.,
cp,
rm) on the symbolic link.
Note: If you delete the source file or move it to a different location, your symbolic file will not function properly. You should either delete or move it. If you try to use it for other purposes (e.g., if you try to edit or execute it), the system will send a "file nonexistent" message.
相关文章推荐
- Linux下面究竟什么是symbolic link, 怎样创建一个symbolic link
- Linux下面究竟什么是symbolic link, 怎样创建一个symbolic link
- Linux中想进入一个目录、 在目录下创建文件、在文件内部删除文件 各需要什么权限?
- Linux中想进入一个目录、 在目录下创建文件、在文件内部删除文件 各需要什么权限?
- Linux 下创建一个文件,打开一个目录需要什么权限呢?
- Linux中想进入一个目录、 在目录下创建文件、在文件内部删除文件 各需要什么权限?
- linux下面怎样让给一个用户添加对指定文件夹写的权力
- 怎样不使用Useradd在linux下创建一个新的用户
- linux中进入一个目录需要什么权限,在目录下创建文件需要什么权限
- Linux -->在目录内创建文件、显示文件以及拷贝文件到一个目录都需要什么权限?
- 本文一个例子展开,介绍Linux下面线程的操作、多线程的同步和互斥
- Linux下如何手动创建一个帐户
- 【linux】 linux 下怎样查找一个文件夹在哪个目录下
- 平时我们常常说先做出一个原型系统,那么究竟什么是原型呢?
- 怎样创建一个Xcode插件(part 1)
- python: 怎样写一个函数把名字大写并变成下面这样——字典与三引号
- linux下面在查找文件到时候-prune掉一个文件夹
- Linux里的2>&1究竟是什么
- 修改initrd,创建一个微型的linux系统
- (转)作为一个新人,怎样学习嵌入式Linux?(韦东山)