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

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

问题描述

我正在编写自己的 tar 归档程序.在我的应用程序中一切正常(甚至读取使用其他工具生成的 tar)但是我无法让我的 tar 文件与 3rd 方 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天全站免登陆