10-01-2009, 11:18 PM
In my experience with Linux distributions, Slackware and Ubuntu/Kubuntu, there are a couple of different methods used to update the system. Of course we can always use a gui to do the updates but what fun is that?
The two commands used to update a Debian based system are:
Now while this doesn't require a great deal of typing, let's see if we can shorten it to suit our needs.
If you do not already have somewhere to store your personal scripts, the following command will do this for you and allow you to enter the code we will use:
Press i for insert and create the following script:
This is all we need to type for our script to produce the results we are looking for. Now let's save our script by pressing Esc => :wq => <enter>.
To run our script we can type:
You should see the output from the two commands used in the script printed to the screen. Now let's make our script executable so we don't have to type bash to make it run.
The following command will accomplish what we are looking for:
Now to run our command we simply need to type:
We now have a working script to do our update process and it is significantly shorter than the first option we used. As always all comments are welcomed.
The two commands used to update a Debian based system are:
Code:
safety@nDarkness:~/bin$ sudo apt-get update
safety@nDarkness:~/bin$ sudo apt-get upgradeNow while this doesn't require a great deal of typing, let's see if we can shorten it to suit our needs.
If you do not already have somewhere to store your personal scripts, the following command will do this for you and allow you to enter the code we will use:
Code:
safety@nDarkness:~$ mkdir bin; cd bin; vi apt-autoPress i for insert and create the following script:
Code:
#!/bin/bash
sudo apt-get update; sudo apt-get upgradeThis is all we need to type for our script to produce the results we are looking for. Now let's save our script by pressing Esc => :wq => <enter>.
To run our script we can type:
Code:
safety@nDarkness:~/bin$ bash ./apt-autoYou should see the output from the two commands used in the script printed to the screen. Now let's make our script executable so we don't have to type bash to make it run.
The following command will accomplish what we are looking for:
Code:
safety@nDarkness:~/bin$ chmod +x apt-autoNow to run our command we simply need to type:
Code:
safety@nDarkness:~/bin$ ./apt-autoWe now have a working script to do our update process and it is significantly shorter than the first option we used. As always all comments are welcomed.