To limit for interface
sudo apt-get install wondershaper
In terminal find out what is the name of the interface connected to your internet by using
ifconfig. Could be eth0, eth1, eth2, etc... In my case is eth1. So, I would do this:
sudo wondershaper [interface] [dowload limit] [upload limit]
eg :sudo wondershaper eth1 1024 256
If you want to reset that do this
sudo wondershaper clear eth1
NOTE : This will limit entire speed of ysytem becasue , the limit applied to interface.
To limit the speed by application, we use below
sudo apt-get install trickle
sudo trickle -d [download limit] -u [upload limit] [application name]
eg :sudo trickle -d 120 -u 32 firefox
NOTe : Without application name it will apply to over all system.