Know Your Tools – Terminal and Bash
21–30 of 48 posts
Re: Know Your Tools – Terminal and Bash
#222. If you want to save your command without running it... comment it out with a '#'. Bang, it's in your history.
Re: Know Your Tools – Terminal and Bash
#23Two very basic tips for vi: You can use slash(/) and question mark(?) to search for text (forward and backward) in vi. It's useful to know these, because they also work with less(1). 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.
Re: Know Your Tools – Terminal and Bash
#24http://xkcd.com/1168/ ^_^
tar -xzf # eXtract Ze Files!
EDIT: I missed chadzawistowski's similar comment belowRe: Know Your Tools – Terminal and Bash
#25edit: Actually, something cool I learned recently is that if you put the line "set editing-mode vi" in your ~/.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.
Re: Know Your Tools – Terminal and Bash
#26My most used bash command is probably "sudo !!", which runs the previous command with "sudo" prepended. The book "Unix Power Tools" 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).
$ cd /big/long/path/to/this.txt Oops $ vim !$
Re: Know Your Tools – Terminal and Bash
#27This is probably misunderstanding the demographic, but why does he suggest using nano over vim?
More likely, if this is meant to be a gentle introduction to the command line, vim is a pretty scary place. Nano works much more like a "normal" text editor.
Re: Know Your Tools – Terminal and Bash
#28To exit vim use :wq, not just :wq - most of the problem is it getting stuck in insert mode, and not knowing how to escape into normal mode.
shift+z shift+z
I.e. You're in command mode, and essentially type two capital Z letters. It saves your document and quits.
Anywho, it's stuck with me ever since.
Re: Know Your Tools – Terminal and Bash
#29Very true. I have difficulties in training new recruits with UNIX. For some reason, beginners have developed an aversion to UNIX/shell scripting. I myself have started more and more of Ruby/AWK/Python, but it is always SHELL that blows me off with the sort of impact it has on the daily work. I ended up highly optimizing my work environment to replace long ssh connections with `conn prod` (will use my RSA key and conn…
Which is fine, not everyone has been exposed to it. Eventually, by the fifth time I have to tell them how to move one folder up (Cd ..), I realize that something is very, very wrong.
Re: Know Your Tools – Terminal and Bash
#30Very true. I have difficulties in training new recruits with UNIX. For some reason, beginners have developed an aversion to UNIX/shell scripting. I myself have started more and more of Ruby/AWK/Python, but it is always SHELL that blows me off with the sort of impact it has on the daily work. I ended up highly optimizing my work environment to replace long ssh connections with `conn prod` (will use my RSA key and conn…
I think they wrote in Bash to avoid the interpreter startup time. But the scripts are run very infrequently and most of them start/stop long-running services.
That being said, getting a bash script to do the right thing is very satisfying!