.profile vs .bash_profile in OSX

According to the manual page that ships with OS X:

… it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable. The --noprofile option may be used when the shell is started to inhibit this behavior.

in summary: .profile works with sh or bash. However .bash_profile is bash-specific and will override .profile if present.

mac OS X environment checks .bash_profile, .bash_login, .profile in this order. It will run whichever is the highest in the hierarchy, so, if you have .bash_profile, it will not check .profile.


Mac Keyboard symbols

I am always having difficulty in remembering the keyboard symbol like shift ,alt and ctrl in Mac.

OSX 查看系统文件夹

Mac OS X中有很多系统隐藏的信息文件, 一般在Finder中都是看不到,也修改不了的.

但通过在”终端”中输入命令, 就可以在Finder中显示出来:

defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder

其实就是修改系统的一个设置, 再重启Finder


defaults write com.apple.finder AppleShowAllFiles FALSE
killall Finder

如果知道文件或文件夹的路径, Command+shift+G , 可以点击去查看.

View Hidden Files and Folders in an ‘Open’ or ‘Save’ Dialog Box

  1. Launch the application you wish to use to edit or view the hidden file.
  2. Select ‘Open’ from the application’s File menu.
  3. An Open Dialog box will display.
  4. With the dialog box as the front-most window (you can click once in the dialog box to make sure it’s in front), press the command, shift, and period keys(CMD+SHIFT+.) at the same time.
  5. The dialog box now will display any hidden files or folders within its list items.
  6. You can toggle between the hidden files and folders being displayed by pressing command, shift, period again.

Once the hidden files and folders display in the dialog box, you can navigate and open the files just as you would any other file in the Finder.



在terminal中输入:  defaults write com.apple.finder _FXShowPosixPathInTitle -bool YES



文件夹双击: 在当前窗口打开文件夹, 并关闭当前文件夹;

command+文件夹双击: 在新窗口中打开文件夹;

command+向上箭头: 打开当前文件夹的上级文件夹, 并关闭当前文件夹;

ctrl+command+向上箭头: 在新窗口中打开当前文件夹的上级文件夹.

 Command-Option-Esc : 强行结束程序

command + i : 查看文件属性

先用 Command+C 复制,然后在需要转移的文件夹位置使用[Command+Option+V]试试看。(如果你操作后悔了,当然还可以 Command+Z 咯。)