Live data from Hacker News

Unix Tricks

cfenollosa.com

111–120 of 166 posts

Re: Unix Tricks

#111
post #29

man hier is pretty cool. It explains the root directory structure of the system.

The SEE ALSO for 'man hier' alerted me to 'apropos'. Unbelievable, so much emacs goodness in bash.

"apropos Regular Expressions" brings up wild stuff: re_format(7) -- posix regex docs at last!, treereg(1) (huh????).

Some serious lore in here ...

Re: Unix Tricks

#112

You know what I hate? My history isn't aggregated in real time across all my Mac OS X terminal windows. You know what else I hate? Typing in long commands in the Mac OS X terminal and then them wrapping weirdly. Especially when I hit the up arrow to go back in my terminal history.

You should just move to zsh that does this natively and in a clean manner.

Re: Unix Tricks

#113

> In bash, 'ctrl-r' searches your command history No! In emacs ctrl-r searches your command history. It happens that bash use emacs mode by default. All other emacs basic commands work too: ctrl-p, ctrl-n, ctrl-f etc... If you are a vim user, and especially if you love venting how much you hate emacs, then please add this to your bashrc: set -o vi and now you can use vim command instead of emacs.

'ctrl-r' is reverse-i-search in vi mode as well.

'ctrl-r' is bound to isearch-backward in my Emacs.

'meta-r' is bound to comint-history-isearch-backward-regexp

Re: Unix Tricks

#114
A really handy one a colleague showed me yesterday was the /dev/fd/0|1|2 files, which are stdin/out/err respectively. Means you can use that file for utils that expect a file only.

E.g echo "This would be contents of file" | someCommand /dev/fd/0

Re: Unix Tricks

#117
post #95

Earlier quoted context omitted.

Caution: while this works great on Linux, on OSX, a USR1 will kill dd, and a SIGINFO will get you the block counts.

Indeed, looks like GNU coreutils dd responds to SIGUSR1 on linux and SIGINFO on linux. That's good to know. What's the reason for this discrepancy?

OSX inherited SIGINFO from the BSDs, OpenBSD, FreeBSD, Dragonfly, and NetBSD all have it.

Linux doesn't. I don't know why; but Google in the past has told me that patches to add it were rejected about 10 years ago.

Re: Unix Tricks

#118

Earlier quoted context omitted.

On OSX it's SIGINFO (29) in case anybody wondered

Which you can also get by hitting Ctrl-T. This works for FreeBSD too. (Not sure about the other BSDs.)

It works on all of them, including OSX.

Re: Unix Tricks

#120
post #80

You know what I hate? My history isn't aggregated in real time across all my Mac OS X terminal windows. You know what else I hate? Typing in long commands in the Mac OS X terminal and then them wrapping weirdly. Especially when I hit the up arrow to go back in my terminal history.

> Typing in long commands in the Mac OS X terminal and then them wrapping weirdly. For all people who dont use Mac OS X: This happens because your PS1 is wrongly set and bash cant calculate correctly the length left of your line. Try it out, by going back to default with no colors and crap and see how long it goes. For mac os x users. The above wont help, dont even try it.

I found the solution to bash problems was to move to zsh. I did that almost 10 years ago and haven't regretted the decision.
Post reply on HN