måndag 23 mars 2015

linux - packages commands

#---------------------------------------------------------------------------------------------
The original script will miss out packages with long names
such as "openoffice.org-hyphenation-en-us". A better way to
get the complete list of manually-installed packages using only aptitude is:

#---------------------------------------------------------------------------------------------

#Long version of list installed not automatic

aptitude search "?installed ?not(?automatic)"  ;--display-format "%p"
" > apitiude-long-installed-not-automatic.txt


#Short version of list installed not automatic
aptitude search "?installed ?not(?automatic)" --display-format "%p" > apitiude-installed-not-automatic.txt

#Output wajing commands to textfile
wajig list-commands > wajig-commands.txt
 
#---------------------------------------------------------------------------------------------


This following line dont work  

sudo aptitude markauto $(apt-cache showsrc PACKAGE | grep Build-Depends | perl -p -e 's/(?:[\[(].+?[\])]|Build-Depends:|,|\|)//g')
apt-get --print-uris --yes install vlc | grep ^\’ | cut -d\’ -f2>>offline.txt


aptitude keep-all && aptitude update && aptitude upgrade


apt-get -f install              or          aptitude install -f
wajig fixmissing
aptitude upgrade


    apt-get: Installs and removes packages, and updates the local cache of what packages are available.
    apt-cache: Maintain and search the local cache of what packages are available.
    apt-listbugs: List what bugs (if any) are registered against a given package before you install it (very useful for people like me who run the Sid/Unstable version).
    apt-listchanges: Same thing, but for non-bug changes.
    apt-rdepends: Tool for viewing dependency trees.
    deborphan: Try and figure out what packages are installed that you don't really need.
    debfoster: Helps deborphan figure out what packages you don't need anymore, but only if you knew to install it before you installed the package.
    dpkg: The RPM-equivalent for Debian, you have to use dpkg half the time to do various maintenance tasks.
   
   
    aptitude update: Update the local cache of available packages (formerly apt-get update.
    aptitude upgrade: Upgrade available packages (formerly apt-get upgrade).
    aptitude dist-upgrade: Upgrade available packages even if it means removing stuff (formerly apt-get dist-upgrade).
    aptitude install pkgname: Install package (formerly apt-get install).
    aptitude remove pkgname: Uninstall package (formerly apt-get remove).
    aptitude purge pkgname: Uninstall package and config files (formerly apt-get --purge remove).
    aptitude search string: Search for a package with "string" in the name or description (formerly apt-cache search string).
    aptitude show pkgname: Show detailed of a package (formerly apt-cache show pkgname).
    aptitude clean: Delete downloaded package files (formerly apt-get clean).
    aptitude autoclean: Delete only out-of-date package files but keep current ones (formerly apt-get autoclean).
    aptitude hold pkgname: Fix a package at its current version and don't upgrade it automatically (formerly an obscure echo-to-file command). unhold to remove the hold.
   
    alias aptsrch='apt-cache search' ## search for pkg or phrase in repos
    alias aptshow='apt-cache show' ## details about a pkg in repository
    alias aptdep='apt-cache depends' ## list dependencies for pkg
    alias aptrdep='apt-cache rdepends' ## list pkgs depending on pkg
    alias aptsrcinfo='apt-cache showsrc' ## show info about pkg source
    alias aptfiles='apt-file list' ## list files in repository pkgs
    alias aptfsrch='apt-file search' ## search for files in repository pkgs
    alias aptfileslcl='dpkg -S' ## search for files in installed pkgs
    alias aptfilespkg='dpkg -L' ## list files in one installed pkg
    alias aptpkgs='dpkg --get-selections' ## list pkgs "selected" (=installed??)
    alias aptfilupd='apt-file update' ## update the file-list cache
    alias aptupd='apt-get update' ## update the pkg info from repos
    alias aptfixdep='apt-get -f install' ## try to fix broken dependencies
    alias aptinst='apt-get install' ## install pkg(s)
    alias debinfo='dpkg -f' ## show deb control file
    alias deblist='dpkg -c' ## list contents of a local deb-file
    alias debinst='dpkg -i' ## install pkg from a local deb-file
    function aptstat { ## status of installed pkgs (optional display width)
    if [[ $1 = +([0-9]) ]] ;then typeset cols=$1 ; shift ;fi
    COLUMNS=${cols:-$COLUMNS} dpkg --list "$@" ;}

#-----------------------------------------------------------------------------------------
#You can make a local copy of the package and debconf selection states by the following.
#-----------------------------------------------------------------------------------------
    dpkg --get-selections '*' > selection.dpkg
    debconf-get-selections    > selection.debconf
   
#-----------------------------------------------------------------------------------------   
#You can transfer these 2 files to another computer, and install there with the following.
#-----------------------------------------------------------------------------------------
     dselect update
     debconf-set-selections < myselection.debconf
     dpkg --set-selections  < myselection.dpkg
     apt-get -u dselect-upgrade    # or dselect install
   
   
Skicka en kommentar