

UNIX Tips and Tricks To Save You Time In Terminal - AndrewHathaway
http://www.onextrapixel.com/2013/10/09/unix-tips-tricks-to-save-you-time-in-terminal/

======
pstadler
Don't use too many aliases, a dozen generic ones should do it, learn to use
reverse history search (usually mapped to Ctrl-r) instead.

Once you get used to it, your brain just triggers this combination whenever
the command is more complex than let's say `ls -al`. This means you have to
change some habits like to `tail` your logs with absolute paths, so you don't
need to `cd` into the folder first, etc.

------
WestCoastJustin
If anyone is interested, there were several great posts on Hacker News a
while, these are packed with useful UNIX commands [0, 1, 2, 3].

[0]
[https://news.ycombinator.com/item?id=6360320](https://news.ycombinator.com/item?id=6360320)

[1]
[https://news.ycombinator.com/item?id=6046682](https://news.ycombinator.com/item?id=6046682)

[2]
[https://news.ycombinator.com/item?id=5022457](https://news.ycombinator.com/item?id=5022457)

[3]
[https://news.ycombinator.com/item?id=4985393](https://news.ycombinator.com/item?id=4985393)

------
waxjar
Half these "unix tricks" are bash tricks. :/

------
agumonkey
This is what Gary Bernhardt would call 'atom' level unix programming. I
encourage people to watch this talk :
[http://www.confreaks.com/videos/615-cascadiaruby2011-the-
uni...](http://www.confreaks.com/videos/615-cascadiaruby2011-the-unix-
chainsaw)

First it's quite funny, second it shows very pragmatic yet abstract usage of
unix way of life, like quickly gathering data about your code base by
combining other these atoms into new abstractions (as in SICP).

As he says, it's often half-assed, but it's the right half of the ass.

------
rdtsc
Obligatory:

[http://www.commandlinefu.com/](http://www.commandlinefu.com/)

I found some nice tricks there that I ended up using.

On the other hand, I found that customizing my shell, emacs, and other such
things too much a bit frustrating when dealing with multiple machines. So
often I have learned to live with the defaults. In other words I don't want to
get used to typing "gst" for "git status" I just type "git status" because
next machine I log into might not have the gst alias.

~~~
milliams
[http://explainshell.com/](http://explainshell.com/) is pretty funky too.

~~~
pstadler
This is really cool. Thanks for posting that!

------
fencepost
I find it interesting that there's a whole section on creating bash aliases
for git commands, completely ignoring the [alias] section available in
.gitconfig (see
[https://git.wiki.kernel.org/index.php/Aliases](https://git.wiki.kernel.org/index.php/Aliases)
for details and a variety of contributed examples).

------
diggan
>"If your terminal window is getting cluttered and you'd like to start from
fresh, you can type clear. This will clear your window as if you've just
reopened Terminal."

No, it won't. It only looks like it's like reopening the terminal, it won't
reload your configs and stuff. Instead of writing "clear", you can do ctrl + r
to achieve the same thing.

If you instead really want your terminal to be like reopened, do "reset"
instead.

Regarding the history command, combining it with grep is when it becomes
really useful. Example, all my latest git commands:

history | grep -i "git"

~~~
nfg
> you can do ctrl + r to achieve the same thing.

C-r will (usually?) invoke reverse-search-history
([http://www.gnu.org/software/bash/manual/html_node/Commands-F...](http://www.gnu.org/software/bash/manual/html_node/Commands-
For-History.html)) in bash (and I'm sure some other shells also).

~~~
raphdg
I think he meant C-l .

~~~
diggan
No, I didn't but that's pretty handy since it doesn't hide the new prompt.

------
jwarren
Genuinely useful tips, but a slightly misleadingly named article.

------
ebbv
These are really, really newb level "tips" here. I'd consider this more of a
"welcome to bash" intro. Are there really people on HN who don't know this
stuff?

