Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to ssh into a laptop (Ubuntu) which will be connected through a 3G connection. Therefore I need to estimate how much data I will be using to choose a suiting plan.

Separate from file transfer, for which I can easily determine how much data will be used, what is the typical amount that an ssh session uses? Is there some sort of relation, e.g. that using ls on a directory with 50 items will cost me a certain amount of data? Or is it more time dependent and does an ssh session transmit a certain amount of data per time interval, regardless of use?

share|improve this question
add comment

3 Answers

up vote 4 down vote accepted

what is the typical amount that an ssh session uses?

I'm not sure there is "typical"

You should run tcpdump -ni eth0 -w dump port 22 to capture all your packets, then tcpdump -nX -r dump to view them.

Is there some sort of relation, e.g. that using ls on a directory with 50 items will cost me a certain amount of data?

You could compute that. As a rough estimate, every keystroke will generate 4 packets (keypress, ack, echo on screen, ack) and each packet will have tons of overhead. (My TCP dump says 500 bytes to type 2 characters.)

My directory listing of 135 files took 2.5k.

Using ssh -C compression should help for the bigger text.

Or is it more time dependent and does an ssh session transmit a certain amount of data per time interval, regardless of use?

Yes. Both TCP and SSH have keepalive probes. This will be an issue if you keep it up all the time. Again, use TCPDump to measure.

My advice: instead of worrying, make sure you actually have realtime feedback on your usage. After you use a few sessions, you'll be able know how close you are.

share|improve this answer
add comment

SSH is basically sending the command and the screen output. If you're just doing command line stuff, a rough estimate would be a byte per character on your screen.

Obviously, if you tunnel an X session, SCP to transfer files, etc, the bandwidth will go up.

I say it's a rough estimate as there's some overhead. You can also use the -C flag to request compression.

share|improve this answer
add comment

if you want to mesure how much bandwith ssh is using

use iftop and filter it on port that ssh use (22)

http://tournasdimitrios1.wordpress.com/2011/01/20/iftop-monitor-and-analyze-your-network-traffic-on-linux/

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.