From 5bae805c35115513070a1122fff02c3a92c7f0b7 Mon Sep 17 00:00:00 2001 From: HALO Feng <289716347@qq.com> Date: Mon, 23 Sep 2019 01:30:13 +0800 Subject: [PATCH] translated --- ...Remove (Delete) Symbolic Links in Linux.md | 142 ------------------ ...Remove (Delete) Symbolic Links in Linux.md | 142 ++++++++++++++++++ 2 files changed, 142 insertions(+), 142 deletions(-) delete mode 100644 sources/tech/20190921 How to Remove (Delete) Symbolic Links in Linux.md create mode 100644 translated/tech/20190921 How to Remove (Delete) Symbolic Links in Linux.md diff --git a/sources/tech/20190921 How to Remove (Delete) Symbolic Links in Linux.md b/sources/tech/20190921 How to Remove (Delete) Symbolic Links in Linux.md deleted file mode 100644 index 9484823bd9..0000000000 --- a/sources/tech/20190921 How to Remove (Delete) Symbolic Links in Linux.md +++ /dev/null @@ -1,142 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (arrowfeng) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to Remove (Delete) Symbolic Links in Linux) -[#]: via: (https://www.2daygeek.com/remove-delete-symbolic-link-softlink-linux/) -[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) - -How to Remove (Delete) Symbolic Links in Linux -====== - -You may have the opportunity to create or remove symbolic links on Linux. - -If yes, do you know how to do it? - -Have you already done that? Are you aware of that? - -If yes then there is no problem. If not, don’t worry, we are here to help you with this. - -This can be done using the rm and unlink commands. - -### What is Symbolic Link? - -A symbolic link, also known as a symlink or soft link, is a special type of file that points to another file or directory in Linux. - -It’s similar to a shortcut in Windows. - -It can point to a file or a directory on the same or a different filesystem or partition. - -In general Symbolic links are used to link libraries. Also, used to link log files and folders on mounted NFS (Network File System) shares. - -### What is rm Command? - -The **[rm command][1]** is used to remove files or directories. This is very dangerous and be cautious every time you use the rm command. - -### What is unlink Command? - -The unlink command is used to remove the specified file. It is already installed as it is part of the GNU Gorutils. - -### 1) How to Remove Symbolic Link Files Using the rm Command - -The rm command is one of the most frequently used commands in Linux. Furthermore, it allows us to remove the symbolic links as described below. - -``` -# rm symlinkfile -``` - -Always use the rm command with the “-i” switch to understand what is being done. - -``` -# rm -i symlinkfile1 -rm: remove symbolic link ‘symlinkfile1’? y -``` - -It also allows us to remove multiple symbolic links at once. - -``` -# rm -i symlinkfile2 symlinkfile3 - -rm: remove symbolic link ‘symlinkfile2’? y -rm: remove symbolic link ‘symlinkfile3’? y -``` - -### 1a) How to Remove Symbolic Link Directories Using the rm Command - -This is like removing a symbolic link file. - -Use the below command to remove Symbolic Link directory. - -``` -# rm -i symlinkdir - -rm: remove symbolic link ‘symlinkdir’? y -``` - -Use the below command to remove multiple Symbolic Link directory. - -``` -# rm -i symlinkdir1 symlinkdir2 - -rm: remove symbolic link ‘symlinkdir1’? y -rm: remove symbolic link ‘symlinkdir2’? y -``` - -If you add _**“/”**_ trailing slash at the end, the symbolic link directory cannot be deleted. If you add, you get an error. - -``` -# rm -i symlinkdir/ - -rm: cannot remove ‘symlinkdir/’: Is a directory -``` - -You may need to add the **“-r”** switch to deal with the above problem. If you add this, it will delete the contents of the target directory, while it will not delete the symbolic link directory. - -``` -# rm -ri symlinkdir/ - -rm: descend into directory ‘symlinkdir/’? y -rm: remove regular file ‘symlinkdir/file4.txt’? y -rm: remove directory ‘symlinkdir/’? y -rm: cannot remove ‘symlinkdir/’: Not a directory -``` - -### 2) How to Remove Symbolic Links Using the unlink Command - -The unlink command deletes a given file. It accepts only a single file at a time. - -To delete symbolic link file - -``` -# unlink symlinkfile -``` - -To delete symbolic link directory - -``` -# unlink symlinkdir2 -``` - -If you append the _**“/”**_ trailing slash at the end, you cannot remove the symbolic link directory using the unlink command. - -``` -# unlink symlinkdir3/ - -unlink: cannot unlink ‘symlinkdir3/’: Not a directory -``` - --------------------------------------------------------------------------------- - -via: https://www.2daygeek.com/remove-delete-symbolic-link-softlink-linux/ - -作者:[Magesh Maruthamuthu][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.2daygeek.com/author/magesh/ -[b]: https://github.com/lujun9972 -[1]: https://www.2daygeek.com/linux-remove-files-directories-folders-rm-command/ diff --git a/translated/tech/20190921 How to Remove (Delete) Symbolic Links in Linux.md b/translated/tech/20190921 How to Remove (Delete) Symbolic Links in Linux.md new file mode 100644 index 0000000000..ae63aaf0d6 --- /dev/null +++ b/translated/tech/20190921 How to Remove (Delete) Symbolic Links in Linux.md @@ -0,0 +1,142 @@ +[#]: collector: (lujun9972) +[#]: translator: (arrowfeng) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Remove (Delete) Symbolic Links in Linux) +[#]: via: (https://www.2daygeek.com/remove-delete-symbolic-link-softlink-linux/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +在 Linux 中怎样移除(删除)符号链接 +====== + +你可能有时需要在 Linux 上创建或者删除符号链接。 + +如果有,你知道该怎样做吗? + +之前你做过吗?你踩坑没有? + +如果你踩过坑,那没什么问题。如果还没有,别担心,我们将在这里帮助你。 + +使用 rm 和 unlink 命令就能完成移除(删除)符号链接的操作。 + +### 什么是符号链接? + +符号链接又称 symlink 或者 软链接,它是一种特殊的文件类型,在 Linux 中该文件指向另一个文件或者目录。 + +它类似于 Windows 中的快捷方式。 + +它能在相同或者不同的文件系统或分区中指向一个文件或着目录。 + +符号链接通常用来链接库文件。它也可用于链接日志文件和在 NFS (网络文件系统)上的文件夹。 + +### 什么是 rm 命令? + +这个 **[rm command][1]** 被用来移除文件和目录。它非常危险,你每次使用 rm 命令的时候要非常小心。 + +### 什么是 unlink 命令? + +unlink 命令被用来移除特殊的文件。它被作为 GNU Gorutils 的一部分安装了。 + +### 1) 使用 rm 命令怎样移除符号链接文件 + +rm 命令是在 Linux 中使用最频繁的命令,它允许我们像下列描述那样去移除符号链接。 + +``` +# rm symlinkfile +``` + +始终将 rm 命令与 “-i” 一起使用以了解正在执行的操作。 + +``` +# rm -i symlinkfile1 +rm: remove symbolic link ‘symlinkfile1’? y +``` + +它允许我们一次移除多个符号链接 + +``` +# rm -i symlinkfile2 symlinkfile3 + +rm: remove symbolic link ‘symlinkfile2’? y +rm: remove symbolic link ‘symlinkfile3’? y +``` + +### 1a) 使用 rm 命令怎样移除符号链接目录 + +这像移除符号链接文件那样。 + +使用下列命令移除符号链接目录。 + +``` +# rm -i symlinkdir + +rm: remove symbolic link ‘symlinkdir’? y +``` + +使用下列命令移除多个符号链接目录。 + +``` +# rm -i symlinkdir1 symlinkdir2 + +rm: remove symbolic link ‘symlinkdir1’? y +rm: remove symbolic link ‘symlinkdir2’? y +``` + +如果你增加 _**“/”**_ 在结尾,这个符号链接目录将不会被删除。如果你加了,你将得到一个错误。 + +``` +# rm -i symlinkdir/ + +rm: cannot remove ‘symlinkdir/’: Is a directory +``` + +你可以增加 **“-r”** 去处理上述问题。如果你增加这个参数,它将会删除目标目录下的内容,并且它不会删除这个符号链接文件。 + +``` +# rm -ri symlinkdir/ + +rm: descend into directory ‘symlinkdir/’? y +rm: remove regular file ‘symlinkdir/file4.txt’? y +rm: remove directory ‘symlinkdir/’? y +rm: cannot remove ‘symlinkdir/’: Not a directory +``` + +### 2) 使用 unlink 命令怎样移除符号链接 + +unlink 命令删除指定文件。它一次仅接受一个文件。 + +删除符号链接文件 + +``` +# unlink symlinkfile +``` + +删除符号链接目录 + +``` +# unlink symlinkdir2 +``` + +如果你增加 _**“/”**_ 在结尾,你不能使用 unlink 命令删除符号链接目录 + +``` +# unlink symlinkdir3/ + +unlink: cannot unlink ‘symlinkdir3/’: Not a directory +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/remove-delete-symbolic-link-softlink-linux/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[arrowfeng](https://github.com/arrowfeng) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/linux-remove-files-directories-folders-rm-command/