Live data from Hacker News

Favorite Unix Commands

clippy.in

11–20 of 135 posts

Re: Favorite Unix Commands

#18
post #8

faucet 80 --in cat This is useful for creating a connection for receiving the input of what you get... e.g. running faucet 80 --in cat and later curl http://127.0.0.1:80 will deliver to you console : GET / HTTP/1.1 User-Agent: curl/7.21.4 (i686-pc-linux-gnu) libcurl/7.21.4 OpenSSL/0.9.8n zlib/1.2.5 libidn/1.19 Host: 127.0.0.1:900 Accept: /

Alternatively you could do

  netcat -l -p 80

Re: Favorite Unix Commands

#20
I have this in my .bashrc:

function lc() { if [[ "$#" -gt 1 ]]; then for DIR in "$@"; do echo -n "$DIR - " ; ls -AU1 $DIR | wc -l ; done ; else ls -AU1 "$@" | wc -l ; fi; }

So, "lc /dir" will count the number of files in /dir and "lc /dir/*" will count the files in subdirectories of /dir. This is useful if you're working in an environment where you may have thousands of files in a directory, and a regular "ls -l" will lock your terminal while it eats your entire scrollback buffer.

Post reply on HN