This article is provided as it and no responsibility will be taken for things going wrong. Tested on Ubuntu 8.10 server.
If you’ve ever tried out Ubuntu you’ll probably know what aptitude is and how to manage packages. Updating your system is as simple as sudo aptitude udpate && sudo aptitude upgrade
This updates the package lists and presents any upgrades.
Wouldn’t it be easier if you could automate this and forget about it? That way your server can stay up to date without you ever having to worry about it. Create a file called autoupdate.sh and put the following into it:
#!/bin/bash # A script to run Aptitude and install any upgrades automatically. # Add this to /etc/cron.daily to run the script every 24 hours. # This prevents "TERM is not set, so the dialog frontend is not usable." error PATH="$PATH:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin" aptitude update aptitude safe-upgrade -y aptitude autoclean
To run this script daily move it to /etc/cron.daily (making sure it is executable).
chmod +x autoupdate.sh sudo chown root:root autoupdate.sh sudo mv autoupdate /etc/cron.daily
The update will run automatically once a day ensuring you stay up-to-date.
You can keep a check on packages that have been installed and removed via the log file that Aptitude generates.
sudo tail -n 30 /var/log/aptitude
If you want to check that an upgrade has been applied you can search for it like this
sudo cat /var/log/aptitude | grep -A 20 -B 20 php5
Or you can check the currently installed version using (this example is php5)
aptitude show php5
Have an update or suggestion for this article? You can edit it here and send me a pull request.
Listening to BBC Radio with mpv
The BBC publishes high quality 320 kbps HLS AAC streams that can be used to listen to radio from the command-line using mpv. Here are the URLs and some aliases to start listening quickly.
Vim: So long Pathogen, hello native package loading
Vim 8 added a native way to load third-party packages. This means, for me at least, there is no longer any need to use a third party plugin helper like Pathogen.
Linux and Unix more command tutorial with examples
Tutorial on using more, a UNIX and Linux command for viewing the contents of a file or files one screen at a time. Examples of viewing a file, viewing multiple files, searching using regular expressions and opening the file in a text editor.