Live data from Hacker News

Unix Commands I Wish I’d Discovered Years Earlier

spin.atomicobject.com

21–30 of 259 posts

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

#21
post #17
post #14

TL;DR: man ascii, cal, xxd, ssh, mdfind

[deleted]

It's too bad that Linux and OS X don't ship with a very useful intro man page. Here's what SunOS's used to look like:

http://www.manpages.info/sunos/intro.1.html

Note the list of commands.

I guess you could ls /usr/bin and just start reading their man pages.

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

#22
post #6

I want a command that counts files in a tree like du does sizes but without having to pipe find through wc which is crazy for hundred thousand files. Can't they just directly access inodes for high speed counting?

tree does this, don't know about suppressing the actual tree, but it tells you number of files and dirs printed at the end.

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

#23
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.

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

#25
post #17
post #14

TL;DR: man ascii, cal, xxd, ssh, mdfind

[deleted]

`man 7 charsets` is a great read which recommends checking out the pages for console(4), console_codes(4), console_ioctl(4), ascii(7), iso_8859-1(7), unicode(7) and utf-8(7).

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

#26
post #6

I want a command that counts files in a tree like du does sizes but without having to pipe find through wc which is crazy for hundred thousand files. Can't they just directly access inodes for high speed counting?

It's not usually installed by default, but tree will do this: http://linux.die.net/man/1/tree

Available in most repositories, source code available at: http://mama.indstate.edu/users/ice/tree/

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

#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.

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

#30
post #22
post #6

I want a command that counts files in a tree like du does sizes but without having to pipe find through wc which is crazy for hundred thousand files. Can't they just directly access inodes for high speed counting?

tree does this, don't know about suppressing the actual tree, but it tells you number of files and dirs printed at the end.

A regex match will do that easily enough:

    tree | egrep -o "[0-9]+ file(s|)"
edit: or you could just tail the output (should have thought of this first!)

    tree | tail -n1
Post reply on HN