dazuiniu's blog

cat /dev/dazuiniu/random

Mac Terminal 下的技巧

View Comments

Mac OS X 下的一些技巧:原文在这里[1],大嘴牛简单的整理了一下,挑了一些觉得有趣和有用的。

  1. open .  可以使用 Finder 打开当前目录
  2. pbcopy/pbpaste 比如: echo hello world | pbcopy , 而 pbpaste就可以使用剪贴板中的内容。
  3. echo 'The system is overheating and needs to go to sleep now.' | \
    growlnotify -a 'Activity Monitor' 'OVERHEATED'; \
    sleep 1; \
    say 'Overheated system.'

    growlnotify 是 growl的附加功能,见[2].

  4. opensnoop 可以用来查看某个进程正在使用哪些文件,或者查看某个文件被哪些进程所使用,利用dtrace实现。这个与 lsof 类似。
  5. say 会说话的哦
  6. mdfind 命令行上使用 spotlight
  7. !! 再次运行上次的命令。
  8. 如果在编辑一条很长的命令,这个时候可以使用 CTRL+X CTRL+E ,这个时候系统会调用你喜欢的编辑器来编辑这行,十分有用。
  9. python -m SimpleHTTPServer 8000 可以将当前的目录作为 http server 的跟目录
  10. hdiutil mount ~/Desktop/lastest_webkit.dmg 挂载 hdiutil detach /Volumes/latest_webkit 卸载某个dmg磁盘
  11. 使得文件隐藏 SetFile file -a V
  12. bcat 也是一个有用的东东,作为一个term与browser的一个连接管道
  13. xattr -h 可以查看文件的属性

还有很多,好多。。。不写了 -_-!!!

[1]. http://superuser.com/questions/52483?tab=votes&page=1#tab-top
[2]. http://growl.info/extras.php

Written by dazuiniu

July 29th, 2010 at 3:10 pm

Posted in usage

Tagged with , , ,

  • http://glacjay.is-a-geek.org/blog/ GlacJAY

    嗯,有些并不是Mac特有的技巧。

  • dazuiniu

    对的。有些是terminal通用的功能。

  • Peter Tuo

    多谢哈~ 很受用,希望有机会把好多。。好多都写出来哈哈~

blog comments powered by Disqus