Showing posts with label apt-get. Show all posts
Showing posts with label apt-get. Show all posts

Thursday, October 11, 2012

Limit Upload/Download Speed Of APT Packages Under Ubuntu/Linux Mint/Debian



If you are sharing an internet connection with other computers connected to a local network whether at home, university, or any other place, it will be nice not to suck all the bandwidth of the network so that other users remain satisfied and happy.

Under Ubuntu, there is a useful command line tool that allows to limit download/upload speed of packages you download from the terminal or when updating repositories (apt-get update). This tool is called Trickle that allows with a few parameters to set the maximum download or upload speed in kilobytes (KB).

To install Trickle on Ubuntu, Debian or Linux Mint, run this command from the terminal:

sudo apt-get -y install trickle

Examples

   1. Updating/Upgrading Packages

Via the terminal, run this command:

sudo trickle -s -d 60 apt-get update

We use the -d 60 parameter to set max download speed. For upgrading packages, you can use one of these commands:

sudo trickle -s -d 60 apt-get dist-upgrade

or

sudo trickle -s -d 60 apt-get upgrade

   2. Installing APT Packages

To install a package from a repository with Trickle, run this command:

sudo trickle -s -u 45 -d 45 apt-get install pidgin

In the above command, we have set max upload and download speeds at 45 KB/s for the Pidgin package.

   3. Other Uses of Trickle

We can also use Trickle to limit download speed of files downloaded with "WGET". Here is an example:

trickle -d 70 wget http://releases.ubuntu.com/12.10/ubuntu-12.10-beta2-desktop-i386.iso

For more trickle parameters, run this command:

trickle --help

Monday, August 6, 2012

Run "apt-get update" and "apt-get upgrade" In One Command Under Ubuntu/Linux Mint



In this tutorial, we will see two methods that will allow us to combine two frequently used terminal commands in a single command under a system running Ubuntu/Linux Mint. We will help you run "apt-get update" and "apt-get upgrade" with one command called "update", which will be easier to write and will save you time.

Method 1

Open the terminal (CTRL+ALT+T) and run this command:

 > ~/.bash_aliases; gedit ~/.bash_aliases

For Linux Mint, run this command:

 > ~/.bash_aliases; pluma ~/.bash_aliases

Add now these lines:

alias update='sudo apt-get update; sudo apt-get upgrade'



Save your file and close it, then restart your terminal by closing and opening it again. You can now run two commands using this one:

update

Method 2

Open the terminal and run this command:

sudo gedit /usr/local/bin/update

For Linux Mint, run this command:

sudo pluma /usr/local/bin/update

Add now this line:

sudo apt-get update; sudo apt-get upgrade


Save your file and exit, then give execution permission to this file with this command:

sudo chmod +x /usr/local/bin/update

Run now this command to test your script:

update

I hope you find this tip useful!