Mac OS X中的Tar命令添加了“隐藏"功能.文件,为什么? [英] Tar command in mac os x adding "hidden" files, why?

查看:164
本文介绍了Mac OS X中的Tar命令添加了“隐藏"功能.文件,为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写自己的tar存档器.在我的应用程序中,所有程序都可以正常运行(即使读取使用其他工具生成的tar),但是我无法将tar文件与第三方tar​​文件阅读器一起使用.因此,我尝试在命令行上构建一个tar文件,并使用我的代码和二进制文件来比较这两个文件.

I am writing my own tar archiver. All works fine inside my app (even reading tars generated with other tools) however I cannot get my tar files to work with 3rd party tar file readers. So I tried building a tar file on the command line, building one with my code and binary comparing the two.

但是似乎有一个问题:

我有一个名为Test.txt的文本文件,我想将其添加到tar中,因此我在终端中运行以下命令:

I have a textfile called Test.txt which I want to add to my tar, so I run the following command in the terminal:

tar -c -f x.tar Test.txt

这样做时:

tar -tf x.tar

我得到以下列表:

./._Test.txt
Test.txt

这是在Mac OS X Lion的终端中.

This is in the Terminal on Mac OS X Lion.

./._Test.txt文件来自哪里?我在执行ls -a

Where does that ./._Test.txt file come from? I don't see it when doing an ls -a

检查tar内容时,似乎是一些二进制数据,但我不知道它来自哪里.

Upon inspecting the tar contents it seems to be some binary data, but I have no idea where it comes from.

推荐答案

它表示文件的资源派生/扩展属性.

It's a representation of the file's resource fork/extended attributes.

尝试ls -l@ Test.txtxattr -l Test.txt来查看OSX在文件上添加了哪些额外内容.

Try ls -l@ Test.txt and xattr -l Test.txt to see what extra stuff OSX tacked on to the file.

这篇关于Mac OS X中的Tar命令添加了“隐藏"功能.文件,为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