Mac Finder中顯示和隐藏文件的方法
按照以下步驟查看Mac上Finder中的隐藏文件。
打開Finder窗口
現在在左欄中,點擊 "設備 "下的Mac名稱。
選擇并點擊啟動驅動器。默認情況下,它讀作Macintosh HD。
接下來,按Command Shift .(句号)鍵。現在你将能夠看到幾個帶有""的文件。
要再次隐藏它們,按住Command Shift . (句号)。
方法1:
重命名文件夾前面加“.”
➜ Downloads pwd
/Users/lex/Downloads/AirDrop
➜ AirDrop mkdir hidden
➜ AirDrop cd hidden
➜ hidden seq 1 5|while read line;do touch $line;done
➜ hidden ls -al
total 0
drwxr-xr-x 7 lex staff 224 Sep 28 09:09 .
drwx------ 39 lex staff 1248 Sep 28 09:07 ..
-rw-r--r-- 1 lex staff 0 Sep 28 09:09 1
-rw-r--r-- 1 lex staff 0 Sep 28 09:09 2
-rw-r--r-- 1 lex staff 0 Sep 28 09:09 3
-rw-r--r-- 1 lex staff 0 Sep 28 09:09 4
-rw-r--r-- 1 lex staff 0 Sep 28 09:09 5
➜ hidden cd ..
➜ AirDrop mv hidden .hidden
重命名隐藏文件
查看效果 默認就是隐藏的了 。如果需要展示出來可以直接
shitf ommand .
方法2:在Mac上用終端命令解除隐藏文件。
我們在Mac中利用終端、命令行界面。輕松的顯示隐藏的文件和隐藏文件。與Finder不同,在Finder中,你需要遵循一系列複雜的指令,而使用Terminal命令則非常簡單。
啟動終端
這裡,複制粘貼以下命令
defaults write com.apple.Finder AppleShowAllFiles true
killall Finder
注意:
參數True會顯示隐藏的文件,而當你把它改為false時,它會再次隐藏文件
當然所有的這些操作都逃不過ls -al的眼睛
參數True會顯示隐藏的文件,可以直接查看Finder
➜ AirDrop defaults write com.apple.Finder AppleShowAllFiles true
➜ AirDrop killall Finder
➜ AirDrop ls -al|grep ^d
drwxr-xr-x 29 lex staff 928 Sep 28 09:12 .
drwx------ 38 lex staff 1216 Sep 28 09:10 ..
drwxr-xr-x 7 lex staff 224 Sep 28 09:09 .hidden
drwxr-xr-x 3 lex staff 96 Sep 21 21:11 156888209236695
drwxr-xr-x 74 lex staff 2368 Sep 26 12:49 NCE 1 audio
drwx------ 11 lex staff 352 Sep 26 08:53 充電提示音素材
改為false時,它會再次隐藏文件
➜ AirDrop defaults write com.apple.Finder AppleShowAllFiles false
➜ AirDrop killall Finder
➜ AirDrop ls -al|grep ^d
drwxr-xr-x 29 lex staff 928 Sep 28 09:12 .
drwx------ 38 lex staff 1216 Sep 28 09:10 ..
drwxr-xr-x 7 lex staff 224 Sep 28 09:09 .hidden
drwxr-xr-x 3 lex staff 96 Sep 21 21:11 156888209236695
drwxr-xr-x 74 lex staff 2368 Sep 26 12:49 NCE 1 audio
drwx------ 11 lex staff 352 Sep 26 08:53 充電提示音素材
方法3:
利用命令“chflags hidden” 可以隐藏文件或文件夾。
➜ ScreenShot pwd
/Users/lex/Downloads/ScreenShot
➜ ScreenShot mkdir testdir
➜ ScreenShot mv Screen\ Recording\ 2020-09-2* ./testdir
➜ ScreenShot chflags hidden /Users/lex/Downloads/ScreenShot/testdir
這個時候是到finder中是看不到這個路徑了,但是終端下是可以有的
➜ ScreenShot ls
'Sep-28-2020 08-52-34.gif' 'iShot2020-09-26 17.32.06.png' 金玟岐-歲月神偷.mp4
Sep-28.gif testdir
➜ ScreenShot ls testdir/*
'testdir/Screen Recording 2020-09-22 at 9.47.58 AM-Segment 1.mp4'
'testdir/Screen Recording 2020-09-22 at 9.47.58 AM.mov'
'testdir/Screen Recording 2020-09-28 at 8.34.29 AM-Segment 1.mp4'
'testdir/Screen Recording 2020-09-28 at 8.34.29 AM.mov'
顯示這個路徑
➜ ScreenShot chflags nohidden /Users/lex/Downloads/ScreenShot/testdir
➜ ScreenShot ls
'Sep-28-2020 08-52-34.gif' 'iShot2020-09-26 17.32.06.png' 金玟岐-歲月神偷.mp4
Sep-28.gif testdir
➜ ScreenShot ls testdir/*
'testdir/Screen Recording 2020-09-22 at 9.47.58 AM-Segment 1.mp4'
'testdir/Screen Recording 2020-09-22 at 9.47.58 AM.mov'
'testdir/Screen Recording 2020-09-28 at 8.34.29 AM-Segment 1.mp4'
'testdir/Screen Recording 2020-09-28 at 8.34.29 AM.mov'
再次到finder中路徑是正常顯示的
,更多精彩资讯请关注tft每日頭條,我们将持续为您更新最新资讯!