Mac有一个设计原则,就是用户不需要看到的或者用户不希望看到的,都不会显示出来。但如果你想要修改其中某些文件,也是可以的,先需要显示所有的文件,可以在终端中输入命令行来实现。

显示系统隐藏的文件

defaults write com.apple.finder AppleShowAllFiles -bool true
KillAll Finder
或者
defaults write com.apple.finder AppleShowAllFiles YES
KillAll Finder
同样可以把这些隐藏文件再隐藏起来
defaults write com.apple.finder AppleShowAllFiles -bool false
KillAll Finder或者
defaults write com.apple.finder AppleShowAllFiles NO
KillAll Finder

在显示了所有文件之后,那如何把一个不是隐藏的文件修改为隐藏呢,下面介绍两种简单的方法。

方法一:直接在文件或文件夹名前面的加一个‘.’点号,然后系统会弹出修改确认对话框,点好就行了。
方法二:利用命令“chflags hidden” 可以隐藏文件或文件夹。

先打开Terminal(Applications/Utilities/Terminal),然后执行命令
chflags hidden 文件路径 或
chflags hidden 文件夹路径
既可。也可以先输入chflags hidden,然后直接把要隐藏的文件用鼠标选中拖到输入框中,它自动会转换为文件的路径。
要解除文件的隐藏状态,可以使用命令:
chflags nohidden
与前面相对应即可。

上面两种方式,到底有啥区别呢,个人觉得方法一并没有修改文件本身的属性,在linux及unix中,约定好点开头的文件就是隐藏文件。
方法二中修改的是文件本身的隐藏标志,但貌似在windows上不起作用,只能在linux及unix中有用。而方法一,windows也是可以显示
隐藏的,应该是windows也识别linux及unix中的点号约定。

在网上还发现有一个可以隐藏文件及文件夹的开源工程,提供了一个带界面的程序,可以方便不会使用命令行的用户,地址是https://code.google.com/p/hideme4mac/

最后,附加上chflags命令的详细信息。
chflags 命令修改文件的标志(change file flags),包括隐藏标志,其详细使用方法如下:

SYNOPSIS
chflags [-fhv] [-R [-H | -L | -P]] flags file ...DESCRIPTION
The chflags utility modifies the file flags of the listed files as specified by the flags operand.The options are as follows:-f Do not display a diagnostic message if chflags could not modify the flags for file, nor modify
the exit status to reflect such failures.-H If the -R option is specified, symbolic links on the command line are followed. (Symbolic
links encountered in the tree traversal are not followed.)-h If the file is a symbolic link, change the file flags of the link itself rather than the file
to which it points.-L If the -R option is specified, all symbolic links are followed.-P If the -R option is specified, no symbolic links are followed. This is the default.-R Change the file flags for the file hierarchies rooted in the files instead of just the files
themselves.-v Cause chflags to be verbose, showing filenames as the flags are modified. If the -v option is
specified more than once, the old and new flags of the file will also be printed, in octal
notation.The flags are specified as an octal number or a comma separated list of keywords. The following key-
words are currently defined:arch, archived
set the archived flag (super-user only)opaque set the opaque flag (owner or super-user only). [Directory is opaque when viewed through
a union mount]nodump set the nodump flag (owner or super-user only)sappnd, sappend
set the system append-only flag (super-user only)schg, schange, simmutable
set the system immutable flag (super-user only)uappnd, uappend
set the user append-only flag (owner or super-user only)uchg, uchange, uimmutable
set the user immutable flag (owner or super-user only)hidden set the hidden flag [Hide item from GUI]As discussed in chflags(2), the sappnd and schg flags may only be unset when the system is in single-
user mode.Putting the letters ``no'' before or removing the letters ``no'' from a keyword causes the flag to be
cleared. For example:nouchg clear the user immutable flag (owner or super-user only)
dump clear the nodump flag (owner or super-user only)Unless the -H or -L options are given, chflags on a symbolic link always succeeds and has no effect.
The -H, -L and -P options are ignored unless the -R option is specified. In addition, these options
override each other and the command's actions are determined by the last one specified.You can use "ls -lO" to see the flags of existing files.

