Live data from Hacker News

Mastering Bash and Terminal

blockloop.io

171–180 of 186 posts

Re: Mastering Bash and Terminal

#171

Earlier quoted context omitted.

The problem with installing zch on my desktop is that I won't have it on the servers I SSH into. I need to know the proper spells and incantations that will work on a wide variety of distros and versions, many of which I don't personally maintain. Therefore, bash.

Indeed. The same argument applies to other exotic tooling, interesting vim plugins with many dependencies, etc. It's one reason to keep one's environment relatively standard and boring. Otherwise, one comes to be dependent -- psychologically, at least -- on one's meticulously configured custom environment, and either chafes at its absence elsewhere or spends a great deal of time copying it everywhere.

I must admit guilt to dragging my .vimrc and sometimes the whole of ~/.vim/ into machines that I'll be SSHing into for only a short time.

Re: Mastering Bash and Terminal

#172
post #29

Personally, I found the following to be extremely easy and powerful. A no-brainer that should be a bash default really. if [ -t 1 ] then # search for commands that start off with the same characters already typed bind '"\e[A":history-search-backward' bind '"\e[B":history-search-forward' fi One of my friends also recommended version-controlling your config files and storing them on gitlab, which I'm only sad I didn't…

I'm sorry, can you explain how to use this?

Just stick that snippet in your .bashrc file

Re: Mastering Bash and Terminal

#173

Earlier quoted context omitted.

Indeed. The same argument applies to other exotic tooling, interesting vim plugins with many dependencies, etc. It's one reason to keep one's environment relatively standard and boring. Otherwise, one comes to be dependent -- psychologically, at least -- on one's meticulously configured custom environment, and either chafes at its absence elsewhere or spends a great deal of time copying it everywhere.

I must admit guilt to dragging my .vimrc and sometimes the whole of ~/.vim/ into machines that I'll be SSHing into for only a short time.

Me too. :-)

Re: Mastering Bash and Terminal

#175
post #154
post #80

Earlier quoted context omitted.

zsh was even the default shell for an OS X release, 10.3 or 4 can't remember at this point.

Nope, before switching to bash in 10.3, tcsh was the OS X default.

Yep looks like you're right, I could have sworn that zsh was after tcsh then bash from there on out. Went looking in my Mac OS X for unix geeks book and it was right on the transition so bad memory no cookie. I'll punish my brain with beer for its transgressions.

Re: Mastering Bash and Terminal

#176
post #113

Earlier quoted context omitted.

Also, when you use a lot of scripts that only work with bash (there are more than you'd expect, despite zsh saying it is bash compatible) then you have the choice of either rewriting these scripts or using bash. Most ppl will choose not to rewrite.

zsh never claimed it was compatible with bash. I'm not sure where you got that impression from. Maybe you're thinking of sh -- the bourne shell -- which zsh is in fact compatible with (as long as you limit your scripts to the bourne shell subset of zsh).

I'm not sure, where I've read it specifically, but it was a feature I was looking fore before switching to zsh about 5 years ago. What I found now is this: https://wiki.archlinux.org/index.php/zsh

Anyways. The core point is that compatibility often means compatible in 90%-99% of the cases. It's really really hard to be 100% compatible, which also requires one to emulate bugs etc.

Re: Mastering Bash and Terminal

#178

Great post & thread, a tl;dr: Ctrl-r search history - then Ctrl-r again to show next match - then Tab to show all options Ctrl-p previous command or arrow up Ctrl-n next command or arrow down export HISTCONTROL=ignoreboth:erasedups Add to .bashrc to avoid duplicate entries Ctrl-a to beginning of line Ctrl-e to end of line Alt-b one word back Alt-f one word forward Ctrl-k delete to end of line Ctrl-u delete to beginni…

There is Ctrl-y for pasting deleted strings, which goes along very well with these commands: Ctrl-k delete to end of line Ctrl-u delete to beginning of line Alt-d delete to end of word Ctrl-w delete to beginning of word Alt-Backspc same Bash keybindings behave like Emacs by default, hence every time you invoke one of these, it will put the string into a buffer, which can be later pasted using Ctrl-y. This is very use…

  "\e[A": history-search-backward 
  "\e[B": history-search-forward 
These have to go in `~/.inputrc`, right?

Re: Mastering Bash and Terminal

#179

Earlier quoted context omitted.

It's easier to embrace the Unix philosophy when your text editor doesn't take a half hour to start.

It has a daemon mode, so now you know. And from a flat start emacs takes less than 5 seconds on my pc which isn't that beefy.

I was replying with a glib remark because the suggestion to use emacs instead was stupid to begin with.

Re: Mastering Bash and Terminal

#180

Earlier quoted context omitted.

It has a daemon mode, so now you know. And from a flat start emacs takes less than 5 seconds on my pc which isn't that beefy.

I was replying with a glib remark because the suggestion to use emacs instead was stupid to begin with.

Vim users should check it out, even if only for inspiration for a clone.
Post reply on HN