nDarkness - Step Into the Light
SearchMember ListCalendarHelp Hello There, Guest! LoginRegister Fourms Blogs
nDarkness - Step Into the Light » Tutorial and Help Section » Tutorials » Linux
Linux Command Line System Update Script


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Threaded Mode | Linear Mode
Linux Command Line System Update Script
10-01-2009, 11:18 PM (This post was last modified: 10-02-2009 10:09 AM by safety.)
Post: #1
safety Offline
Administrator
*******
Posts: 8
Joined: Sep 2009
Reputation: 0
Linux Command Line System Update Script
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:

Code:
safety@nDarkness:~/bin$ sudo apt-get update
safety@nDarkness:~/bin$ sudo apt-get upgrade

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:

Code:
safety@nDarkness:~$ mkdir bin; cd bin; vi apt-auto

Press i for insert and create the following script:

Code:
#!/bin/bash

sudo apt-get update; sudo apt-get upgrade

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:

Code:
safety@nDarkness:~/bin$ bash ./apt-auto

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:

Code:
safety@nDarkness:~/bin$ chmod +x apt-auto

Now to run our command we simply need to type:

Code:
safety@nDarkness:~/bin$ ./apt-auto

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.
Visit this user's website Find all posts by this user
Quote this message in a reply Return to top
« Next Oldest | Next Newest »
Post Reply 


  • View a Printable Version
  • Send this Thread to a Friend
  • Subscribe to this thread
Forum Jump:


User(s) browsing this thread:


Contact Uswww.nDarkness.comReturn to TopReturn to ContentLite (Archive) ModeRSS SyndicationPrivacy Policy

Current time: 09-07-2010, 09:38 PM Powered By MyBB, © 2002-2010 MyBB Group. Theme created by Justin S.