下面提供一个中文版

chflags
名称:
chflags – 改变文件的标志
概述:
chflags [-fhv] [-R [-H | -L | -P]] 标志 文件
描述:
工具chflags修改指定文件的文件标志。选项如下:
-f 如果chflags不能修改文件标志,nor modify the exit status to reflect such failures,则不显示诊断信息。
-H 如果开启-R选项,将改变软连接指向的文件的文件标志(遍历树中的软连接除外)。
-h 如果文件是软连接,只改变该链接的文件标志,而不改变该链接所指向的文件的标志。
-L 如果-R选项开启,将改变所有软连接所指向的文件的文件标志。
-P 如果-R选项开启,将不改变所有软连接所指向的文件的文件标志。这是默认选项。
-R Change the file flags for the file hierachies rooted int the files instead of just the files themselves.
-v 当修改标志时显示文件名。如果 –v 出现两次以上,则以八进制同时显示旧标志和新 标志。文件标志以一个八进制数或一系列以逗号分隔的关键词来显示。下面是当前定义的关 键词:
arch,archived
存档文件标志(超级用户独有)
opaque 不透明文件标志(适用于文件所有者或超级用户)
nodump nodump文件标志(适用于文件所有者和超级用户)
sappnd,sappend
仅允许附加 文件标志(超级用户独有)
schg,schange,simmutable
不可更改 文件标志(超级用户独有)
sunlnk,sunlink
不可删除 文件标志(超级用户独有)
uappnd,uappend
只允许用户附加 文件标志(适用于所有者和超级用户)
uchg,uchange,uimmutable
不允许用户更改 文件标志(适用于所有者和超级用户)
uunlnk,uunlink
不允许用户删除 文件标志(适用于所有者和超级用户)在关键词前面添加或者去除“no”将清除相应的文件标志。例如:
nouchg 清除 不可更改 文件标志(适用于所有者或超级用户)
dump 清除 nodump 文件标志(适用于所有者或超级用户)八进制数值对应的文件标志:
0 清除所有文件标志
1 nodump
2 uchg
3 uchg,nodump
4 uappnd
10 opaque
20 uunlnkOther combinations of keywords may be placed by using the octets assigned.但是,以上这些是最常用的。你可以使用 “ls -lo”来查看文件的文件标志。注意:能否改变某些标志依赖于当前内核的安全级别设定。查看security(7)来获得更多的 信息。
退出状态:
成功 0,失败>0.
实例:
无
参考:
ls(1), chflags(2), stat(2), fts(3), security(7), symlink(7)
标准:
无
历史:
chflags最早出现在4.4BSD当中。
BUGS:
Only a limited number of utilities are chflags aware. Some of these
tools include ls(1), cp(1), find(1), install(1), dump(8), and restore(8).
In particular a tool which is not currently chflags aware is the pax(1)
utility.chio



												

