Live data from Hacker News

Command line tools for productive programmers

earthly.dev

131–140 of 143 posts

Re: Command line tools for productive programmers

#132
post #126

Off topic hijack - I'm trying to find a tool I feel was probably mentioned here at one point - a REPL for shell. If I recall correctly, you would open up the repl and start typing a command, and the output would refresh as you typed. Does this ring a bell for anyone?

https://github.com/akavel/up ?

Yes! Thank you!

Re: Command line tools for productive programmers

#133

I'm a VIM-only dev, spend all my day in a Tmux session, and I use the command-line probably a lot more than average. The single best improvement to my command-line workflow I've done in the last few years has been switching shells. First I moved from Bash to ZSH, but about 2 years ago I switched again to Fish. Why I love it: - history completion searches by default, so I can just type part of a command, hit arrow-up…

do you have any trouble running shell scripts? I would suppose that the #! line at the top of the script would save you from problems in most cases. What about bash one liners? I had a bad experience with Ubuntu's (Debian's) dash shell many years ago and I've (lazily) just stuck with bash since then.

I use fish. My biggest pro-tip is don't chsh to set your shell to fish. Instead configure your terminal program to launch fish.

* do you have any trouble running shell scripts?

Nope. fish will run bash for most shebangs.

* What about bash one liners?

You will have to translate these.

Re: Command line tools for productive programmers

#134
post #37
post #19

Brains recently got underrated. The way mcfly works is cool, but it offloads your habits to some “neural network” that you can’t control. There is not many methods slower than looking at unpredictable line-by-line output and almost nothing more anxious than a possibility of false choice done without thinking. This tool basically replaces a deterministic mismatch with a non-deterministic one. Your brain is good at pre…

I get a lot of milage out of alias h="history | fzy" alias f="fd | fzy"

`fzf` can be combined with `find` (or `fd`) and then you can just press Ctrl-T and have a fuzzy searching prompt for all files in and under the current directory. It's super convenient.

Re: Command line tools for productive programmers

#135
post #129

Earlier quoted context omitted.

Yeah, like I said: I can see how it could be useful for someone who knows only Ruby. > I never really learned awk properly myself either It's really worth it. It's simple — pattern matches and block, BEGIN/END, hashes, match() and gsub() cover 90% of my uses. I very often find myself writing something like this: awk -v id=$id ' $1 == id { go = 1 } { if (go && $4 == "b667226") { km += $5 secs += $6 n++ } } END { print…

awk just always seemed a little too domain-specific to really invest time in. The number of times I think "gee, I really wish I knew better awk" are few. This week I've been doing some Lua programming; I had done some Lua several years ago for something else, but found that I had forgotten most things. Even for Ruby I've forgotten quite a lot, yet for two years I programmed Ruby every day for a living. It's just that…

Fair enough. My job involved a lot of text crunching and simple ad-hoc analysis that suited awk well. “Use it or lose it” is certainly true.

Re: Command line tools for productive programmers

#136

I'm a VIM-only dev, spend all my day in a Tmux session, and I use the command-line probably a lot more than average. The single best improvement to my command-line workflow I've done in the last few years has been switching shells. First I moved from Bash to ZSH, but about 2 years ago I switched again to Fish. Why I love it: - history completion searches by default, so I can just type part of a command, hit arrow-up…

Quick note: aliases and abbreviations are seperate things in Fish, using the 'alias' function will create a wrapper function that does not expand after typing.

Re: Command line tools for productive programmers

#137
post #70

Author here. Thanks for sharing! Have you seen gron[1]? It can't do everything that jq can, but it is much more in the unix philosophy than jq. It simply flattens and unflattens json out into lines so you can use standard unix tools on it. ▶ gron "https://api.github.com/repos/tomnomnom/gron/commits?per_page=1" | fgrep "commit.author" json[0].commit.author = {}; json[0].commit.author.date = "2016-07-02T10:51:21Z"; jso…

also, have you seen this fzf "trick"? I am sorry for spamming this comment, but I wanted to share it with all the fzf users because I found it so game-changing: I use "ESC-c" a lot. It calls fzf and fd, you type a part of your directory name, hit enter, and it cd's to that directory. export FZF_ALT_C_COMMAND='fd --type directory' That's in my .zshenv. It's incredibly useful if you have multi-layered project directori…

I use a similar trick but with aliases.

If I want to cd to let's say "~/work/john/some-project" I just type 'fcd' on the console and then "w j s" and "ENTER". Most of the times it work as expected and is really fast.

This is a mode provided by a helper that I wrote for fzf to make it easier to use and more useful. In essence it's just a shell script with a bunch of fzf tricks pre-configured.

https://github.com/danisztls/fzfx/

Re: Command line tools for productive programmers

#138
post #9

> if the directory has many files or sub-directories, tree becomes much less helpful: you only see the last screen full of information as files scroll past you. > broot solves this problem by being aware of the size of your terminal window and adapting its output to fit it. What? You can just pipe `tree` into `less`. The solution isn't to download Yet Another Binary that does this specific thing and doesn't come inst…

Well if we wanna be grumpy this morning... I don't understand why people don't learn how to use `find` properly. And just doing simple things correctly like the `-print0` integration with `xargs -0` to be able to safely send a list of files into rm even if they've got spaces or whatever. I never have much use for `tree` unless I'm trying to take a screenshot and make it look kind of nice.

find and grep are mandatory tools of the Linux toolbox but I use fd and ripgrep most of the time.
Post reply on HN