![]() |
ubuntu.com - launchpad.net - ubuntu help
|
|
|||||||
|
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,061
|
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,061
|
Re: Package Management from the Command Line
Oy, fixed a typo in the list line.
__________________
|
|
|
|
|
|
#3 |
|
A Carafe of Ubuntu
![]() Join Date: Jun 2009
Beans: 148
|
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,061
|
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,061
|
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,061
|
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,061
|
Re: Package Management from the Command Line
Cleaned up script a little bit more, added daemon option.
__________________
|
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|