TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: Any pro-tips for a Unix n00b?

3 点作者 rottyguy超过 9 年前
Started a job developing under unix (aix, solarix, linux). Any pro tips for a guy with tons of Windows development (c++/c#) but not much with unix? Particularly looking for tips and tricks to make your life easier on an every day basis (eg setting up your environment (we xterm from a windows desktop), editor tricks, etc)

2 条评论

gjvc超过 9 年前
fetch people&#x27;s dotfiles from github and experiment with them to help you stretch everyday tools in ways you probably hadn&#x27;t thought of. hint <a href="https:&#x2F;&#x2F;github.com&#x2F;gjvc&#x2F;etc&#x2F;" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;gjvc&#x2F;etc&#x2F;</a> :-)
a3n超过 9 年前
Read man pages.<p>For every command you run, assume there is a man page, and assume there is quick help, there usually and often are both.<p>$ man man # The man command has a man page about itself.<p>$ man -help # The man command has quick help.<p>A lot of this stuff is 40 years of accumulated and evolving conventions. Quick ref might not be available for a particular command, or might be found with -h, -help or --help.<p>Read the bash man page. Or whichever shell you&#x27;re using, but if you haven&#x27;t set it yourself it&#x27;s probably bash.<p>The bash man page is pretty large, so don&#x27;t read it all at once. Here&#x27;s table of contents script that will give you a man page&#x27;s table of contents. Make yourself a bin directory at &#x2F;home&#x2F;yourlogin&#x2F;bin, then put it and other little tools that you write in there. Make them executable, and put that directory on your path. (&quot;bin&quot; is an old convention for &quot;binary&quot; or compiled programs. Ironically, most of what you put in there will not be binary. :)<p><pre><code> $ cat ~&#x2F;bin&#x2F;toc #! &#x2F;usr&#x2F;bin&#x2F;env bash if [[ $# == 2 ]]; then man -S $2 -P &quot;grep -E &#x27;^[^ ]&#x27;&quot; $1 else man -P &quot;grep -E &#x27;^[^ ]&#x27;&quot; $1 fi $ toc time TIME(1) General Commands Manual TIME(1) NAME SYNOPSIS DESCRIPTION OPTIONS FORMATTING THE OUTPUT EXAMPLES ACCURACY DIAGNOSTICS AUTHOR SEE ALSO $ toc time 2 TIME(2) Linux Programmer&#x27;s Manual TIME(2) NAME SYNOPSIS DESCRIPTION RETURN VALUE ERRORS CONFORMING TO NOTES SEE ALSO COLOPHON Linux 2011-09-09 TIME(2) </code></pre> C functions often have their own man page, as in time(2) above. Run this to see:<p><pre><code> $ man -S 2 time # As opposed to $ man time </code></pre> Without a section number, man will show you the default, usually from section 1, general commands, which is often what you want.<p><pre><code> $ man -k time # Show every man page title that has &quot;time&quot; in the tile or synopsis. </code></pre> Gradually add little convenience scripts to your ~&#x2F;bin directory, but don&#x27;t go wild. A good guide is when you find yourself doing a series of tasks repeatedly, gather those commands together into a script.<p>Learn about command history, and command line recall and editing<p><pre><code> $ history # Shows all your recent commands. </code></pre> You can use emacs style editing or vi style editing. I prefer vi.<p><a href="http:&#x2F;&#x2F;www.pixelbeat.org&#x2F;cmdline.html" rel="nofollow">http:&#x2F;&#x2F;www.pixelbeat.org&#x2F;cmdline.html</a><p><a href="http:&#x2F;&#x2F;bash.cumulonim.biz&#x2F;BashPitfalls.html" rel="nofollow">http:&#x2F;&#x2F;bash.cumulonim.biz&#x2F;BashPitfalls.html</a> but don&#x27;t worry too much about this yet, you have actual work to do instead. Just tuck it away for later.<p><a href="http:&#x2F;&#x2F;tldp.org&#x2F;HOWTO&#x2F;Bash-Prog-Intro-HOWTO.html" rel="nofollow">http:&#x2F;&#x2F;tldp.org&#x2F;HOWTO&#x2F;Bash-Prog-Intro-HOWTO.html</a> same, later.<p>Learn about pipes, redirection and command substitution. <a href="https:&#x2F;&#x2F;duckduckgo.com&#x2F;?t=lm&amp;q=bash+command+substitution&amp;ia=qa" rel="nofollow">https:&#x2F;&#x2F;duckduckgo.com&#x2F;?t=lm&amp;q=bash+command+substitution&amp;ia=...</a><p>Use vim. Or emacs. But vim.<p>I use the urxvt terminal emulator. In my package repository it&#x27;s called rxvt-unicode-256color. It has nice color support and unicode support, and a nice, very simple tab system.<p>Use tmux if you can, when&#x2F;if you need it. My use of urxvt means I almost never need tmux (at home). I use it all the time at work, for its tab-like behavior. Most people who use tmux use it for its session management (I think).<p>Two good books:<p>Effective Computation in Physics <a href="http:&#x2F;&#x2F;shop.oreilly.com&#x2F;product&#x2F;0636920033424.do" rel="nofollow">http:&#x2F;&#x2F;shop.oreilly.com&#x2F;product&#x2F;0636920033424.do</a><p>It&#x27;s a decent intro to Python, if you need&#x2F;want that. But even if you don&#x27;t care much about Python, or physics (I don&#x27;t), it&#x27;s also a decent introduction to how to use Unix to get shit done.<p>Unix Power Tools <a href="http:&#x2F;&#x2F;shop.oreilly.com&#x2F;product&#x2F;9780596003302.do" rel="nofollow">http:&#x2F;&#x2F;shop.oreilly.com&#x2F;product&#x2F;9780596003302.do</a><p>It&#x27;s a door stop, but you can it it as an ebook (and all O&#x27;reilly digital products are DRM-free). Remember I said an accumulation of 40 years? It&#x27;s all in here. I love this book.