Sunday, October 01, 2006

Useful Portage commands (emerge)



Sync up your portage tree with a mirror


emerge --sync
--sync
Initiates a portage tree update with one of the rsync.gentoo.org mirrors. Note that any changes you have made to the portage tree will be erased. Except for special circumstances, this uses rsync to do the update. See make.conf(5)'s description of PORTDIR_OVERLAY for a method to avoid deletions.



Build/install the latest updates in the portage tree.
I use this after 'emerge --sync'


emerge --update --deep world

--update (-u)
Updates packages to the best version available, which may not always be the highest version number due to masking for testing and development. This will also update direct dependencies which may not be what you want. In general, use this option only in combination with the world or system target.



Rebuild Everything
Making deep changes to the compiler toolchain may have lowlevel affects, forcing you do rebuild everything (if you are particularly inclined to play it safe). It could also be that you just like using CPU time ...


emerge -eav system
emerge -eav world

-emptytree (-e)
Reinstalls all world packages and their dependencies to the current USE specifications while differing from the installed set of packages as little as possible. You should run with --pretend first to make sure the result is what you expect.



Search for portage packages
Used to look into the portage tree and find something. It also will tell you if it is install, what version it is, and other useful tidbits.


emerge -s package_name
Example
#emerge -s nut
[snipping the none relevant matches]
* sys-power/nut
Latest version available: 2.0.4-r1
Latest version installed: 2.0.4-r1
Size of files: 683 kB
Homepage: http://www.networkupstools.org/
Description: Network-UPS Tools
License: GPL-2



External References
Rockfloat's tips and tricks also has a good reference

An introduction to Portage: link
A simple portage Wiki page: Portage and Ebuilds
The man page: Portage Man page
The "best-known practices" for working with Portage: HOWTO_Use_Portage_Correctly



Keywords: Gentoo Portage, Gentoo Package Management, Gentoo Portage Commands, Gentoo emerge commands, Gentoo Linux Portage, Useful Portage commands.

No comments: