Hide

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again.

Delete that bloated snippets file you've been using and share your personal repository with the world. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.


If you have a new feature suggestion or find a bug, please get in touch via http://commandlinefu.uservoice.com/

Get involved!

You can sign-in using OpenID credentials, or register a traditional username and password.

First-time OpenID users will be automatically assigned a username which can be changed after signing in.

Hide

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for:

Hide

News

2011-03-12 - Confoo 2011 presentation
Slides are available from the commandlinefu presentation at Confoo 2011: http://presentations.codeinthehole.com/confoo2011/
2011-01-04 - Moderation now required for new commands
To try and put and end to the spamming, new commands require moderation before they will appear on the site.
2010-12-27 - Apologies for not banning the trolls sooner
Have been away from the interwebs over Christmas. Will be more vigilant henceforth.
2010-09-24 - OAuth and pagination problems fixed
Apologies for the delay in getting Twitter's OAuth supported. Annoying pagination gremlin also fixed.
Hide

Tags

Hide

Functions

live ssh network throughput test

Terminal - live ssh network throughput test
yes | pv | ssh $host "cat > /dev/null"
2009-12-27 21:34:23
User: opertinicy
Functions: ssh yes
23
live ssh network throughput test

connects to host via ssh and displays the live transfer speed, directing all transferred data to /dev/null

needs pv installed

Debian: 'apt-get install pv'

Fedora: 'yum install pv' (may need the 'extras' repository enabled)

Alternatives

There are 7 alternatives - vote for the best!

Terminal - Alternatives
pv /dev/zero|ssh $host 'cat > /dev/null'
2010-01-06 20:40:51
User: opertinicy
Functions: ssh
Tags: ssh pv /dev/null
11

connects to host via ssh and displays the live transfer speed, directing all transferred data to /dev/null

needs pv installed

Debian: 'apt-get install pv'

Fedora: 'yum install pv' (may need the 'extras' repository enabled)

Know a better way?

If you can do better, submit your command here.

What others think

NO! Sorry but this will not give you the true network speed of your network or any network. Using SSH adds a lot of extra data on the network in addition to what you are transfering (about 200-300% more) that would of course not be seen by pv. Probably a better way to do this is using nc or something.

Try running this on the server side:

nc -l -p 44444 > /dev/null

And then this on the client side:

yes | pv | nc serverhostname.example.com 44444

Nice try though.

Comment by deltaray 248 weeks ago

of course it's going to have the overhead added by ssh, that is implied by the fact it is going over ssh (and as indicated by the summary).

Comment by opertinicy 248 weeks ago

also, 200-300% is a gross overestimation and is highly dependant on the cpu's doing the encryption/decryption. the actual data being transferred on the network is not increased by much. as i never transfer files between hosts unencrypted, this command is highly useful in tweaking/measuring my ssl/ssh settings for use when using ssh tunneling/scp

Comment by opertinicy 248 weeks ago

Nice, I hadn't known about the 'pv' command. Just out of curiousity, why did you use 'yes' instead of /dev/zero?

(BTW, I agree that it's actually more useful to know the bandwidth including encryption overhead than the raw network bandwidth.)

Comment by hackerb9 247 weeks and 2 days ago

Sure, but I just want to make sure people realize when they read this is that all your example measures is what the bandwidth would be for SSH between the two machines it was tested on, not for other protocols on the network in general. You started to get at that in your comments, but you didn't put that in your initial description.

Comment by deltaray 247 weeks and 2 days ago

no specific reason for using yes [other than it's shorter/quicker to type :) ]

you could use /dev/zero as well:

cat /dev/zero | pv | ssh $host 'cat > /dev/null'

or even better:

pv /dev/zero -W | ssh $host 'cat > /dev/null'

Comment by opertinicy 247 weeks ago

I noticed using the -C option for ssh makes a huge difference... probably mostly due to using /dev/zero being easy to compress :)

dd bs=1024 count=1M if=/dev/zero of=s1

1048576+0 records in

1048576+0 records out

1073741824 bytes (1.1 GB) copied, 8.26632 seconds, 130 MB/s

Comment by AskApache 233 weeks and 3 days ago

Calling /dev/zero as the stdout in this example provides for a pretty good demonstration on how compression works, (specifically zlib compression, in this instance). However, it is relatively useless for any kind of bandwidth benchmark =p

Comment by opertinicy 233 weeks and 2 days ago

Your point of view

You must be signed in to comment.

Related sites and podcasts