Commands matching apt (200)

  • in Debian-based systems apt-get could be limited to the specified bandwidth in kilobytes using the apt configuration options(man 5 apt.conf, man apt-get). I'd quote man 5 apt.conf: "The used bandwidth can be limited with Acquire::http::Dl-Limit which accepts integer values in kilobyte. The default value is 0 which deactivates the limit and tries uses as much as possible of the bandwidth..." "HTTPS URIs. Cache-control, Timeout, AllowRedirect, Dl-Limit and proxy options are the same as for http..."


    2
    sudo apt-get -o Acquire::http::Dl-Limit=20 -o Acquire::https::Dl-Limit=20 upgrade -y
    ruslan · 2011-02-14 05:24:49 3
  • After, check if working by executing this command locally : git clone git@192.168.0.18:repositories/gitosis-admin.git Tutorial : http://blog.hemca.com/?p=560


    2
    apt-get -y install git-core gitosis; adduser --home /home/git --gecos "git user" git; su git -c "ssh-keygen -t rsa -f /home/git/.ssh/id_rsa; gitosis-init < ~/.ssh/id_rsa"
    strzel_a · 2010-12-19 20:37:12 5

  • 2
    alias capture='IMAGE="/home/user/Pictures/capture-`date +%Y%m%d%H%M%S`.png"; import -frame $IMAGE; echo "Image saved as $IMAGE"'
    Vincent · 2010-11-22 05:07:17 3
  • A little aptitude magic. Note: this will remove images AND headers. If you just want to remove images: aptitude remove ?and(~i~nlinux-im ?not(~n`uname -r`)) I used this in zsh without any problems. I'm not sure how other shells will interpret some of the special characters used in the aptitude search terms. Use -s to simulate.


    2
    aptitude remove ?and(~i~nlinux-(im|he) ?not(~n`uname -r`))
    dbbolton · 2010-06-11 22:57:09 6
  • In my case it was actually like this... Show Sample Output


    2
    cat /proc/acpi/ac_adapter/AC0/state
    eponafries · 2010-06-10 08:53:20 3
  • Change the APP variable's value to whatever you want to install. Depending on how fast your machine is, you'll want to adjust the value 50 to something else. You might also want to play a different game than Gnometris - just make sure it's a GUI game.


    2
    APP=wine; if [ $(sudo apt-get --print-uris -y install $APP | sed -ne 's/^After this operation, \([0-9]\{1,\}\).*MB.*/\1/p') -gt 50 ]; then gnometris 2>/dev/null & sudo apt-get install $APP; else sudo apt-get install $APP; fi
    rkulla · 2010-04-18 19:32:26 39

  • 2
    sudo deborphan | xargs sudo apt-get -y remove --purge
    eastwind · 2010-04-10 13:06:03 5

  • 2
    aptitude search '~i!~E' | grep -v "i A" | cut -d " " -f 4
    XORwell · 2010-03-25 00:40:51 6
  • Debian: Mark all dependent packages as manually installed. So they are not automatically removed if you remove some meta package - like gnome-desktop-environment for example.


    2
    sudo aptitude unmarkauto $(apt-cache depends some-deb-meta-package-name | grep Depends | cut -d: -f2)
    yra · 2009-08-26 12:56:33 8
  • when we add a new package to a aptitude (the debian package manager) we need to add the gpg, otherwise it will show warning / error for missing key Show Sample Output


    2
    wget -q http://xyz.gpg -O- | sudo apt-key add -
    gnuyoga · 2009-03-25 12:18:29 8
  • This is useful if you add sid, install some packages, then remove sid and want to work out which packages you installed from sid that should be removed (e.g. before an upgrade to the new stable). Alternatively you can think of this as "find installed packages that can no longer be installed."


    1
    aptitude search -F '%p %v %V %O' '?narrow(?not(?archive("^[^n][^o].*$")),?version(CURRENT))' | while IFS=' ' read -r pkg ver candidate origin; do if [[ $ver == "$candidate" ]] && [[ $origin == '(installed locally)' ]]; then echo "$pkg"; fi; done
    sorpigal · 2021-12-26 15:57:15 304
  • Sometimes we install programs, we forget about them, and they stay there wasting RAM. This one-liner try to find them. Show Sample Output


    1
    ps -eo cmd | awk '{print $1}'| sort -u | grep "^/" | xargs dpkg -S 2>/dev/null | awk -F: '{print $1}' | sort -u | xargs apt-mark showmanual
    pabloab · 2020-03-26 06:16:45 81
  • This will also work with bash instead of sh shell sudo bash -c 'apt update -y && apt upgrade -y'


    1
    sudo sh -c 'apt update -y && apt upgrade -y'
    ioshield · 2019-07-31 04:39:40 293
  • pudb is an ncurses debugger. This command will allow interactive debugging of test failures in pytest using pudb.


    1
    pytest --pdbcls pudb.debugger:Debugger --pdb --capture=no
    malathion · 2019-07-14 02:54:59 42
  • -e is the script function, it performs search and replace like vi, and -i is the edit the file in place.


    1
    sed -e 's/dapper/edgy/g' -i /etc/apt/sources.list
    yusufk · 2019-05-14 21:57:29 38
  • If, for example, you want to remove all kernels and headers but the last three versions, you can't use one of that magic all-in-one "remove old stuff" commands. With this simple but elegant command you can remove a range of versions, or a list of versions with e.g. {14,16,20}. Show Sample Output


    1
    apt purge linux*{14..18}*
    ppq · 2016-04-20 07:44:55 11
  • it's nice to be able to use the command `ls program.{h,c,cpp}`. This expands to `ls program.h program.c program.cpp`. Note: This is a text expansion, not a shell wildcard type expansion that looks at matching file names to calculate the expansion. More details at http://www.linuxjournal.com/content/bash-brace-expansion I often run multiple commands (like apt-get) one after the other with different subcommands. Just for fun this wraps the whole thing into a single line that uses brace expansion.


    1
    echo apt-get\ {update,-y\ upgrade}\ \&\& true | sudo bash
    alecthegeek · 2015-09-22 00:48:26 13

  • 1
    sudo apt-get remove --purge $(dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d')
    jeffskinnerbox · 2015-09-19 00:41:36 13
  • An alternative without aptitude.


    1
    apt-mark showmanual|xargs sudo apt-mark markauto
    DellDor · 2015-08-10 02:35:22 12
  • Cleans apt-get and gpg cache and keys


    1
    sudo gpg --refresh-keys; sudo apt-key update; sudo rm -rf /var/lib/apt/{lists,lists.old}; sudo mkdir -p /var/lib/apt/lists/partial; sudo apt-get clean all; sudo apt-get update
    lpalgarvio · 2015-02-02 18:00:20 25
  • Could be dangerous, if you have many packages all beginning with 'foo' or 'bar'. This will easily remove them all from your system.


    1
    aptitude --purge remove ~i^foo ~i^bar
    mhs · 2015-01-27 15:00:48 12
  • In this case, linux- is the prefix; simply running apt-cache pkgnames would list every package APT knows about. The default APT config assumes -g, --generate; to use the cache as/is, you could similarly run: apt-cache --no-generate pkgnames [prefix] Adding --all-names, like so: apt-cache --no-generate --all-names pkgnames [prefix] would print all the packages APT knows about, using the cache as/is, including virtual packages and missing dependencies. This command was shamelessly stolen from the apt-cache(8) man-page. Show Sample Output


    1
    apt-cache pkgnames linux-
    benjabean1 · 2014-12-14 06:48:57 8

  • 1
    wget -r -P ./dl/ -A jpg,jpeg http://captivates.com
    ferdous · 2014-06-14 17:28:32 7
  • Sort netflow packet capture by unique connections excluding source port. Show Sample Output


    1
    grep -o -P '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\:[0-9]{1,5}\s->\s{5}[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\:[0-9]{1,5}' <capture file> | tr -d ' ' | sed 's/:.....//g' | sort -n | uniq -c | sort -nr
    santizo · 2014-03-05 21:34:42 8
  • Replace KEY with GPG key. This command will load GPG key and add it to your system so you can use software from third party repos etc. Show Sample Output


    1
    x=KEY; gpg --keyserver subkeys.pgp.net --recv $x; gpg --export --armor $x | sudo apt-key add -
    sxiii · 2013-11-26 10:49:32 9
  •  < 1 2 3 4 5 >  Last ›

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands


Check These Out

Selecting a random file/folder of a folder
Also looks in subfolders

Find removed files still in use via /proc
Oracle DBA remove some logfiles which are still open by the database and he is complaining the space has not been reclaimed? Use the above command to find out what PID needs to be stopped. Or alternatively recover the file via: $ cp /proc/pid/fd/filehandle /new/file.txt

Detach a process from the current shell
ignore HUP interruptions

ping with timestamp

Look for IPv4 address in files.
It finds a SNMP OID too :-(

Install pip with Proxy
Installs pip packages defining a proxy

Find removed files still in use via /proc
Oracle DBA remove some logfiles which are still open by the database and he is complaining the space has not been reclaimed? Use the above command to find out what PID needs to be stopped. Or alternatively recover the file via: $ cp /proc/pid/fd/filehandle /new/file.txt

Find usb device
I often use it to find recently added ou removed device, or using find in /dev, or anything similar. Just run the command, plug the device, and wait to see him and only him

Changing the terminal title to the last shell command
Found the same command for zsh in http://www.davidpashley.com/articles/xterm-titles-with-bash.html - changed it a bit so that the behaviour is the same

Find usb device in realtime
Using this command you can track a moment when usb device was attached.


Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: