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.

Ask HN: How can I get better at bash?

286 pointsby cocolosalmost 8 years ago
I am interested mainly in bash helping me with the workflow of apps I run on the command line.

79 comments

SEJeffalmost 8 years ago
As silly as it sounds, when I was a new Unix SysAdmin, I read the entirety of &quot;man 1 bash&quot;, which includes all bash builtins. I found that it improved by bash-foo 100x simply by knowing about so many of the utilities. I also took some cliff notes for things that seemed generally useful.<p>I did it for an hour or so a night for a week or so.<p>That being said, a few of my personal favorites to memorize:<p>* Parameter expansion: <a href="https:&#x2F;&#x2F;www.gnu.org&#x2F;software&#x2F;bash&#x2F;manual&#x2F;html_node&#x2F;Shell-Parameter-Expansion.html" rel="nofollow">https:&#x2F;&#x2F;www.gnu.org&#x2F;software&#x2F;bash&#x2F;manual&#x2F;html_node&#x2F;Shell-Par...</a><p>* All of test(1) as you can use them in any if statement (&#x2F;usr&#x2F;bin&#x2F;[ is a real command!): <a href="https:&#x2F;&#x2F;linux.die.net&#x2F;man&#x2F;1&#x2F;test" rel="nofollow">https:&#x2F;&#x2F;linux.die.net&#x2F;man&#x2F;1&#x2F;test</a><p>* Knowing most of the bash internal variables: <a href="http:&#x2F;&#x2F;tldp.org&#x2F;LDP&#x2F;abs&#x2F;html&#x2F;internalvariables.html" rel="nofollow">http:&#x2F;&#x2F;tldp.org&#x2F;LDP&#x2F;abs&#x2F;html&#x2F;internalvariables.html</a><p>* Keyboard shortcuts and how they are useful. A few example: CTRL-l (no need to ever use &#x2F;usr&#x2F;bin&#x2F;clear), CTRL-k, CTRL-u, CTRL-e, CTRL-a, CTRL-w, CTRL-arrow left, CTRL-arrow right, CTRL-r (history reverse search with find as you type autocomplete)<p>The best way you can learn the shell is by using Linux as your primary desktop for at least a few months. You&#x27;ll get very proficient very quickly by doing that.
评论 #14639098 未加载
评论 #14641165 未加载
评论 #14638968 未加载
评论 #14638726 未加载
评论 #14641242 未加载
评论 #14638452 未加载
seorphatesalmost 8 years ago
Most of the responses here so far that do not include some sort of a guide are not the responses you&#x27;re looking for (imho).<p>Mind your pipes and quotes. Guard your variables with braces. Do not export everything, test for and (try to) handle return codes and conditions and keep it simple (emphasis simple) but most of all just write it.<p>BASH (or Bourne) is ubiquitous when dealing with systems (vs programs). You don&#x27;t need to be on the fashionable lang of the day by any measure. BASH, for most cases, will always be there, always ready and, in most cases, is the default human interface for deployed systems. As scripting languages go you don&#x27;t need &quot;better&quot;, you need dependability, zero dependencies with no requirement for modules or any other whizbangwoohoo plug-in. Language Fashionistas and personal preferences aside at least some level of fluency with BASH should be mandatory for anyone interfacing with a system.
评论 #14637867 未加载
评论 #14637640 未加载
评论 #14637909 未加载
soheilproalmost 8 years ago
I have written a simple tool called mann (<a href="https:&#x2F;&#x2F;github.com&#x2F;soheilpro&#x2F;mann" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;soheilpro&#x2F;mann</a>) to help me remember little things that I learn when working in Bash&#x2F;Zsh.<p>Basically, every time I learn something useful about a command, I add it to its mann page and then whenever I need it in the future, I simply run &#x27;mann &lt;command&gt;&#x27; to find it.<p>Here&#x27;s the current output of my &#x27;mann sed&#x27;, for example:<p><pre><code> # Add char to beginning of each line sed &#x27;s&#x2F;^&#x2F;#&#x2F;&#x27; # Replace with newline sed &#x27;s&#x2F;&lt;oldvalue&gt;&#x2F;\&#x27;$&#x27;\n&#x27;&#x27;&#x2F;g&#x27; # Replace newline sed -e &#x27;:a&#x27; -e &#x27;N&#x27; -e &#x27;$!ba&#x27; -e &#x27;s&#x2F;\n&#x2F;&lt;newvalue&gt;&#x2F;g&#x27; # Plus sign sed -E &#x27;s&#x2F;foo+&#x2F;bar&#x27; # Digit sed -E &#x27;s&#x2F;[[:digit:]]&#x2F;bar&#x27; # Inplace sed -i&#x27;.bak&#x27; -e &lt;pattern&gt; &lt;file&gt;</code></pre>
评论 #14639258 未加载
koala_manalmost 8 years ago
If you&#x27;re not already familiar with it, I would suggest learning about the basic Unix process model -- fork, execve, wait, open, pipe, dup2 and friends.<p>Bash is essentially a DSL for these. A lot of the weirdness you see in the language is due to these abstractions leaking through. For example:<p>* Quoting is building execve&#x27;s argv parameter. It&#x27;s hard to quote correctly if you don&#x27;t know what exactly you&#x27;re working towards.<p>* Redirections are opening and copying file descriptors. It explains their scope, order and nesting behavior.<p>* Variables are modifying and passing the environment, and their weird scope is due to forks imposed by the process model.<p>Once you know how you can do whatever you want in C through the basic syscalls, Bash is an extremely efficient and far less surprising shortcut to do it.
评论 #14640075 未加载
评论 #14639543 未加载
nunullalmost 8 years ago
Not the first thing to look for, but I&#x27;ve found ShellCheck[1] to be pretty helpful when it comes to correcting typical mistakes.<p>[1]: <a href="https:&#x2F;&#x2F;github.com&#x2F;koalaman&#x2F;shellcheck" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;koalaman&#x2F;shellcheck</a>
评论 #14635620 未加载
评论 #14642951 未加载
aMaynalmost 8 years ago
Read Greg&#x27;s wiki - BashGuide: <a href="http:&#x2F;&#x2F;mywiki.wooledge.org&#x2F;BashGuide" rel="nofollow">http:&#x2F;&#x2F;mywiki.wooledge.org&#x2F;BashGuide</a>
评论 #14636784 未加载
agentgtalmost 8 years ago
Besides the obvious answers of just reading the manual, looking up howtos, and stackoverflow I can recommend some habits that might increase your uptake of bash.<p>1. If you are not running a unix as your default OS switch to one (ie Linux or Mac).<p>2. Create a bin (~&#x2F;bin) directory in your home directory of all your shells scripts and source control it. Any script you ever write put in that directory. Even if its not bash (ie python, perl). I find that it is critical to look at how you did things previously to help you learn as well as it saves time.<p>3. Any command that is complicated one liner that you create or see on the internet... create script and put in the bin directory mentioned above.<p>4. Optimize your personal bin directory and review frequently.<p>5. If you run Linux build your system from scratch (ie read Linux from scratch).<p>6. Bonus to the above: Automate the creation of your personal system through Packer and Bash!<p>7. Find where things are not automated.<p>8. Bash is more than just the shell. A knowledge of GNU coreutils as well as tmux&#x2F;screen is worthwhile and highly recommended.<p>9. Learn the readline shortcuts. Particularly &quot;ctrl-r&quot;.
评论 #14683821 未加载
bhaakalmost 8 years ago
How about you don&#x27;t? Bash as scripting language is rather mediocre.<p>Anything that is not simple in bash gets hard to read and debug and probably is wrong on some subtle levels.<p>I have a rule of thumb that any shell script that grows beyond a screenful of lines gets redone in a proper scripting language.
评论 #14635750 未加载
评论 #14635363 未加载
评论 #14635402 未加载
评论 #14636602 未加载
评论 #14635455 未加载
评论 #14635623 未加载
评论 #14636747 未加载
评论 #14639718 未加载
rajeshmralmost 8 years ago
Figure out a problem and try solving it in bash - bash for beginners guide on tldp site can get you started. You get better as you use it.<p><a href="http:&#x2F;&#x2F;www.tldp.org&#x2F;LDP&#x2F;Bash-Beginners-Guide&#x2F;html&#x2F;" rel="nofollow">http:&#x2F;&#x2F;www.tldp.org&#x2F;LDP&#x2F;Bash-Beginners-Guide&#x2F;html&#x2F;</a><p>EDIT : Additional links -<p>Advanced - <a href="http:&#x2F;&#x2F;tldp.org&#x2F;LDP&#x2F;abs&#x2F;html&#x2F;" rel="nofollow">http:&#x2F;&#x2F;tldp.org&#x2F;LDP&#x2F;abs&#x2F;html&#x2F;</a><p>Bash programming - <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>
评论 #14635606 未加载
fergiealmost 8 years ago
Train yourself to take the 20 minutes required to learn to &quot;do it the right way&quot; every time you need to. Its so easy not to bother because you are busy but in the long run you will save time.
评论 #14637193 未加载
评论 #14637238 未加载
felixschlalmost 8 years ago
Read the manual front to back and install shellcheck. Doing both things has paid off for me a thousand times over. The rest is practice. Complete the bash exercises on Hackerrank. Bash is fantastic in it&#x27;s domain but it does require serious study in my experience
评论 #14637341 未加载
antirezalmost 8 years ago
The Tcl programming language is what shell scripting should be, basically. It is not just a language with all the features you need, it has explicit Unix shell alike scripting capabilities and strong DSL abilities. An example two-liner:<p><pre><code> set files [glob &#x2F;etc&#x2F;*.conf] foreach f $files {file lstat $f file_info; puts &quot;$f: $file_info(size)&quot;} &#x2F;etc&#x2F;asl.conf: 1051 &#x2F;etc&#x2F;autofs.conf: 1935 &#x2F;etc&#x2F;dnsextd.conf: 2378 ... and so forth ... </code></pre> Also there is an `exec` command that supports pipes, redirections, and so forth:<p><pre><code> set result [exec cat &#x2F;etc&#x2F;passwd | grep Directory] </code></pre> The pipe has no special meaning in Tcl, but because of its DSL capabilities you can do things like that. Exec is a DSL basically.
soveranalmost 8 years ago
For scripting, I recommend the rc shell from plan9, which is the one I use for my shell scripts. It is only when I want to share a script with other people that I consider using &#x2F;bin&#x2F;sh, and even then more often than not I&#x27;ve gone for rc.<p>I invite you to read about it: <a href="http:&#x2F;&#x2F;doc.cat-v.org&#x2F;plan_9&#x2F;4th_edition&#x2F;papers&#x2F;rc" rel="nofollow">http:&#x2F;&#x2F;doc.cat-v.org&#x2F;plan_9&#x2F;4th_edition&#x2F;papers&#x2F;rc</a>.<p>I find the control structures simpler and more elegant, and overall its design feels more consistent. For example, consider an if statement in bash:<p><pre><code> if [ condition ]; then ... else ... fi </code></pre> And now in rc:<p><pre><code> if (condition) { ... } else { ... } </code></pre> Or a case statement in bash:<p><pre><code> case $1 in &quot;bar&quot;) ... ;; &quot;baz&quot;) ... ;; esac </code></pre> And expressed in rc:<p><pre><code> switch ($1) { case &quot;bar&quot; ... case &quot;baz&quot; ... } </code></pre> In the past, I&#x27;ve used it as my shell too, but now I use it only for scripting. I think you can install it in most platforms.
评论 #14638957 未加载
benjamincburnsalmost 8 years ago
I recommend starting w&#x2F; Gary Bernhardt&#x27;s excellent &quot;Tar Pipe&quot; blog post.<p><a href="https:&#x2F;&#x2F;web.archive.org&#x2F;web&#x2F;20161227222637&#x2F;http:&#x2F;&#x2F;blog.extracheese.org&#x2F;2010&#x2F;05&#x2F;the-tar-pipe.html" rel="nofollow">https:&#x2F;&#x2F;web.archive.org&#x2F;web&#x2F;20161227222637&#x2F;http:&#x2F;&#x2F;blog.extra...</a><p>From there, move on to using the shell as your IDE. How? First, understand the Unix philosophy. I think Ted Dzubia describes this pretty well in his Taco Bell Programming blog posting:<p><a href="http:&#x2F;&#x2F;widgetsandshit.com&#x2F;teddziuba&#x2F;2010&#x2F;10&#x2F;taco-bell-programming.html" rel="nofollow">http:&#x2F;&#x2F;widgetsandshit.com&#x2F;teddziuba&#x2F;2010&#x2F;10&#x2F;taco-bell-progra...</a><p>Great, so now you understand that there are a bunch of useful tools out there and you can string them together to do great things. Now you need to discover the tools themselves.<p>If you&#x27;re a &quot;read the dictionary&quot; kind of person, go ahead and start off w&#x2F; the Gnu Coreutils documentation. <a href="https:&#x2F;&#x2F;www.gnu.org&#x2F;doc&#x2F;doc.html" rel="nofollow">https:&#x2F;&#x2F;www.gnu.org&#x2F;doc&#x2F;doc.html</a><p>However, if you&#x27;re like me you&#x27;ll learn fastest by watching other people work. In this case, I have to point back to Gary Bernhardt again. Specifically, his &quot;Composing a Unix Command Line&quot; screencast will open your eyes <i>wide</i> and very quickly introduce you to a range of incredibly useful coreutils programs in the context of solving a very specific problem. This content is $29&#x2F;mo, but I&#x27;d argue it&#x27;s money well spent. <a href="https:&#x2F;&#x2F;www.destroyallsoftware.com&#x2F;screencasts&#x2F;catalog&#x2F;composing-a-unix-command-line" rel="nofollow">https:&#x2F;&#x2F;www.destroyallsoftware.com&#x2F;screencasts&#x2F;catalog&#x2F;compo...</a>
brianon99almost 8 years ago
Flame war between bash&#x2F;fish&#x2F;zsh&#x2F;powershell is almost meaningless to beginners, because the basic skills are common to all shells. (That said, you will love zsh once you use it)<p>I learned to use shell, about 7 years ago, by reading O&#x27;Reilly &quot;Classic Shell Scripting&quot;. It is well written, and teach you something that you can hardly learn from google. But don&#x27;t try to remember everything, especially those advanced string manipulation syntax, because one would usually use a scripting language such as ruby for advanced job.
评论 #14635622 未加载
wingerlangalmost 8 years ago
Helping you how? If you actually have a problem you are trying to solve, then do just that. My experience with command line came from solving problems I had. Today I do a lot in the command line and I am learning new things all the time. However if I just wanted to get &quot;better&quot; at it, then I don&#x27;t even know where to start because there is no clear goal.
评论 #14635244 未加载
fiatjafalmost 8 years ago
I wanted to get better at bash too, but instead I ended up getting everything[1] done at fish, which is cool, much better as a language, but no environment has fish pre-installed nowadays.<p>[1]: <a href="https:&#x2F;&#x2F;github.com&#x2F;fiatjaf&#x2F;react-site" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;fiatjaf&#x2F;react-site</a>
brad0almost 8 years ago
Don&#x27;t listen to the guys who are saying not to learn bash. In the right circumstance bash is much better than any verbose python script.<p>I&#x27;d say learn the following topics:<p>pipe grep sed awk find<p>Once you feel comfortable using and combining these tools you should be able to find out the rest by yourself.
评论 #14638352 未加载
评论 #14639301 未加载
moondevalmost 8 years ago
I used to lean on python for much of my scripting needs, mainly because the more advanced bash syntax was pretty daunting. Getting better at bash has a trickle-down effect, especially in this container age. ENV var scoping + loops and various var expansion methods really made it click for me. Shelling out to various tasks (and grabbing the results) is effortless via bash scripts. With bash on windows now it&#x27;s pretty much ubiquitous. My advice is to consider why the task at hand can&#x27;t be done in bash, because often times it can, with much more portability.
评论 #14635415 未加载
peterwwillisalmost 8 years ago
From a 14+ year Linux&#x2F;Unix admin:<p>Get a very brief reference book of every common UNIX command. Read all the commands, what they do, what options they take. Start using them.<p>Shells are most useful when they are used to tie together other programs. In order to do this, you have to know what all the command-line tools you have at your disposal are. Learn the tools, then start writing examples using them. Keep the examples and the docs somewhere to reference them later.<p>For quick reference, the command &#x27;whatis&#x27; will give a blurb from the top of the command&#x27;s man page. `whatis ls&#x27; &quot;ls (1) - list directory contents&quot;. View many at once with &quot;(cd &#x2F;usr&#x2F;bin; whatis * | grep -v noth)&quot;. Many often-used commands come in &quot;util-linux&quot; and &quot;coreutils&quot; packages. Read man pages completely when convenient.<p>It may also help to have a VM or desktop which has no GUI, where you will be forced to use the command-line. When I was starting out I used a desktop with no X server for months. You can get a lot more done than you think (and &#x27;links -g&#x27; provides a graphical browser if you need images)<p>To learn more about Bash itself, you can look for server installation software packages made with Bash, or in the &quot;init&quot; tools distributed with big distros like RedHat, SuSE, etc before they used systemd. But it&#x27;s better to get used to more shell-agnostic scripting using UNIX commands than it is to use Shell-specific language&#x2F;syntax.
评论 #14639550 未加载
3pt14159almost 8 years ago
I&#x27;m ok at bash, but I do not default to complicated bash scripts for my needs. I make little reusable tools. For example I have a tool aliased that makes it easy to apply quick ruby code. For example<p>echo &quot;345.44<p>544.50&quot; | rg &quot;€#{l}: €#{(l.to_f * 3).to_i}&quot;<p>Produces the following output:<p>€345.44: €1036<p>€544.50: €1633<p>Based on this code:<p><a href="https:&#x2F;&#x2F;gist.github.com&#x2F;zachaysan&#x2F;4a31386f944ed31a3f8a920c85bddbb9" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;zachaysan&#x2F;4a31386f944ed31a3f8a920c85...</a><p>I find it&#x27;s much faster to be productive like this than it is to try to do the same with ruby -e because I really only want to manipulate single incoming lines. I don&#x27;t want to have to write the looping code or the code that sets variables or what have you.<p>Also, sometimes it gets confusing what tools are just bash functions or alias and which are scripts, so if you ever forget what a tools definition is just type:<p>type toolname<p>As for actually answering your question, look at your friend&#x27;s dotfiles on their github account to learn which tools and tricks they use and when you don&#x27;t know how something works ask them questions. People will usually point you in the right direction.
评论 #14636760 未加载
jaymzcampbellalmost 8 years ago
One thing I would say is first check that you are running the latest version! There has been a lot of development to bash over the years. If you feel like customizing things a lot I&#x27;d check out zsh and <a href="http:&#x2F;&#x2F;ohmyz.sh&#x2F;" rel="nofollow">http:&#x2F;&#x2F;ohmyz.sh&#x2F;</a>. It has a lot compatible with bash with (IMO) some saner scripting support.<p>Aliases are something I use a lot - it&#x27;s very basic but just having &quot;big long command with options&quot; aliases to something easy to remember makes it much more likely I will not make mistakes, can repeat it easily in loops.<p>Another thing that complements using bash effectively are using other applications config files. As soon as I have a new host to interact with I add it to my ssh.config file - then any scripting I need to do I don&#x27;t need to deal with any special files. Other files like ~&#x2F;.netrc or ~&#x2F;.pgpass make my shell sessions that much more productive. For some reason many people don&#x27;t bother ever updating these and rely on the shell history to do anything more than once.<p>CommandlineFu (<a href="http:&#x2F;&#x2F;www.commandlinefu.com&#x2F;commands&#x2F;browse" rel="nofollow">http:&#x2F;&#x2F;www.commandlinefu.com&#x2F;commands&#x2F;browse</a>) has some nice one liners and there&#x27;s often some gems on ServerFault (<a href="https:&#x2F;&#x2F;serverfault.com&#x2F;questions&#x2F;tagged&#x2F;bash" rel="nofollow">https:&#x2F;&#x2F;serverfault.com&#x2F;questions&#x2F;tagged&#x2F;bash</a>) - just browsing those for topics matching your workflow can be very fruitful.<p>I&#x27;ve found the more I do anything at the shell of any complexity I end up writing a small python command line client to do any heavy lifting. Argparse (<a href="https:&#x2F;&#x2F;docs.python.org&#x2F;3&#x2F;library&#x2F;argparse.html" rel="nofollow">https:&#x2F;&#x2F;docs.python.org&#x2F;3&#x2F;library&#x2F;argparse.html</a>) makes this trivially easy and then I can use regular shell &quot;glue&quot; to combine a few commands together.
majewskyalmost 8 years ago
In addition to what others said, I can recommend just reading through the manpage once (probably in multiple sittings). Even if you don&#x27;t remember the exact syntax, you will have an idea what bash <i>can</i> do, and know enough of the jargon to find it again in the manpage when you need it. For example, when I need to replace a substring, I used to do<p><pre><code> FOO=&quot;Hello World&quot; ... BAR=&quot;$(echo &quot;$FOO&quot; | sed &quot;s&#x2F;World&#x2F;Hacker News&#x2F;&quot;)&quot; </code></pre> until I remembered that bash can do string replacement by itself. A quick search for &quot;pattern&quot; and &quot;substitute&quot; in the manpage turned up the right syntax,<p><pre><code> BAR=&quot;${FOO&#x2F;World&#x2F;Hacker News}&quot;</code></pre>
评论 #14635362 未加载
评论 #14635345 未加载
kazinatoralmost 8 years ago
Forget the Bash man page (just temporarily, that is) and read this:<p><a href="http:&#x2F;&#x2F;pubs.opengroup.org&#x2F;onlinepubs&#x2F;9699919799&#x2F;utilities&#x2F;V3_chap02.html" rel="nofollow">http:&#x2F;&#x2F;pubs.opengroup.org&#x2F;onlinepubs&#x2F;9699919799&#x2F;utilities&#x2F;V3...</a><p>The POSIX specification of the Shell Command Language.<p>Also, don&#x27;t overlook that there is a GNU Info manual for Bash, not just the manual page:<p><a href="https:&#x2F;&#x2F;www.gnu.org&#x2F;software&#x2F;bash&#x2F;manual&#x2F;html_node&#x2F;index.html" rel="nofollow">https:&#x2F;&#x2F;www.gnu.org&#x2F;software&#x2F;bash&#x2F;manual&#x2F;html_node&#x2F;index.htm...</a>
andaialmost 8 years ago
I was about to post:<p>&gt; Add, &quot;#! &#x2F;usr&#x2F;bin&#x2F;python&quot; to the top of your scripts, it will make your life easier.<p>However, after reading the rest of the thread, it seems Python and similar langs are not actually great for the kind of things people use Bash for, and Perl is the way to go!<p>Great, another language to learn...<p>edit, re: python:<p>fiatjaf suggested xon.sh:<p>&quot;shell language and command prompt [..] based on Python, with additional syntax added that makes calling subprocess commands, manipulating the environment, and dealing with the file system easy.<p><a href="http:&#x2F;&#x2F;xon.sh&#x2F;tutorial" rel="nofollow">http:&#x2F;&#x2F;xon.sh&#x2F;tutorial</a>
alexpetraliaalmost 8 years ago
I learned bash primarily for practical reasons (ie. navigating in Linux, parsing files, searching for text) and nothing more. Definitely not from a DevOps or SysAdmin point of view as I&#x27;m sure fits the background of many commenters in this thread.<p>If your use case is pragmatic in nature, I would recommend my post on the topic: <a href="http:&#x2F;&#x2F;alexpetralia.com&#x2F;posts&#x2F;2017&#x2F;6&#x2F;26&#x2F;learning-linux-bash-to-get-things-done" rel="nofollow">http:&#x2F;&#x2F;alexpetralia.com&#x2F;posts&#x2F;2017&#x2F;6&#x2F;26&#x2F;learning-linux-bash-...</a>
yamanekoalmost 8 years ago
Take a look at this tutorial [1]. It will teach you some shortcuts, a bit of shell expansion, and help you set sane defaults in bash. One that I&#x27;m particular fond is to set<p><pre><code> &quot;\e[A&quot;: history-search-backward &quot;\e[B&quot;: history-search-forward </code></pre> in your ~&#x2F;.inputrc. So, if you are typing a command which begins with &quot;git&quot;, it will only search in history for commands that start with git (instead of returning all commands that may include the string &#x27;git&#x27; like Ctrl+r). Having trouble trying to remember that option you passed to `git log`? Just type in `git log` and press the up arrow to find your last usages.<p>I think it is also helpful to learn Emacs or vim keybindings. I use Emacs keybindings in bash a lot (enabled by default). I have summarized the ones that I used more often in a previous comment [2].<p>[1]: <a href="https:&#x2F;&#x2F;www.ukuug.org&#x2F;events&#x2F;linux2003&#x2F;papers&#x2F;bash_tips&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.ukuug.org&#x2F;events&#x2F;linux2003&#x2F;papers&#x2F;bash_tips&#x2F;</a><p>[2]: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=13404262" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=13404262</a>
chingjunalmost 8 years ago
Just like how you learn any other programming language: use it to solve your problems.<p>Anyway, here&#x27;s a few steps that I would recommend:<p>1. Go through <a href="http:&#x2F;&#x2F;tldp.org&#x2F;LDP&#x2F;abs&#x2F;html&#x2F;" rel="nofollow">http:&#x2F;&#x2F;tldp.org&#x2F;LDP&#x2F;abs&#x2F;html&#x2F;</a> and <a href="http:&#x2F;&#x2F;www.tldp.org&#x2F;LDP&#x2F;Bash-Beginners-Guide&#x2F;html&#x2F;" rel="nofollow">http:&#x2F;&#x2F;www.tldp.org&#x2F;LDP&#x2F;Bash-Beginners-Guide&#x2F;html&#x2F;</a> , or at least go through the table of contents so that you have a feeling of what bash is capable of. A few important things are: if, while, for, switch, functions, string manipulation, pipe, subshell, command substitution<p>2. Understand the execution model. Variables in subshell cannot be accessed from the parent shell, this is a common mistake<p>3. Learn to avoid common pitfalls. I always recommend my colleagues to always quote the variables in double quote, always use &quot;$@&quot; instead of &quot;$*&quot;, always use double square bracket instead of single square bracket for testing, use echo to pass return value from functions instead of assigning to global variable<p>4. Learn awk, sed, grep. Bash can be quite limiting when it comes to data processing and these tools can be quite powerful. You can use bash to glue different filters together at a higher level.<p>Bash is a fantastic language and there are quite a lot of things that can be much more quickly in bash than in other &quot;proper&quot; languages. A lot of people says that it&#x27;s too difficult to maintain a shell script beyond a &quot;critical mass&quot; but I believe that if you follow good practices and write modular codes, shell scripts can be very manageable.
rogeruizalmost 8 years ago
If you&#x27;re interested in getting better at the terminal, I recommend you learn how to customize it. it&#x27;ll really help you learn by doing and figuring out what it is you want to learn how to do first.<p>It&#x27;s what worked for me, though. There are also some workflow ideas that have really helped a lot. Autocompletion and being about to look through your history for commands is super helpful too.<p>``` cat $HOME&#x2F;.bash_history | grep -E &#x27;command|argument&#x27; ```<p><a href="https:&#x2F;&#x2F;github.com&#x2F;zsh-users&#x2F;zsh-autosuggestions" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;zsh-users&#x2F;zsh-autosuggestions</a><p>I just finished a guid on my site about my terminal setup. I hope to read yours once you&#x27;ve customized the pixels out of it.<p>Aside from things to get your interested in the internals of your shell via bash scripting, you should also consider writing more shell scripts specifically around your workflows. I keep mine in a .files repo on GitHub. Take a look at the install script. It took me over a year to get really fluent in bash scripting enough to make it possible to get better and better at it.<p>Good luck on your journey!
lcriscialmost 8 years ago
Bookmark the following url and come back to it as often as you need:<p><a href="http:&#x2F;&#x2F;tldp.org&#x2F;LDP&#x2F;abs&#x2F;html&#x2F;" rel="nofollow">http:&#x2F;&#x2F;tldp.org&#x2F;LDP&#x2F;abs&#x2F;html&#x2F;</a><p>Also this one to learn some cool tricks:<p><a href="http:&#x2F;&#x2F;www.commandlinefu.com&#x2F;commands&#x2F;browse" rel="nofollow">http:&#x2F;&#x2F;www.commandlinefu.com&#x2F;commands&#x2F;browse</a>
评论 #14639085 未加载
madhadronalmost 8 years ago
First, if your bash script grows beyond about ten lines, it&#x27;s time to consider rewriting it in a cleaner language. Python&#x27;s a common one. I used to use Haskell for that kind of scripting as well, which was astonishingly good at it.<p>Here&#x27;s my study suggestion:<p>0. Learn to use variable interpolation and backticks.<p>1. if blocks and the [ built-in function. Go read about the grammar and look at the flags that [ takes. Memorize the most common couple (file exists, is a directory), and know how to look up the others when needed. Find examples of variable interpolation tricks needed to make this function.<p>2. for and while blocks. Learn the grammer. for is mostly useful with `seq ...` or a file glob.<p>3. Learn some of the options to make bash fail early and loudly like pipefail.<p>4. Most of the power of bash is in the programs you call, and they aren&#x27;t always the same ones you use interactively. Other folks have mentioned some of these. find, xargs, wait...
评论 #14637832 未加载
评论 #14638713 未加载
tehwalrusalmost 8 years ago
Set your default shell to bash, and every time something annoys you, look up how to fix it (stack overflow is basically complete at this point, if you know what to search for) and put it in your dotfiles.<p>I used to rely on fish, but after a couple of bugs (either in fish or my fingers, not sure) I switched back to bash at my job (on a Linux desktop).<p>After a few months I had built up a good set of aliases and functions (my most used function is rgrep, see below) and was confidently ^R reverse searching and so on. These things are great because as you jump systems (e.g. to macOS) they continue to work.<p>TLDR: Practise practise practise!<p><pre><code> # the rgrep function # recursive text file search from the current directory. function rgrep { if [ -z &quot;$1&quot; ]; then echo &quot;please supply a search string.&quot; return 1 fi grep -rn $1 . }</code></pre>
评论 #14639392 未加载
评论 #14639411 未加载
gexlaalmost 8 years ago
As an alternative, you could also look into PowerShell. it&#x27;s open source and cross platform. I use it because it&#x27;s really powerful on Windows.<p>In any programming language, you learn by practice. Given that your shell does so much, that&#x27;s the easiest place to find tasks to practice on. I have been leaning on my shell scripts to do a lot of automation. The list is long and I just pick something from that list to work on for most days.<p>If you don&#x27;t have system automation that you want to work on, then you probably have a lot of personal data that you can work with. I have scripts setup to manipulate data exports from the various services I consume and then remix that data in my own database. My shell scripts can get the data, operate on it and then shove it into a DB. Then I&#x27;ll use something else to display that data.
kusmialmost 8 years ago
<a href="https:&#x2F;&#x2F;www.gnu.org&#x2F;software&#x2F;bash&#x2F;manual&#x2F;bash.txt" rel="nofollow">https:&#x2F;&#x2F;www.gnu.org&#x2F;software&#x2F;bash&#x2F;manual&#x2F;bash.txt</a><p>I like bash for the same reason I like emacs, in that no matter what the environment is like, I can usually count on my bash scripts to work. I keep them in emacs org-mode files where I store them in src code blocks. I can tangle multiple code blocks into single executable scripts to different directories. Check out org-mode babel, tangeling, and noweb. Keeping all my bash code in a single file solves my issue with having to dig for that one script I wrote that one time because I forgot how to do this one thing ...<p>If you aren&#x27;t running Linux on your desktop yet, consider it. Full immersion is a fast way to learn.
sethrinalmost 8 years ago
I wrote a thing for this! People should read it! Focus is on usage, not scripting.<p>What Kai Thinks Every Developer Should Know About the Shell<p><a href="https:&#x2F;&#x2F;github.com&#x2F;tenebrousedge&#x2F;shell_guide" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;tenebrousedge&#x2F;shell_guide</a>
dredmorbiusalmost 8 years ago
1. Use it.<p>2. Conceive of use-cases you can&#x27;t already solve, and see if you can find a way to do them using Bash.<p>3. Consider that perhaps Bash isn&#x27;t the best tool for every job. (It most certainly isn&#x27;t, though you can abuse it frightfully.)<p>4. Books. Jerry Peek&#x27;s guides are getting rather dated, but they&#x27;re still a good introduction.<p>5. Read the manpage. Frequently. Find some part of it that doesn&#x27;t make sense, or that you haven&#x27;t played with before, and play with it. Shell substitutions, readline editing, parameter substitution, shell functions, math, list expansions, loops, tests, are all high-payoff areas.<p>6. Take a hard look at zsh, which does a great deal Bash doesn&#x27;t.
oddlyalmost 8 years ago
Do some puzzles(wargames). For example: <a href="http:&#x2F;&#x2F;overthewire.org&#x2F;wargames&#x2F;" rel="nofollow">http:&#x2F;&#x2F;overthewire.org&#x2F;wargames&#x2F;</a><p>It will make you search for several special use cases and will give you some experience with the command line. Basically, you SSH into a box, solve a problem and the solution for that problem is the password for the next SSH connection for the next problem.<p>This one is for beginners: <a href="http:&#x2F;&#x2F;overthewire.org&#x2F;wargames&#x2F;bandit&#x2F;" rel="nofollow">http:&#x2F;&#x2F;overthewire.org&#x2F;wargames&#x2F;bandit&#x2F;</a>
remysharpalmost 8 years ago
This doesn&#x27;t work for everyone, but if you find allow yourself time, trying to solve specific problems you face (asking: could I automate this? Could this be simpler?) is a great way to get better - and how I learnt my way through bash.<p>I recently released <a href="https:&#x2F;&#x2F;terminal.training" rel="nofollow">https:&#x2F;&#x2F;terminal.training</a> (paid course for 4 hours) which is just for this kind of question, but I&#x27;ve also started a free mini email course (same URL) that tries to share some of the CLI shortcuts I&#x27;ve come to rely on over the years.
onion2kalmost 8 years ago
Depending on your level, there&#x27;s <a href="https:&#x2F;&#x2F;terminal.training&#x2F;" rel="nofollow">https:&#x2F;&#x2F;terminal.training&#x2F;</a> (by the same chap who runs jsbin).
tinus_hnalmost 8 years ago
In my opinion the most important thing to know about shell scripting is when not to use it. The shell is very powerful but also clumsy for tasks that exceed the basics.
raboukhalilalmost 8 years ago
A while back, I wrote a quick Bash guide called &quot;Adventures in Data Science with Bash&quot; (<a href="https:&#x2F;&#x2F;gumroad.com&#x2F;l&#x2F;datascience" rel="nofollow">https:&#x2F;&#x2F;gumroad.com&#x2F;l&#x2F;datascience</a>).<p>It covers basic Bash commands (head, less, grep, cut, sort, uniq, curl, awk, join), but also pipes, for loops, variables, arrays, and command substitution.
chuckmcknightalmost 8 years ago
Work through the Advanced Bash Scripting Guide (<a href="http:&#x2F;&#x2F;freecode.com&#x2F;projects&#x2F;advancedbashscriptingguide&#x2F;" rel="nofollow">http:&#x2F;&#x2F;freecode.com&#x2F;projects&#x2F;advancedbashscriptingguide&#x2F;</a>). It&#x27;s a great resource and is one that I turn to when I need to remind myself of how to do something.
yellowapplealmost 8 years ago
The best I can really recommend is practice. A lot of &quot;bash&quot; skill comes not from bash itself, but rather from the tools around it.<p>If you&#x27;re not already comfortable with input&#x2F;output redirection (including pipes, as well as reading from &#x2F; writing to files via &lt;file &#x2F; &gt;file, respectively), then that&#x27;s where I&#x27;d start.
lottinalmost 8 years ago
The shell language itself is pretty simple and featureless. It relies on the system utilities for most things so once you know the basics of how the shell works you should probably focus on learning those rather than bash. Also I find that when it comes to interactive use having good key bindings and some nice aliases makes a lot of difference.
INTPenisalmost 8 years ago
Use it daily. Use it instead of your graphical file explorer options.<p>Everything will take longer but imho it&#x27;s the only way to get better.
nikivialmost 8 years ago
I made a search engine to show the best learning paths for learning any topics.<p>Here is the path for learning bash : <a href="https:&#x2F;&#x2F;learn-anything.xyz&#x2F;operating-systems&#x2F;unix&#x2F;shells&#x2F;bash" rel="nofollow">https:&#x2F;&#x2F;learn-anything.xyz&#x2F;operating-systems&#x2F;unix&#x2F;shells&#x2F;bas...</a>
psychobabblealmost 8 years ago
This article posted here last year has some excellent tips in advancing your bash-fu, many have been mentioned here but has some extras as well:<p><a href="http:&#x2F;&#x2F;samrowe.com&#x2F;wordpress&#x2F;advancing-in-the-bash-shell" rel="nofollow">http:&#x2F;&#x2F;samrowe.com&#x2F;wordpress&#x2F;advancing-in-the-bash-shell</a>
chasilalmost 8 years ago
GNU BASH is a branch of the Bourne-shell family.<p>Korn shell is a much more complete and capable variant of Bourne. BASH partially implemented many Korn features, but not everything.<p>The standard reference is the Korn and Bolsky book (2nd edition). I&#x27;m not aware of any free&#x2F;online resources that are profoundly good.<p>Korn is the very best for scripting.
boonaalmost 8 years ago
I&#x27;m not sure if this answers your question since I&#x27;m not sure what the implications of your workflow are, but I got a huge jump in productivity with Oh My Zsh. It has a bunch of features like tab completing past commands, it includes various shortcuts, etc. It&#x27;s also compatible with bash.
TheGrassyKnollalmost 8 years ago
Its considered kind of a security risk, but I like to save ALL of my commands: (put this in .bashrc)<p><pre><code> export PROMPT_COMMAND=&#x27;echo &quot;$(history 1)&quot; &gt;&gt; $HOME&#x2F;.basheternalhistory&#x27; </code></pre> Now you can search it later for arcane commands you&#x27;ve forgotten how to use.
delinkaalmost 8 years ago
I recommend also learning a different shell&#x27;s quirks and syntax. I started using fish a couple years ago, but I still have to write any &#x27;production&#x27; scripts in bash. Learning fish cleared up lots of misunderstandings I had with bash and has made my bash much improved.
marypublicalmost 8 years ago
I found this useful for getting deeper with using bash: &quot;Pro Bash Programming : Scripting the GNU&#x2F;Linux Shell, Second Edition.&quot; It is kind of a brain dump type of book but it called out a bunch of little things I had missed in looking at other information sources.
tejasmanoharalmost 8 years ago
1) Force yourself to do as much as possible from command-line 2) When you Google for help and find a solution, keep Googling until you understand what you&#x27;re doing<p>That worked for me. You could also read the man pages, but step #1 is crucial regardless.
elchiefalmost 8 years ago
If you like learning by doing, play along with this:<p><a href="https:&#x2F;&#x2F;web.stanford.edu&#x2F;class&#x2F;cs124&#x2F;kwc-unix-for-poets.pdf" rel="nofollow">https:&#x2F;&#x2F;web.stanford.edu&#x2F;class&#x2F;cs124&#x2F;kwc-unix-for-poets.pdf</a><p>(text analysis in bash)
snarkyturtlealmost 8 years ago
Check out ShellJS if you want to build scripts. For me at least it made things a lot less archaic: <a href="https:&#x2F;&#x2F;github.com&#x2F;shelljs&#x2F;shelljs" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;shelljs&#x2F;shelljs</a>
jdorfmanalmost 8 years ago
Anytime I&#x27;m stuck with a script I usually end up on <a href="https:&#x2F;&#x2F;bash.cyberciti.biz" rel="nofollow">https:&#x2F;&#x2F;bash.cyberciti.biz</a><p>Vivek (founder) has been writing these tutorials for 17+ years, he knows his stuff.
robschiaalmost 8 years ago
This covers 90% of bash: Learn Enough Command Line to Be Dangerous <a href="https:&#x2F;&#x2F;www.learnenough.com&#x2F;command-line-tutorial" rel="nofollow">https:&#x2F;&#x2F;www.learnenough.com&#x2F;command-line-tutorial</a>
taylodlalmost 8 years ago
I have a couple of resources for you:<p><a href="http:&#x2F;&#x2F;www.commandlinefu.com" rel="nofollow">http:&#x2F;&#x2F;www.commandlinefu.com</a><p><a href="http:&#x2F;&#x2F;www.shell-fu.org" rel="nofollow">http:&#x2F;&#x2F;www.shell-fu.org</a>
shmerlalmost 8 years ago
Bash has tons of quirks, but as others said, reading man bash helps quite a bit.<p>There is also this great resource: <a href="http:&#x2F;&#x2F;wiki.bash-hackers.org" rel="nofollow">http:&#x2F;&#x2F;wiki.bash-hackers.org</a>
itomatoalmost 8 years ago
Understand and utilize functions in your scripts.<p>If there is one thing I wish I had understood sooner, that would be it.<p>Top to bottom programmatic flow is one thing. Conditional execution and branching are on another level.
joobusalmost 8 years ago
One of my most common uses for shell scripts is writing completion functions for my aliases and custom commands. Hitting tab for a list of all options for a command is a huge timesaver.
olalondealmost 8 years ago
I really enjoyed <a href="http:&#x2F;&#x2F;guide.bash.academy&#x2F;" rel="nofollow">http:&#x2F;&#x2F;guide.bash.academy&#x2F;</a> but it&#x27;s not completed unfortunately.
runjakealmost 8 years ago
Pick up a copy of UNIX Shell Programming by Stephen Kochan. Very approachable and lots of good practical examples. Augment it with &#x27;man bash&#x27; and Googling.
molssonalmost 8 years ago
Help develop and test this: <a href="https:&#x2F;&#x2F;github.com&#x2F;exercism&#x2F;bash" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;exercism&#x2F;bash</a>
ilakshalmost 8 years ago
If its really about helping you with the command line then use fish.<p>If you need to automate something use your favorite programming language.
syngrog66almost 8 years ago
man bash. read, digest, apply, repeat. you can also look at existing scripts, figure out what they do, why, make copy, alter, see the changes in behavior. there are also books on bash.<p>larger point: how do you learn more about X? or get better at doing X? figure that general pattern out and you can re-apply it for anything, not just bash.
psychometryalmost 8 years ago
Give up? Seriously.<p>I used to force myself to do all of my ad-hoc scripting in bash, but I got sick of the clunky way of parsing arguments, dealing with arrays, looping over data objects, etc.<p>I got pretty good at it, but at some point I decided just to stick to a language I knew well (R) to string together various pipelines and construct commands. Any high-level language would work, though. I&#x27;m much more productive now.
burnbabyburnalmost 8 years ago
learn about how return from functions and echo behaves, this often bites many.<p>learn from this wiki that has many tutorials and good examples <a href="http:&#x2F;&#x2F;wiki.bash-hackers.org&#x2F;bash4" rel="nofollow">http:&#x2F;&#x2F;wiki.bash-hackers.org&#x2F;bash4</a>
ben_jonesalmost 8 years ago
Write and distribute tutorials targeting a wide audience with varied amounts of experience.
bouhalmost 8 years ago
hackerrank has various challenges in bash : <a href="https:&#x2F;&#x2F;www.hackerrank.com&#x2F;domains&#x2F;shell&#x2F;bash" rel="nofollow">https:&#x2F;&#x2F;www.hackerrank.com&#x2F;domains&#x2F;shell&#x2F;bash</a>
saurikalmost 8 years ago
Have you read the manual?
matttproudalmost 8 years ago
$ help fc<p>Using ${EDITOR} to build command lines is awesome. &#x27;nuf said.
znpyalmost 8 years ago
Can&#x27;t wait to see this thread commented on n-gate.
gumbyalmost 8 years ago
among other things make sure you know how to use ! and ^ -- they will save you tons of time compared to searching or editing
Olognalmost 8 years ago
As you&#x27;re focused on the command line, I won&#x27;t mention things I generally use in shell scripts like compound commands (if, for, while) or shell parameters. I will also skip things I don&#x27;t often use.<p>First, there is moving around in bash - the arrow keys, or backspace&#x2F;delete to remove a character, or ^A to go to line start, or ^R to search command history, or tab to complete a command. ^L clears the screen, although from habit I still type clear.<p>I use shell&#x2F;bash builtins cd, and pwd often enough. Sometimes export, umask, exit, ulimit -a, echo.<p>I use shell variables like PS1, HOME, and PATH. I set them in $HOME&#x2F;.bashrc, which sometimes references files like $HOME&#x2F;.bash_aliases. I often set a larger than default history file size. I use ~ tilde expansion as an abbreviation for $HOME. For long commands I type regularly, I put an alias in the run control (or run control delegated) file.<p>I use job control commands like bg, fg, jobs and kill. You should know how bash job control complements and diverges from the system process commands. &amp; starts a process as a background process, and preceding it from nohup tells it to ignore hangup signals.<p>You should know how single quotes work, and escape characters for them if they are needed.<p>Then there are pipes (| - &quot;pipelines&quot;), and redirecting of stdin, stdout, and stderr. I use this a lot. Also redirecting or appending output to a file (&gt;, &gt;&gt;). I don&#x27;t use tee often but sometimes do.<p>Then there are commands used with the shell a lot. Such as parallel, or xargs.<p>Also nice which modifies process scheduling.<p>Script, or typescript, keeps a log of your shell session.<p>Screen allows for multiple shell sessions. Useful on remote hosts especially (tmux is an alternative).<p>Then there are the standard file and directory commands I often use like pwd, cd, ls, mv, cp, df, chmod, du, file, find, locate, mkdir, touch, rm, which, and wc.<p>I manipulate these with commands like awk, sed, tr, grep, egrep, cat, head, tail, diff, and less.<p>I edit with vim or emacs -nw.<p>Command like htop, ps, w, uptime and kill let me deal with system processes.<p>Then there are just handy commands like bc or cal if I need to do some simple addition or see which day of the week the first of the month is.<p>Man shows you manual pages for various commands. &quot;man command&quot; will show the manual page. For a command like kill, the default will show the command kill - &quot;man kill&quot; which specifically is &quot;man 1 kill&quot;. But &quot;man 2 kill&quot; would show the kill system call. You can see what these different manual sections are with &quot;man man&quot; - 1 is executable programs, 2 is system calls etc.<p>All of it is a process. I mentioned awk. It is one of the commands handy to use with the shell. I have seen entire programs written in awk. Some parts of awk I can use from memory, some I use occasionally and have to look up the flags to refresh my memory, some parts I have never used at all. As time goes on you pick up more and more as you need it.
base698almost 8 years ago
Learn to move around efficiently: End of Line, Beginning of Line, Move by word so you aren&#x27;t just abusing your keyboard.<p>Knowing how to reverse search (Ctrl-R) and run last command !vim or !curl to rerun last instance of vim or curl command with args so you don&#x27;t have to search every time.
评论 #14637220 未加载
vram22almost 8 years ago
This script can be useful to save man pages (not just the bash man page, any man page) as text - removing all the control characters which are used for printing with formatting (bold, etc.):<p>m, a Unix shell utility to save cleaned-up man pages as text:<p><a href="https:&#x2F;&#x2F;jugad2.blogspot.in&#x2F;2017&#x2F;03&#x2F;m-unix-shell-utility-to-save-cleaned-up.html" rel="nofollow">https:&#x2F;&#x2F;jugad2.blogspot.in&#x2F;2017&#x2F;03&#x2F;m-unix-shell-utility-to-s...</a><p>I&#x27;ve been using it from earlier Unix versions, where these formatted man pages (nroff&#x2F;troff-formatted) were more of an issue. Also works if you want to open the text form of the man page in vi or vim, for reading, searching, etc.
kingmanazalmost 8 years ago
Some suggestions:<p>Direct your focus to plain Bourne sh as much as possible, moving on only after you understand what enhancements over vanilla sh Korn or Bourne-Again actually offer.<p>Pick up Manis, Schaffer, and Jorgensen&#x27;s &quot;UNIX Relational Database Management&quot; and work through the examples to get a feel for the philosophy behind large, complex applications written in shell.<p>Join a Unix community (sdf.org) and try to do useful things with shell (e.g. cron-schedule stock quote e-mail notifications via shell scripts, etc).
jlebrechalmost 8 years ago
ctrl-r is my favourite.