TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Know Your Tools – Terminal and Bash

64 pointsby zanabout 10 years ago

13 comments

tensorproductabout 10 years ago
The first thing I do on any bash terminal is `set -o vi`. This changes the default keybindings from emacs-like to vi-like. I find it to be a huge booster to my speed in navigating the command line.<p>edit: Actually, something cool I learned recently is that if you put the line &quot;set editing-mode vi&quot; in your ~&#x2F;.inputrc then vi-like editing keys are available in any program that uses readline. This includes bash and the python repl. Presumably, a bunch of other repls and interactive command lines too.
评论 #9199442 未加载
guruparan18about 10 years ago
Very true. I have difficulties in training new recruits with UNIX. For some reason, beginners have developed an aversion to UNIX&#x2F;shell scripting. I myself have started more and more of Ruby&#x2F;AWK&#x2F;Python, but it is always SHELL that blows me off with the sort of impact it has on the daily work.<p>I ended up highly optimizing my work environment to replace long ssh connections with `conn prod` (will use my RSA key and connect). File tranfers with `go get prod filename` or `go send prod filename`. Another script that can remember directory paths (I have to go over lot of them every day, and typing long lengthy ones does not help).<p>To me, UNIX shell scripting is a lazy men&#x27;s most effective tool, only if you know how to use that rightly.<p>Loved the post. And thanks much.
评论 #9198863 未加载
评论 #9199909 未加载
评论 #9199424 未加载
评论 #9199417 未加载
评论 #9199027 未加载
lukabratosabout 10 years ago
<a href="http://xkcd.com/1168/" rel="nofollow">http:&#x2F;&#x2F;xkcd.com&#x2F;1168&#x2F;</a> ^_^
评论 #9199181 未加载
评论 #9198728 未加载
评论 #9197888 未加载
bcookabout 10 years ago
My most used bash command is probably &quot;sudo !!&quot;, which runs the previous command with &quot;sudo&quot; prepended.<p>The book &quot;Unix Power Tools&quot; showed me that higher-level programming languages (Perl, Python, Ruby, etc) are not needed to accomplish most administrative tasks. Awk is incredibly useful (but also very confusing, imo).
评论 #9199271 未加载
babuskovabout 10 years ago
Two very basic tips for vi:<p>You can use slash(&#x2F;) and question mark(?) to search for text (forward and backward) in vi. It&#x27;s useful to know these, because they also work with less(1).<p>If you are Windows user and used to press Ctrl+S to save the file and you accidentally do that in Vi, your terminal would get stuck. But you can use Ctrl+Q to unfreeze it.
评论 #9199061 未加载
nicksuperbabout 10 years ago
<i>&quot;Fact of life is, as you spend time in the terminal, you&#x27;re probably going to launch Vim at some point, whether willingly or not...</i> <i>For all other intents and purposes, just friggin use nano. Or sublime.&quot;</i><p>Words to live by.
olalondeabout 10 years ago
Tip: I recently looked up the man page for &quot;which&quot; and found out about the -a flag which will list all instances of the executable found (instead of just the first one). Incredibly useful when you have multiple installations of the same software and it&#x27;s causing problems. e.g.:<p><pre><code> $ which -a ruby &#x2F;Users&#x2F;olalonde&#x2F;.rbenv&#x2F;shims&#x2F;ruby &#x2F;usr&#x2F;local&#x2F;bin&#x2F;ruby &#x2F;usr&#x2F;bin&#x2F;ruby</code></pre>
kbakerabout 10 years ago
To exit vim use &lt;ESC&gt; :wq, not just :wq - most of the problem is it getting stuck in insert mode, and not knowing how to escape into normal mode.
评论 #9199008 未加载
评论 #9198737 未加载
评论 #9199391 未加载
zanabout 10 years ago
Thanks guys, I&#x27;ll collect these thoughts and add them to the blogpost. After all, I want this to be available to all and every one of us!
voidhorseabout 10 years ago
I love playing around in bash. Most of the scripts I have right now are just for setting up project templates, adding common packages etc.<p>Actually, I think most people who use computers at work, be they writers, designers, whatever, not just programmers, would benefit from learning some bash (or batch). You can automate a lot of useful processes with a few simple scripts.
blueblobabout 10 years ago
don&#x27;t type `cd ~` just type `cd`
评论 #9198694 未加载
评论 #9198690 未加载
throw7about 10 years ago
1. I like tab-completion, but I can&#x27;t personally stand bash&#x27;s completion feature. Be aware of differences.<p>2. If you want to save your command without running it... comment it out with a &#x27;#&#x27;. Bang, it&#x27;s in your history.
tieTYTabout 10 years ago
This is probably misunderstanding the demographic, but why does he suggest using nano over vim?
评论 #9199275 未加载
评论 #9200587 未加载