Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
429 views
in Technique[技术] by (71.8m points)

linux - 如何获取文件的完整路径?(How to get full path of a file?)

Is there an easy way I can print the full path of file.txt ?

(有没有一种简单的方法可以打印file.txt的完整路径?)

file.txt = /nfs/an/disks/jj/home/dir/file.txt

The <command>

(<command>)

dir> <command> file.txt  

should print

(应该打印)

/nfs/an/disks/jj/home/dir/file.txt
  ask by Jean translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

使用readlink

readlink -f file.txt

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...