![]() |
ubuntu.com - launchpad.net - ubuntu help
|
|
|||||||
Ubuntu 9.10 is out!!!
When downloading Ubuntu 9.10 please consider using bittorrent to get your copy of Ubuntu. The Ubuntu Developers Summit for Lucid Lynx will be held the week of 16-Nov-2009 till 20-Nov-2009 in Dallas, TX USA. Visit the the Ubuntu wiki for more information about UDS and how to participate remotely. |
|
Tutorials & Tips The place to find Ubuntu related Tips & Tricks. |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Dark Roasted Ubuntu
![]() Join Date: Nov 2006
Location: There and back again
Beans: 1,039
|
Package Management from the Command Line
Hello everybody. I am writing this for someone here that once did a good deed for me. If you are reading this (you know who you are), thank you, it is much appreciated.
I like to work from the command line. I find that once you get to know it, it is often quicker to do the tasks you need to do (especially as an administer). Here is a quick front-end to common management tasks (installing/removing pacakges, package information...) that you may do everyday on your machine. It's pretty well commented and include's help by just typing the command. I call it dm (debian management) and the syntax is simple: Code:
dm <option> <*option2> Code:
dm i openbox Code:
dm y Code:
#!/bin/sh
# dm - shorthand frontend to debian management tasks
if [[ -z $@ ]]; then
echo "dm <option> <*package> - debian management tasks
c | clean - delete .debs that can no longer be downloaded
d | depclean - remove unneeded dependencies
i | install - installs package and dependencies
L | local - install a local .deb package
l | list - list files installed by the package
n | info - package information
o | owns - lists package that owns a file (D-)
q | query - search for an installed package
r | remove - removes package and unneeded dependencies
s | search - searchs for package and package description
u | update - updates system
v | distup - distribution upgrade
y | sync - sync repository database
daemonadd - add daemon to run lvl <daemon> <defaults/??>
daemonrm - remove daemon from run levels
purge - removes package and configurations"
exit
fi
case $1 in
c | clean ) apt-get autoclean
# apt-get clean # remove all pkg install sources
;;
d | depclean ) apt-get autoremove
;;
i | install ) shift
apt-get install "$@"
;;
L | local ) shift
dpkg -i "$@"
;;
l | list ) shift
dpkg -L "$@"
;;
n | info ) shift
apt-cache show "$@"
;;
o | owns ) shift
dpkg -S "$@"
;;
q | query ) shift
if [ -z "$@" ]; then
dpkg -l; else
dpkg -l | grep "$@"
fi
;;
r | remove ) shift
apt-get remove "$@"
apt-get autoremove
;;
s | search ) shift
apt-cache search "$@"
;;
u | update ) apt-get update
apt-get upgrade
;;
v | distup ) apt-get dist-upgrade
;;
y | sync ) apt-get update
;;
daemonadd ) shift
update-rc.d "$@"
;;
daemonrm ) shift
update-rc.d -f "$@" remove
;;
purge ) shift
apt-get --purge remove "$@"
;;
* ) shift
apt-get "$@"
;;
esac
Code:
mkdir ~/.bin Code:
chmod +x ~/.bin/dm Code:
export PATH="~/.bin:$PATH" Code:
source ~/.bashrc Code:
sudo su
__________________
Last edited by Gen2ly; August 1st, 2009 at 05:44 PM.. |
|
|
|
|
|
#2 |
|
Dark Roasted Ubuntu
![]() Join Date: Nov 2006
Location: There and back again
Beans: 1,039
|
Re: Package Management from the Command Line
Oy, fixed a typo in the list line.
__________________
|
|
|
|
|
|
#3 |
|
A Carafe of Ubuntu
![]() Join Date: Jun 2009
Location: Alaska, Eagle River
Beans: 141
Ubuntu 9.04 Jaunty Jackalope
|
Re: Package Management from the Command Line
Thanks for the tip. I really couldn't find a good one, but now I have.
Good day. |
|
|
|
|
|
#4 |
|
Dark Roasted Ubuntu
![]() Join Date: Nov 2006
Location: There and back again
Beans: 1,039
|
Re: Package Management from the Command Line
Glad you could put it to use Elep.Repu. Danke.
__________________
|
|
|
|
|
|
#5 |
|
Dark Roasted Ubuntu
![]() Join Date: Nov 2006
Location: There and back again
Beans: 1,039
|
Re: Package Management from the Command Line
Oop, fixed some typos.
__________________
|
|
|
|
|
|
#6 |
|
Dark Roasted Ubuntu
![]() Join Date: Nov 2006
Location: There and back again
Beans: 1,039
|
Re: Package Management from the Command Line
Removed tasksel option (didn't use anyway).
__________________
|
|
|
|
|
|
#7 |
|
Dark Roasted Ubuntu
![]() Join Date: Nov 2006
Location: There and back again
Beans: 1,039
|
Re: Package Management from the Command Line
Cleaned up script a little bit more, added daemon option.
__________________
|
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|