Live data from Hacker News

Unix Tricks

cfenollosa.com

141–150 of 166 posts

Re: Unix Tricks

#141
post #133

Earlier quoted context omitted.

sh, the Bourne shell mode of pdksh? Isn't that a little too limited? pdksh (/bin/ksh) though is great, yes. I'm in general a big fan of the OpenBSD userland: straightforward and very, very well-documented. Real manpages, no religious "The full documentation for xyz is maintained as a TeXinfo manual" crap. A well-conceived featureset and good docs are key to properly learning a platform. OpenBSD taught me a lot about…

Also worth noting that native borne shell was always slightly slower than korn shell. Though been a long time since I checked that one out, though did on few systems and found it to be so. But there again csh was also about then, distant memory in for many that one. Also anything that will run script wise on bourne will run as is under korn. Though you may well find that it is historical, which one a user picks shell…

I think shell performance stopped mattering the moment I dumped my 50MHz SPARC LX for a Sun Ultra 2.

Re: Unix Tricks

#143
post #69
post #55

Earlier quoted context omitted.

In Linux with bash (and probably other shells that are bash-compatible), you can use vi to edit any of the commands in your command history, and then execute the edited version. Do this at the command prompt, or once in your ~/.bash_profile to make it permanent: set -o vi After that, you can search for any of the commands in your history, edit it, and then execute the edited command, by doing this: At the prompt, typ…

Yes, that is also a solution. However, you cannot use vim so if you're used to vim, it might feel limited without certain commands. You're also missing eventual plugins. It's better than nothing though.

I don't think this is the case, though I may be misunderstanding what you wrote.

At the shell, it's true that you're limited to vi-style controls (so no text objects like ci").

However, once you press 'v' in normal mode you can drop into either vi or vim - this only depends on what $EDITOR is set to[1].

[1] http://blog.sanctum.geek.nz/vi-mode-in-bash/

Re: Unix Tricks

#144
post #93

Ctrl+r is fine when you're looking for something recent, but this one is useful when you're looking through a long list of similar commands. alias hist='history | grep' Use it like this: $ hist git 9543 git add toto 9544 git commit 9545 git log 9546 git log 9548 git add -A 9549 git commit 9550 git log 9633 git pull 9955 cd dev/git 9957 git grep copyof 9958 git grep copyof 9959 git pull By the way, do you know you can…

I use this all the time. In fact it was one of the first aliases i made when i switched to a UNIX system. Though I named mine `greph` (for grep history). Absolutely invaluable

Re: Unix Tricks

#146
post #34

I would add: TOOLS ... * 'tree' instead of 'ls -R' ...

Which package would that be in?

`brew install tree` on OSX

Also this bash function from Mathias Bynen's famous dotfiles is a fantastic shortcut for colorised (and more) output from tree. https://github.com/mathiasbynens/dotfiles/blob/master/.funct...

Re: Unix Tricks

#147
I love these, there's too much to process but I always get to learn at least one ridiculously useful thing. Today's was vim's `:set spell`.

Re: Unix Tricks

#148

Earlier quoted context omitted.

There's no good way to refer to the entire DOS/Windows command shell lineage without confusion, but that's what I meant. I don't technically use DOS at all anymore. I think "that system" is easier to understand in it's entirety and find your way around than Unix, although it has been getting progressively more complex for years. I actually use OS X most of the time now (plus Linux on servers and Windows for 3D stuff)…

> I think [DOS] is easier to understand in it's entirety and find your way around than Unix Yikes, I recently had to do a bit of development on a windows box and I found the command-line tools (not to mention CMD itself, which seems to have stopped development in 1993) to be absolutely awful. I could barely survive without Cygwin, git bash, etc giving me some semblance of a functional shell setup. I guess it's differ…

Backwards compatibility. PowerShell is modern and powerful.

http://blogs.msdn.com/b/powershell/archive/2007/03/19/monad-...

Re: Unix Tricks

#149

Earlier quoted context omitted.

>You know what else I hate? Typing in long commands in the Mac OS X terminal and then them wrapping weirdly. Are you escaping your color codes in PS1 correctly? Bad: PS1="\033[1;32m \w \033[m $" Good (notice the extra \[ and \]): PS1="\[\033[1;32m\] \w \[\033[m\] $"

Mine seems escaped as hell, but still gets wrapped. Anything I'm missing? edit: couldn't get UTF-8 branch symbol to be properly displayed here, but this is how it looks: http://i.imgur.com/zuq24gV.png?1 function fancyPrompt { local bgBlue="\[\033[48;5;31m\]" local fgBlue="\[\033[38;5;31m\]" local fgWhite="\[\033[38;5;231m\]" local bgDarkBlue="\[\033[48;5;24m\]" local fgDarkBlue="\[\033[38;5;24m\]" local bgDarkGray="\…

Try not escaping around the triangles and branch symbols.

Re: Unix Tricks

#150
post #66

Earlier quoted context omitted.

Wow, DOS users still exist? Which one? FreeDOS? Back in the late 90s when I first moved to Debian from Windows, growing up with a DOS CLI made the transition far easier to me (and having some FTP exposure didn't hurt either).

There's no good way to refer to the entire DOS/Windows command shell lineage without confusion, but that's what I meant. I don't technically use DOS at all anymore. I think "that system" is easier to understand in it's entirety and find your way around than Unix, although it has been getting progressively more complex for years. I actually use OS X most of the time now (plus Linux on servers and Windows for 3D stuff)…

> There's no good way to refer to the entire DOS/Windows command shell lineage without confusion

cmd.exe? Powershell?

Post reply on HN