Live data from Hacker News

Unix Commands I Wish I’d Discovered Years Earlier

spin.atomicobject.com

51–60 of 259 posts

Re: Unix Commands I Wish I’d Discovered Years Earlier

#53
post #18

I believe xxd is actually part of vim and not a Unix command itself. It's used to support hex-editing binary files, but you can see why it's useful in other roles as well.

The origins of xxd seem to be a bit murky, as I've seen others say the same thing about xxd being available only if vim is installed, but I've never seen a Unix system that didn't have vi(m) included.

    $ man xxd | grep vi
       Use xxd as a filter within an editor such as vim(1) to hexdump a	region
       Use xxd as a filter within an editor such as vim(1) to recover a	binary
       Use xxd as a filter within an editor such as vim(1) to recover one line
http://grail.cba.csuohio.edu/~somos/xxd.c

From what I've been able to find, vim was released in 1991, and xxd has been around since at least 1990, whereas vi was written by Bill Joy in 1976. (according to Wikipedia)

Interesting bit of trivia, perhaps someone with a good memory can clear it up for us?

Re: Unix Commands I Wish I’d Discovered Years Earlier

#55

Unix and Common Lisp are similar in many ways: 1. Both are operating systems 2. Both are conceptually simple. 3. There is always nice command that does what you want but you somehow forget it. I can't believe that Common Lisp has just 900+ symbols but I routinely forget some of them when programming.

My favorite part is when you implement something you could've had running in a minute or so, but instead developed it for hours or days and it's still not as good as the existing solution. I often get that with C and libraries. There has to be a better way to search through existing stuff which is good and proven, not just for C of course.

Re: Unix Commands I Wish I’d Discovered Years Earlier

#56
post #48
post #28

One of the more useful bits of ssh is not mentioned: remotely running commands. Example: ssh username@host "echo $HOSTNAME && sudo somecommand && cat somecommand.log" There's probably a better way to do this, but in a pinch I can fix a problem on dozens of machines just by altering the host string.

Still about ssh : "typing a password on your local machine once, then using a secure identity to login to several remote machines without having to retype your password by using an ssh key agent. This is awesome. " Sounds awesome, but I really didn't understand what he means. Is he talking about using a certificate (-i option) to log in ?

I am fairly sure they are referring to ssh-add

Re: Unix Commands I Wish I’d Discovered Years Earlier

#58
post #28

One of the more useful bits of ssh is not mentioned: remotely running commands. Example: ssh username@host "echo $HOSTNAME && sudo somecommand && cat somecommand.log" There's probably a better way to do this, but in a pinch I can fix a problem on dozens of machines just by altering the host string.

The single most useful thing about ssh to me is that it connects stdout/in across the channel (this is behavior inherited from rsh). This allows for e.g.:

  % (cd /foo; tar cpf - .) | ssh bar \(cd /baz\; tar xpf -\)
Or:

  % cat ~/.ssh/id_rsa.pub | ssh bar tee -a .ssh/authorized_keys

Re: Unix Commands I Wish I’d Discovered Years Earlier

#60

Replaces the current day of the month with []: $ cal | sed "s/.*/ & /;s/ $(date +%e) / [] /" September 2013 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 [] 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30

Gcal will highlight the current date for you.

http://www.gnu.org/software/gcal/

Post reply on HN