Wednesday, March 2, 2011

Ubuntu and Updates

I was talking to another Ubuntu user today and realized that I sometimes do things that others may find useful. In this particular instance, Ubuntu updates. There are a couple of ways to apply updates to your system. You can go the GUI route and use the update manager, or Synaptic Package Manager, or you can use the CLI commands. I have been using Linux as my primary OS at home for several years now. I am by no means an expert, but I do know my way around the CLI. The sequence I used to go through to apply updates to my system was to open a console and start typing away. At first I would run each command individually. So I would run the following commands:
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get autoremove -y
sudo apt-get clean
The 1st command will update the package list with new versions of the packages available.
The 2nd command will actually apply the updates to the system.
The 3rd command will remove any packages that were left behind after removing a package.
The 4th command will remove all of the downloaded files that were needed to apply the updates.
You can look in /var/cache/apt to see how many different packages have been downloaded. This is a wise thing to do if you consistently run low on disk space.
After a while, I learned I could type in a long string of commands to accomplish the same thing, it looked like this:
sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get autoremove -y && sudo apt-get clean
While this will provide the same results as running the commands individually, I then made the process a bit easier. This is how:
I created a file called updateme in my home folder, if using the CLI you can do this:
touch updateme
This will simply create the file. Once the file is created, you then edit the file with your favorite editor, in my case, nano.
nano updateme
You then take the 4 commands shown above and copy them into the file.
Now we need to make the file executable. To do this we run this command:
sudo chmod 755 updateme
You can now execute the file by running this command:
./updateme
If you regularly forget to type in ./ in before the command you can do this:
cd into /bin
Then run this command:
ln -s ~/updateme
This will create a shortcut to updateme in the /bin folder. Now that the shortcut is in /bin, all you have to do to run the file is type in the name like so:
updateme
I decided I like this method and use it an all of my Ubuntu systems, it saves time and keystrokes, and prevents you from forgetting any steps, like removing the cached files after each round of updates.
I understand that this may not be the absolute correct way to do this, but this demonstrates one of the greatest aspects of linux in my opinion, multiple ways to pretty much accomplish everything.
I hope you find this information helpful, if you see something that can ease the process a bit more, drop a comment and let me know.

Thanks for reading, hope you enjoyed it.
Published with Blogger-droid v1.6.7

No comments:

Post a Comment