如何通过命令行创建超链接?

问题描述

我想为一些不精通技术的朋友生成链接目录。我正在运行Ubuntu,并且想通过命令行来做到这一点。

到目前为止,我的尝试是:

touch https:...

返回:

touch: cannot touch 'https:...': No such file or directory

cat >> https://...

还会返回No such file or directory异常。

我还尝试了echo,其中链接文件名,文件类型是.html,它返回了相同的异常。

如果我将链接从地址栏中拖放到文件夹中,则会创建超链接-但是我想根据链接列表对它们进行批处理。

编辑:这可以在Python中完成。

解决方法

我能够在SO上找到question,使用Python提供了另一种选择。

,

您可以尝试以下

$ ln -s {source-filename} {symbolic-filename}
  • source-filename-您要创建链接的目标文件 为

  • 符号文件名-符号链接的名称

示例:

ln -s source_file.txt link_file.txt

您可以使用以下命令验证链接的创建

ls -l link_file.txt