如何使用android/busybox shell命令删除到指定文件的所有符号链接?

时间:2021-02-05 00:13:39

I want to remove all symbolic links to /system/bin/toolbox in the /system/bin/ directory on my android phone, other symlinks should be kept.

我想在我的android手机的/system/bin/目录中移除所有符号链接到/system/bin/toolbox,其他符号链接应该保留。

i.e. Delete cat -> toolbox , df -> toolbox, etc. Keep mount -> busybox.

即删除cat ->工具箱、df ->工具箱等,保持挂载-> busybox。

How can I write the command? (I have busybox installed already.)

如何编写命令?(我已经安装了busybox。)

Thanks in advance!

提前谢谢!

1 个解决方案

#1


2  

Ahoy,

喂,

In a bash shell you will want to run the following command after reading this post:

在bash shell中,您将希望在阅读本文后运行以下命令:

#find / -type l -exec unlink {} +

This Command will search through the root file system (change to the path of the search path) and locate symlinks (identified by the -type l). Once it finds symlinks, it will use the --exec argument to run a command. In this case the command is unlink, and the file path is replaced where {} appears in this command. The command is ended with a plus sign.

该命令将搜索根文件系统(更改搜索路径)并定位符号链接(由-type l标识)。在这种情况下,命令是unlink,文件路径被替换为这个命令中出现的{}。命令以加号结束。

This command is destructive and should only be run when you understand the command and it is your desired intent, however in it's current state may leave any Linux system this command is run on un-bootable since Linux often relies on symlinks.

这个命令是破坏性的,只有当您理解这个命令并且它是您想要的意图时才应该运行它,但是在它的当前状态下,这个命令可能会让任何Linux系统在unbootable上运行,因为Linux通常依赖于符号链接。

#1


2  

Ahoy,

喂,

In a bash shell you will want to run the following command after reading this post:

在bash shell中,您将希望在阅读本文后运行以下命令:

#find / -type l -exec unlink {} +

This Command will search through the root file system (change to the path of the search path) and locate symlinks (identified by the -type l). Once it finds symlinks, it will use the --exec argument to run a command. In this case the command is unlink, and the file path is replaced where {} appears in this command. The command is ended with a plus sign.

该命令将搜索根文件系统(更改搜索路径)并定位符号链接(由-type l标识)。在这种情况下,命令是unlink,文件路径被替换为这个命令中出现的{}。命令以加号结束。

This command is destructive and should only be run when you understand the command and it is your desired intent, however in it's current state may leave any Linux system this command is run on un-bootable since Linux often relies on symlinks.

这个命令是破坏性的,只有当您理解这个命令并且它是您想要的意图时才应该运行它,但是在它的当前状态下,这个命令可能会让任何Linux系统在unbootable上运行,因为Linux通常依赖于符号链接。