Unix中相对路径的绝对路径 [英] Absolute path to Relative Path in Unix
问题描述
此命令是仅列出我的fileAsst目录中的文本文件:
This command was to list only the text files in my fileAsst directory:
ls ~/UnixCourse/fileAsst/*.txt
现在我需要做同样的事情,但是要使用相对路径,到目前为止,我已经尝试过:
now I need to do the same thing but using a relative path instead, what I've tried so far is:
ls ~/UnixCourse/../*.txt
但这是说我没有得到正确的答案,任何人都可以给我一些提示或解释相对路径和绝对路径之间的差异,因为我仍然不了解它.
but it's saying I'm not getting the right answer, can anyone give me some hints or explain the differences between a relative path and absolute path, because I still dont under it.
推荐答案
绝对路径: 绝对路径是包含根目录和包含文件或文件夹的所有其他子目录的路径.
Absolute Path: The absolute path is a path that contains the root directory and all other sub directories that contain a file or folder.
~/UnixCourse/fileAsst/*.txt
相对路径: 相对路径只是完整路径的一部分.
Relative path: The relative path is only a portion of the full path.
cd ~UnixCourse/fileAsst/
ls *.txt
这篇关于Unix中相对路径的绝对路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!