Mac OS中显示及隐藏文件和文件夹的方法相关推荐

  1. Funter for Mac:支持快速显示和隐藏文件和文件夹

    Funter是一个小型高效的工具,可用于隐藏文件和文件夹.您可以找到隐藏文件,在Finder中切换隐藏文件的可见性,隐藏文件,复制,移动或删除它们.此实用程序使您可以快速轻松地在默认项目和可见项目之间 ...

  2. Mac OS X 显示和隐藏文件

    参考: mac系统如何显示和隐藏文件 Mac OSX系统 显示和隐藏文件 1.显示隐藏文件: 打开Terminal,并输入以下命令: defaults write com.apple.finder A ...

  3. 关于无法显示-隐藏文件、文件夹以及操作系统文件夹

    1.先对电脑进行全面杀毒 2.无法显示"隐藏受保护的操作系统文件"的解答 分类:电脑网络开始--运行--输入regedit在: HKEY_LOCAL_MACHINE-SOFTWAR ...

  4. 删除Mac 系统中多出得MobileBackups 文件夹

    此文件夹在timeMachine 开启时回自动记录备份操作 将导致Mac pro 的存储空间慢慢减少 解决方案如下 1.手动关掉time machine的移动时的备份功能 2.打开终端,这个命令 $ ...

  5. 解决方案资源管理器中显示bin,Debug等文件夹

    1.项目 -- 显示所有文件 2.右击新出现的bin,Debug等文件夹 -- 加入到项目 即可

  6. attrib批量显示文件夹_Windows 下彻底隐藏文件和文件夹的方法

    利用 attrib 命令来隐藏文件 首先按Win+R调出运行窗口,并输入cmd调出命令行窗口. 2. 输入attrib命令 比如我要隐藏D盘test文件夹中的所有文件和文件夹: 则在命令行输入 d: ...

  7. Mac OS 中Texstudio 无法找到 .sty文件

    在刚刚把tex项目移到Mac中时,用Texstudio打开,无法正常运行,系统给出的错误提示是: Error: File 'siunitx.sty' not found. \usepackage 但实 ...

  8. mac笔记本中找不到library文件夹的解决办法

    1.打开访达.双击当前用户 2.设置显示资源库 点击用作默认.完成✅

  9. linux 显示隐藏文件_Mac Finder中显示和隐藏文件的方法

    Mac Finder中显示和隐藏文件的方法 按照以下步骤查看Mac上Finder中的隐藏文件. 打开Finder窗口 现在在左栏中,点击 "设备 "下的Mac名称. 选择并点击启动 ...

  10. 如何在Linux中轻松隐藏文件和文件夹

    你有没有想要隐藏你的Linux文件系统上的文件或文件夹,但不知道该怎么做? 别担心,这不像听起来那么复杂,而且可以快速而有效地完成. 在本指南中,我们将介绍在Linux中可以有效隐藏文件和文件夹的简单 ...

最新文章

  1. ActiveMQ基本内容及安装部署
  2. 姓名、病史、医疗影像通通泄露,500万人数据库没密码随便看,AI医疗暴露危机...
  3. [YTU]_2443 ( C++习题 复数类--重载运算符3+)
  4. SVM熟练到精通3:核函数与非线性分类
  5. 服务器辐射大还是显示器辐射大,显示器一直被吐槽辐射大_液晶显示器_液晶显示器应用技术-中关村在线...
  6. linux内核源代码分析----内核基础设施之klist
  7. 学习组合模式,转载一段有关组合模式的详解
  8. 【译】Redis喜提新数据结构:Redis Streams
  9. roszhong指定rviz的点启动_怎样在1秒内启动 Linux
  10. 毕设日志——在faster rcnn pytorch上训练KITTI数据集
  11. 每个 JavaScript 工程师都应懂的33个概念
  12. 小程序引入的echarts过大如何解决_小程序如何解决社区团购的痛点
  13. 考研复习(2)链表操作
  14. 篮球计时计分器c语言程序,C51的篮球计时计分器程序
  15. 【实用工具】原型图绘画工具推荐
  16. 阻止中文输入时触发input事件
  17. Negotiation - 04
  18. 【FXCG】美国加息缩表在即,人民币仍创新高
  19. win10下如何使用linux系统
  20. 基于Kinect 2.0深度图像的快速体积测量

热门文章

  1. 宜人贷宜人蜂巢金融科技AI实践:蜂巢机器人
  2. 拉普拉斯矩阵与正则化
  3. Photoshop 2020免注册登录版,自用下载安装教程
  4. Python基础学习笔记-第一章
  5. C#反射Activator
  6. 「开发者说」钉钉连接器+OA审批实现学校学生假勤场景数字化
  7. e900v21e 装第三方_创维e900v21e刷机包
  8. linux zip -e,在 Linux 上压缩文件:zip 命令的各种变体及用法
  9. scratch少儿编程航天主题:认识太阳系-八大行星连连看
  10. PHP基础知识系统复习