{"id":164,"date":"2014-06-26T15:50:41","date_gmt":"2014-06-26T15:50:41","guid":{"rendered":"http:\/\/ixyzero.com\/blog\/?p=164"},"modified":"2014-06-26T15:50:41","modified_gmt":"2014-06-26T15:50:41","slug":"%e5%9c%a8ubuntu%e4%b8%8a%e5%bf%ab%e9%80%9f%e5%88%87%e6%8d%a2%e5%b7%a5%e4%bd%9c%e7%9b%ae%e5%bd%95","status":"publish","type":"post","link":"https:\/\/ixyzero.com\/blog\/archives\/164.html","title":{"rendered":"\u5728Ubuntu\u4e0a\u5feb\u901f\u5207\u6362\u5de5\u4f5c\u76ee\u5f55"},"content":{"rendered":"<p>\u56e0\u4e3a\u6700\u8fd1\u7528Linux\u7528\u7684\u6bd4\u8f83\u591a\uff0c\u800c\u4e14\u7ecf\u5e38\u4f1a\u5728\u5404\u79cd\u5c42\u6b21\u7684\u76ee\u5f55\u4e4b\u95f4\u8fdb\u884c\u5207\u6362\uff0c\u6240\u4ee5\u60f3\u63d0\u9ad8\u63d0\u9ad8\u6548\u7387\uff0c\u4e4b\u524d\u5176\u5b9e\u770b\u5230\u8fc7\u8fd9\u7bc7\u6587\u7ae0\uff0c\u4f46\u90a3\u65f6\u53ea\u662f\u5c1d\u8bd5\u4e86\u4e00\u4e0b\uff0c\u5e76\u6ca1\u6709\u6df1\u5c42\u6b21\u7684\u8fd0\u7528\u5728\u5de5\u4f5c\u4e2d\uff0c\u6240\u4ee5\u4e5f\u5c31\u5fd8\u4e86\uff0c\u4e0d\u8fc7\u540e\u6765\u5728\u901b\u201c\u56e2\u5b50\u5927\u795e\u201d\u7684blog\u65f6\u53d1\u73b0\u4e86\u8fd9\u7bc7\u6587\u7ae0\uff0c\u800c\u4e14\u4ed6\u8fd8\u5199\u4e86\u4e2a\u81ea\u52a8\u5316\u90e8\u7f72\u4ee5\u53ca\u589e\u5f3a\u7248\u7684<a href=\"https:\/\/github.com\/dangoakachan\/mark-directory\" target=\"_blank\">mark-directory<\/a>\uff0c\u4f46\u662f\u6211\u770b\u4e86\u4e00\u4e0b\u539f\u6587\u7684\u5185\u5bb9\uff0c\u8d85\u7ea7\u7b80\u5355\u800c\u4e14\u6613\u4e8e\u7406\u89e3\uff0c\u6240\u4ee5\u8fd8\u662f\u9009\u62e9\u4e86\u539f\u59cb\u7248\u672c\uff0c\u81ea\u5df1\u52a8\u624b\u7684\u4e50\u8da3\u8fd8\u662f\u591a\u4e9b\uff08\u4e0d\u8fc7\u671f\u95f4\u4e5f\u9047\u5230\u4e86\u4e00\u4e9b\u6bd4\u8f83\u90c1\u95f7\u7684\u95ee\u9898\uff0c\u540e\u6765\u7528\u6587\u672c\u5bfc\u5165\u7684\u65b9\u5f0f\u5c31\u6ca1\u51fa\u73b0\u95ee\u9898\uff0c\u4e0d\u77e5\u9053\u662f\u54ea\u4e00\u6b65\u7684\u7279\u6b8a\u5b57\u7b26\u51fa\u4e86\u95ee\u9898\uff1f\uff09<\/p>\n<p>\u5b9e\u73b0\u65b9\u6cd5\u4e5f\u5f88\u7b80\u5355\uff0c\u5c06\u4e0b\u9762\u7684\u5185\u5bb9\u5b58\u5165\u6587\u672c\u6587\u4ef6mark_dir.txt\uff1a<\/p>\n<hr \/>\n<pre class=\"lang:default decode:true\">export MARKPATH=$HOME\/.marks\n\nfunction jump {\ncd -P \"$MARKPATH\/$1\" 2&gt;\/dev\/null || echo \"No such mark: $1\"\n}\nfunction mark {\nmkdir -p \"$MARKPATH\"; ln -s \"$(pwd)\" \"$MARKPATH\/$1\"\n}\nfunction unmark {\nrm -i \"$MARKPATH\/$1\"\n}\nfunction marks {\nls -l \"$MARKPATH\" | sed 's\/ \/ \/g' | cut -d' ' -f9- | sed 's\/ -\/t-\/g' &amp;&amp; echo\n}\n_completemarks() {\nlocal curw=${COMP_WORDS[COMP_CWORD]}\nlocal wordlist=$(find $MARKPATH -type l -printf \"%fn\")\nCOMPREPLY=($(compgen -W '${wordlist[@]}' -- \"$curw\"))\nreturn 0\n}\n\ncomplete -F _completemarks jump unmark<\/pre>\n<hr \/>\n<p>\u76f4\u63a5\u590d\u5236\u7c98\u8d34\u5c31\u884c\uff0c\u4f46\u662f\u8981<strong><span style=\"color: #ff0000;\">\u6ce8\u610f\u6362\u884c\u7b26\u7684\u683c\u5f0f<\/span><\/strong>\u4e3a\u201cn\u201d\u800c\u4e0d\u662fWindows\u4e0b\u7684\u201cnr\u201d\u3002\u7528WinScp\u5c06\u6587\u4ef6\u4f20\u8f93\u5230VPS\u4e0a\uff0c\u7136\u540e\u6dfb\u52a0\u5230$HOME\/.bashrc\u6587\u4ef6\u7684\u672b\u5c3e\uff08# cat mark_dir.txt &gt;&gt;~\/.bashrc\uff09\uff0c\u7136\u540e\u7528source\u547d\u4ee4\u4f7f\u4fee\u6539\u7acb\u5373\u751f\u6548\uff08# source ~\/.bashrc\uff09\uff0c\u5373\u53ef\u3002<\/p>\n<h6>\u4f7f\u7528\u65b9\u6cd5\uff1a<\/h6>\n<p>\u5207\u6362\u5230\u4e00\u4e2a\u6df1\u5c42\u6b21\u7684\u76ee\u5f55\uff0c\u8fd0\u884c\u547d\u4ee4\uff1a# mark tmp<\/p>\n<p>\u5373\u53ef\u5c06\u4e3a\u5f53\u524d\u76ee\u5f55\u521b\u5efa\u4e00\u4e2a\u540d\u4e3atmp\u7684\u8f6f\u94fe\u63a5\uff0c\u4f4d\u4e8e~\/.mark\/\u76ee\u5f55\u4e0b\uff0c\u5f53\u4f60\u5728\u522b\u7684\u76ee\u5f55\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528\u547d\u4ee4\uff1a# jump tmp \u5feb\u901f\u8df3\u8f6c\u5230\u8fd9\u4e2a\u76ee\u5f55\uff08\u652f\u6301Tab\u8865\u5168\uff09\u3002<\/p>\n<p>\u8fd9\u90fd\u53ef\u4ee5\u4f5c\u4e3aUbuntu\u7cfb\u7edf\u5b89\u88c5\u4e4b\u540e\u7684\u5fc5\u5907\u201c\u8f6f\u4ef6\u201d\u6dfb\u52a0\u5230todolist\u91cc\u9762\u53bb\u4e86\u3002<\/p>\n<p>\u5f53\u7136\uff0c\u4f60\u4e5f\u53ef\u4ee5\u8bd5\u8bd5\u56e2\u5b50\u5927\u795e\u7684<a href=\"https:\/\/github.com\/dangoakachan\/mark-directory\" target=\"_blank\">mark-directory<\/a>\uff0c\u4e00\u952e\u5f0f\u81ea\u52a8\u90e8\u7f72\uff0c\u8fd8\u8d34\u5fc3\u7684\u52a0\u4e86\u4e2a\u5378\u8f7d\u529f\u80fd\uff08\u5220\u9664\u5bf9\u5e94\u76ee\u5f55\u4ee5\u53ca\u5728~\/.bashrc\u4e2d\u7684\u5185\u5bb9\uff09\u3002<\/p>\n<h6>\u539f\u6587\u94fe\u63a5\uff1a<\/h6>\n<ul>\n<li><a href=\"http:\/\/jeroenjanssens.com\/2013\/08\/16\/quickly-navigate-your-filesystem-from-the-command-line.html\" target=\"_blank\">http:\/\/jeroenjanssens.com\/2013\/08\/16\/quickly-navigate-your-filesystem-from-the-command-line.html<\/a><\/li>\n<li><a href=\"http:\/\/kodango.com\/quick-way-to-change-directory-from-the-cmdline\" target=\"_blank\">mark-directory: \u5feb\u901f\u76ee\u5f55\u5207\u6362\u5de5\u5177<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u56e0\u4e3a\u6700\u8fd1\u7528Linux\u7528\u7684\u6bd4\u8f83\u591a\uff0c\u800c\u4e14\u7ecf\u5e38\u4f1a\u5728\u5404\u79cd\u5c42\u6b21\u7684\u76ee\u5f55\u4e4b\u95f4\u8fdb\u884c\u5207\u6362\uff0c\u6240\u4ee5\u60f3\u63d0\u9ad8\u63d0\u9ad8\u6548\u7387\uff0c\u4e4b\u524d\u5176\u5b9e\u770b\u5230\u8fc7\u8fd9\u7bc7 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,12],"tags":[95,96,73],"class_list":["post-164","post","type-post","status-publish","format-standard","hentry","category-linux","category-tools","tag-cd","tag-ln","tag-ubuntu"],"views":3368,"_links":{"self":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts\/164","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/comments?post=164"}],"version-history":[{"count":0,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts\/164\/revisions"}],"wp:attachment":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/media?parent=164"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/categories?post=164"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/tags?post=164"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}