<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
> <channel><title>以太之内 生存之上 &#187; terminal</title> <atom:link href="http://ixhan.com/tag/terminal/feed/" rel="self" type="application/rss+xml" /><link>http://ixhan.com</link> <description>Live in your world, get owned in mine</description> <lastBuildDate>Wed, 08 Feb 2012 10:38:57 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>[Mac]终端中快速定位到Finder的当前路径</title><link>http://ixhan.com/2011/12/terminal-fast-switch-dir-to-finder-current-dictionar/</link> <comments>http://ixhan.com/2011/12/terminal-fast-switch-dir-to-finder-current-dictionar/#comments</comments> <pubDate>Sat, 31 Dec 2011 10:21:38 +0000</pubDate> <dc:creator>xhan</dc:creator> <category><![CDATA[奇巧淫技]]></category> <category><![CDATA[AppleScript]]></category> <category><![CDATA[mac]]></category> <category><![CDATA[terminal]]></category> <guid
isPermaLink="false">http://ixhan.com/?p=689</guid> <description><![CDATA[<a
href="http://ixhan.com/2011/12/terminal-fast-switch-dir-to-finder-current-dictionar/" title="[Mac]终端中快速定位到Finder的当前路径"></a>平时工作会非常频繁的使用到命令行, 常见的场景是需要CD到Finder的当前路径操作, 或是打开命令行当前的路径.  后者通过 open .  即可打开. 而前者的操作就比较繁琐, 我需要先输入 cd[空格] ,然后将文件夹拖入到终端中. 在忍受了无数次拖拽后突然想到通过 AppleScript 来获取路径并传送到终端. 考虑过ruby,需要额外的gem支持.  考虑过用 objc 写个工具, 但随后发现个命令 osascript 能直接运行 AppleScript的代码 ,解脱! tell application &#8220;Finder&#8221; to set myname to POSIX path of (target of window 1 as alias) 这段代码能将当前的Finder的路径输出, &#8230;<p
class="read-more"><a
href="http://ixhan.com/2011/12/terminal-fast-switch-dir-to-finder-current-dictionar/">Read more &#187;</a></p>]]></description> <content:encoded><![CDATA[<a
href="http://ixhan.com/2011/12/terminal-fast-switch-dir-to-finder-current-dictionar/" title="[Mac]终端中快速定位到Finder的当前路径"></a><p>平时工作会非常频繁的使用到命令行, 常见的场景是需要CD到Finder的当前路径操作, 或是打开命令行当前的路径.  后者通过 open .  即可打开. 而前者的操作就比较繁琐, 我需要先输入 cd[空格] ,然后将文件夹拖入到终端中.</p><p>在忍受了无数次拖拽后突然想到通过 AppleScript 来获取路径并传送到终端. 考虑过ruby,需要额外的gem支持.  考虑过用 objc 写个工具, 但随后发现个命令 osascript 能直接运行 AppleScript的代码 ,解脱!</p><blockquote><p>tell application &#8220;Finder&#8221; to set myname to POSIX path of (target of window 1 as alias)</p></blockquote><p>这段代码能将当前的Finder的路径输出,  可以使用 osascript -e &#8216;codes&#8217; 来测试结果.</p><p>编辑 ~/.profile  (没有就创建一个), 添加如下代码</p><blockquote><pre>function cdf() # cd to finder's front's window's path
{
   path="`osascript -e 'tell application "Finder" to set myname to POSIX path of (target of window 1 as alias)' 2&gt;/dev/null`"
   if [ -n "$path" ]; then
      echo "cd to $path"
      cd "$path"
   else
      echo "no finder window finded"
   fi
}</pre></blockquote><p>然后source下此文件, 以后只要直接输入 cdf (cd-finder or cd-front 反正很好记) 即能切换到当前路径中.</p><h3  class="related_post_title">Related Posts</h3><ul
class="related_post"><li><a
href="http://ixhan.com/2011/11/applescript-to-update-adium-statu/" title="用AppleScript设置Adium的状态信息">用AppleScript设置Adium的状态信息</a></li><li><a
href="http://ixhan.com/2011/04/declaring-love-with-macosx-finder/" title="Mac可以这么玩-用Finder示爱!">Mac可以这么玩-用Finder示爱!</a></li><li><a
href="http://ixhan.com/2011/03/using-hamachi-to-remote-control-macs-anywhere/" title="使用Hamachi和Screen Share远程管理你的Mac">使用Hamachi和Screen Share远程管理你的Mac</a></li><li><a
href="http://ixhan.com/lesslyrics/" title="LessLyrics">LessLyrics</a></li></ul>]]></content:encoded> <wfw:commentRss>http://ixhan.com/2011/12/terminal-fast-switch-dir-to-finder-current-dictionar/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>OSX Terminal(终端) 使用快捷键</title><link>http://ixhan.com/2009/11/osx-terminal-keyshort/</link> <comments>http://ixhan.com/2009/11/osx-terminal-keyshort/#comments</comments> <pubDate>Mon, 02 Nov 2009 13:10:37 +0000</pubDate> <dc:creator>xhan</dc:creator> <category><![CDATA[Knowledge]]></category> <category><![CDATA[快捷键]]></category> <category><![CDATA[分享]]></category> <category><![CDATA[bash]]></category> <category><![CDATA[c]]></category> <category><![CDATA[终端]]></category> <category><![CDATA[svn]]></category> <category><![CDATA[terminal]]></category> <guid
isPermaLink="false">http://ixhan.com/?p=144</guid> <description><![CDATA[<a
href="http://ixhan.com/2009/11/osx-terminal-keyshort/" title="OSX Terminal(终端) 使用快捷键"></a>之前唯一会用的终端快捷键只有 up 和 down 。碰到长串命令中打错几个字母就很麻烦了，今天学到几个快捷键分享下。 首先勾选设置-》键盘-》使用 option 键作为 meta 键。 然后就可以使用如下快捷键了： control + a / e    回到命令行头/尾 option + b / f     向前/后跳一个单词 control +u /k    删除光标前/后 所有单词 control + y       撤销上个操作 Enjoy It ! 最后有个好玩的命令，查看最常用的10个命令（最近500个命令） awk &#8216;{print $1}&#8217; ~/.bash_history &#8230;<p
class="read-more"><a
href="http://ixhan.com/2009/11/osx-terminal-keyshort/">Read more &#187;</a></p>]]></description> <content:encoded><![CDATA[<a
href="http://ixhan.com/2009/11/osx-terminal-keyshort/" title="OSX Terminal(终端) 使用快捷键"></a><p>之前唯一会用的终端快捷键只有 up 和 down 。碰到长串命令中打错几个字母就很麻烦了，今天学到几个快捷键分享下。</p><p>首先勾选设置-》键盘-》使用 option 键作为 meta 键。</p><p>然后就可以使用如下快捷键了：</p><ul><li>control + a / e    回到命令行头/尾</li><li>option + b / f     向前/后跳一个单词</li><li>control +u /k    删除光标前/后 所有单词</li><li>control + y       撤销上个操作</li></ul><p>Enjoy It !</p><p>最后有个好玩的命令，查看最常用的10个命令（最近500个命令）</p><p>awk &#8216;{print $1}&#8217; ~/.bash_history | sort | uniq -c | sort -gr | head<span
id="more-144"></span></p><p>我的结果</p><blockquote><p>100 ls<br
/> 68 git<br
/> 63 cd<br
/> 54 svn<br
/> 28 fq<br
/> 20 find<br
/> 18 open<br
/> 18 curl<br
/> 16 ssh<br
/> 10 rm</p></blockquote><p>终于不再全是 ls + cd 了。</p><h3  class="related_post_title">Related Posts</h3><ul
class="related_post"><li><a
href="http://ixhan.com/2010/02/fake-version/" title="Fake Version">Fake Version</a></li><li><a
href="http://ixhan.com/2009/12/2009-2010/" title="2009-2010 ">2009-2010 </a></li><li><a
href="http://ixhan.com/2009/10/redmine-images-manager-system/" title="用 Redmine 管理iPhone项目中过多的图片文件">用 Redmine 管理iPhone项目中过多的图片文件</a></li><li><a
href="http://ixhan.com/2009/10/iphone-stencil/" title="iPhone 组件模板（设计用）分享">iPhone 组件模板（设计用）分享</a></li></ul>]]></content:encoded> <wfw:commentRss>http://ixhan.com/2009/11/osx-terminal-keyshort/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> </channel> </rss>
