Commands tagged Debian (99)

  • Trickle is here: Trickle is a simple bandwidth limiter

    trickle sudo apt-get update -y
    mrman · 2011-02-15 02:05:37 0
  • locating packages held back, such as with "aptitude hold "

    aptitude search ~ahold
    pykler · 2012-04-29 15:02:32 0
  • The other commands were good, but they included packages that were installed and then removed. This command only shows packages that are currently installed, sorts smallest to largest, and formats the sizes to be human readable. Show Sample Output

    dpkg-query --show --showformat='${Package;-50}\t${Installed-Size}\n' `aptitude --display-format '%p' search '?installed!?automatic'` | sort -k 2 -n | grep -v deinstall | awk '{printf "%.3f MB \t %s\n", $2/(1024), $1}'
    EvilDennisR · 2013-07-26 23:18:20 0
  • 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

    apt-cache pkgnames linux-
    benjabean1 · 2014-12-14 06:48:57 0
  • An alternative without aptitude.

    apt-mark showmanual|xargs sudo apt-mark markauto
    DellDor · 2015-08-10 02:35:22 0
  • 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

    apt purge linux*{14..18}*
    ppq · 2016-04-20 07:44:55 0
  • Some command names are very different from the name of the package that installed them. Sometimes, you may want to find out the name of the package that provided a command on a system, so that you can install it on another system. Show Sample Output

    dpkg -S "$(readlink -e $(which w))" | cut -d ':' -f 1
    Fox · 2016-05-18 09:41:29 0
  • The vaule is expressed in megabytes Show Sample Output

    echo $[ ($(dpkg-query -s $(dpkg --get-selections | grep -oP '^.*(?=\binstall)') | grep -oP '(?<=Installed-Size: )\d+' | tr '\n' '+' | sed 's/+$//')) / 1024 ]
    acavagni · 2019-06-02 16:35:34 0
  • OS: Debian based (or those that use dpkg) Equivalent to doing a dpkg -S on each file in $PATH, but way faster. May report files generated though postinstall scripts and such. For example . It will report /usr/bin/vim .. which is not not a file installed directly by dpkg, but a link generated by alternatives hooks

    echo -e "${PATH//://\n}" >/tmp/allpath; grep -Fh -f /tmp/allpath /var/lib/dpkg/info/*.list|grep -vxh -f /tmp/allpath >/tmp/installedinpath ; find ${PATH//:/ } |grep -Fxv -f /tmp/installedinpath
    kamathln · 2009-09-09 05:33:14 1
  • List packages and their disk usage in decreasing order. This uses the "Installed-Size" from the package metadata. It may differ from the actual used space, because e.g. data files (think of databases) or log files may take additional space. Show Sample Output

    perl -ne '$pkg=$1 if m/^Package: (.*)/; print "$1\t$pkg\n" if m/^Installed-Size: (.*)/;' < /var/lib/dpkg/status | sort -rn | less
    hfs · 2009-10-19 12:55:59 1

  • 0
    dpkg-query -W -f='${Version}' package-name
    ohe · 2010-06-02 14:39:08 0
  • Supports regex pattern and very flexible output parameters and search options. Show Sample Output

    aptitude -F '%p %v#' search <pattern>
    unixmonkey10157 · 2010-06-03 15:37:27 0
  • A replacement for 'apt-cache' that uses a Xapian to produce ranked results. Available in 'apt-xapian-index' 0.27 and higher. Show Sample Output

    axi-cache search <searchterm>
    tarkasteve · 2010-07-05 00:16:03 0
  • Lists all packages in "rc" state and purge them one at a time.

    dpkg -l | grep ^rc | cut -d' ' -f3 | xargs dpkg -P
    cyrusza · 2010-11-22 12:53:31 2

  • 0
    debconf-copydb configdb copydb --pattern=<PACKAGE> --config="Name: copydb" --config="Driver: File" --config="Filename: ~/copydebconf.dat"
    ohe · 2011-08-29 14:00:42 0

  • 0
    debconf-copydb copydb configdb --config="Name: copydb" --config ="Driver: File" --config="Filename: ~/copydebconf.dat"
    ohe · 2011-08-29 14:01:31 0
  • since awk was already there one can use it instead of the 2 greps. might not be faster, but fast enough

    apt-get remove $(dpkg -l | awk "/^ii linux-(image|headers)/ && ! /`uname -r`/ {print \$2}")
    _john · 2011-10-09 13:58:47 0
  • after kernel build with make deb-pkg, I like to install the 4 newest packages that exist in the directory. Beware: might be fewer for you....

    sudo dpkg -i `ls -tr *.deb | tail -n4`
    _john · 2011-10-09 14:20:11 0
  • This will print the name of every installed package on a Debian system.

    aptitude search ~i -F %p
    dbbolton · 2011-10-15 00:31:10 1
  • # Search for an available package on Debian systems using a regex so it only matches packages starting with 'tin'.

    aptitude search ^tin
    defiantredpill · 2011-10-20 17:51:36 0
  • Marks all manually installed deb packages as automatically installed. Usefull to combine with apt-get install <all manually packages that we want> to have a clean installed debian-based system.

    aptitude -F "%p" search \!~M~i~T | xargs apt-mark markauto
    gspadari · 2012-03-09 13:44:00 0
  • also use: update-alternatives --config gnome-www-browser

    update-alternatives --config x-www-browser
    gwd · 2012-07-08 20:27:42 1
  • This functionality seems to be missing from commands like dpkg. Ideally, I want to duplicate the behavior of rpm --verify, but it seems difficult to do this in one relatively short command pipeline. Show Sample Output

    dpkg-query -Wf '${Package}\n' | xargs dpkg --status | sed '/^Conffiles:/,/^Description:/!d;//d' | awk '{print $2 " " $1}' | md5sum -c 2>/dev/null | grep FAILED$ | cut -f1 -d':'
    hallmarc · 2013-01-31 16:52:38 0

  • 0
    sudo cp /usr/share/zoneinfo/Europe/Paris /etc/localtime
    egeoffray · 2013-03-14 11:53:09 0

  • 0
    salt -G 'os_family:Debian' 'apt-get dist-upgrade --dry-run | grep ^Inst | cut -d" " -f2'
    hinnerk · 2013-06-22 22:57:47 0
  •  < 1 2 3 4 > 

What's this? 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

List the popular module namespaces on CPAN
Grabs the complete module list from CPAN, pulls the first column, ditches html lines, counts, ditches small namespaces.

Create an animated gif from a Youtube video
requires "youtube-dl" -- sure you can do this with wget and some more obscurity but why waste your time when this great tool is available? the guts consist of mplayer converting a video to a gif -- study this command and read the man page for more information $ mplayer video.flv -ss 00:23 -endpos 6 -vo gif89a:fps=5:output=output.gif -vf scale=400:300 -nosound generates a 6 second gif starting at 23 seconds of play time at 5 fps and a scale of 400x300 start time (-ss)/end time (-endpos) formats: 00:00:00.000 end time should be relative to start time, not absolute. i.e. -endpos 5 == seconds after 0:42 = 0:47 end point play with fps and scale for lower gif sizes the subshell is a solution for the -b flag on youtube-dl which downloads the best quality video, sometimes, which can be various video formats $(ls ${url##*=}*| tail -n1)

The top ten commands you use

Get list of servers with a specific port open
Change the -p argument for the port number. See "man nmap" for different ways to specify address ranges.

reverse order of file
awk reverse order of lines (emulates "tac")

generate random password (works on Mac OS X)
Prepending env LC_CTYPE=C fixes a problem with bad bytes in /dev/urandom on Mac OS X

Nicely display permissions in octal format with filename
Nicely display permissions in octal format and filename for a given directory

Mouse Tracking
Will track your mouse and save it to a file. You can use gnuplot to graph it: $ gnuplot -persist

Converts uppercase chars in a string to lowercase

Make vim open in tabs by default (save to .profile)
I always add this to my .profile rc so I can do things like: "vim *.c" and the files are opened in tabs.

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.


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: