Commands tagged Debian (93)

  • Removes the useless "grep" step present in many other solutions and tries to be as short and as fast as possible. A more elegant solution but longer and spawning one more process would be: dpkg -l | awk '/^rc/ { print $2 }' | xargs dpkg -P Show Sample Output

    dpkg -P $(dpkg -l | awk '/^rc/ { print $2 }')
    adelyne · 2016-10-24 21:37:08 0
  • Use dpkg-query to query packages.

    dpkg-query -W -f '${binary:Package} ${Status}\n' '*' |sed -n 's/ deinstall ok config-files//p'|xargs dpkg --purge
    ceving · 2016-09-06 11:43:04 0

  • 0
    zenity --info --text="I'am a popup"
    fundor333 · 2016-08-12 19:04:59 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
  • 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
  • Requires: curl xsel access to the internet( This is an alias utilizing the service to make sharing files easier from the command line. I have modified the alias provided by to use xsel to copy the resulting URL to the clipboard. The full modified alias is as follows since commandlinefu only allows 255 characters: transfer() { if [ $# -eq 0 ]; then echo "No arguments specified. Usage:\necho transfer /tmp/\ncat /tmp/ | transfer"; return 1; fi if tty -s; then basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g'); curl --progress-bar --upload-file "$1" "$basefile" |xsel --clipboard; else curl --progress-bar --upload-file "-" "$1" |xsel --clipboard ; fi; xsel --clipboard; } Show Sample Output

    transfer() { basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g');curl --progress-bar --upload-file "$1" "$basefile"|xsel --clipboard;xsel --clipboard ; }
    leftyfb · 2016-03-20 19:38:48 0
  • Someone quoted Pooh in an init script. Let's see it! (Probably only works on Debian & friends) Show Sample Output

    grep -Pooh .*t..r,.* /etc/init.d/*
    drewbenn · 2015-10-23 17:35:28 2
  • You can search for CVEs at or use --report to get full links. This can be added to cron, but unless you're going to do manual patches, you'd just be torturing yourself.

    debsecan --format detail
    pdxdoughnut · 2015-10-22 18:46:41 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
  • # AllInOne: Update what packages are available, upgrade to new versions, remove unneeded packages # (some are no longer needed, replaced by the ones from ap upgrade), check for dependencies # and clean local cached packages (saved on disk but not installed?,some are needed? [this only cleans unneeded unlike ap clean]). # aliases (copy into ~/.bashrc file): alias a='alias' a ap='apt-get' a r='ap autoremove -y' a up='ap update' a u='up && ap upgrade -y --show-progress && r && ap check && ap autoclean' # && means "and run if the previous succeeded", you can change it to ; to "run even if previous failed". I'm not sure if ap check should be before or after ap upgrade -y, you can also change the alias names. # To expand aliases in bash use ctrl alt e or see this # For more useful aliases go to

    apt-get update && apt-get dist-upgrade -y --show-progress && apt-get autoremove -y && apt-get check && apt-get autoclean -y
    unixmonkey78577 · 2014-07-26 12:18:57 0
  • Install twistd first with sudo apt-get install python-twistd-web

    twistd -no web
    nkorth · 2014-02-01 22:35:50 0

  • 0
    unixmonkey72986 · 2014-02-01 03:14:45 0

  • 3
    dpkg -l linux-* | awk '/^ii/{ print $2}' | grep -v -e `uname -r | cut -f1,2 -d"-"` | grep -e [0-9] | xargs sudo apt-get -y purge
    yusufk · 2014-01-29 10:42:40 0
  • The rsstail is the python version (python-rsstail). The final command pipe it on every new line to gammu and a connected phone rsstail -o -n 1 --f 'RedditQuote: {title}' | while read line; do /usr/bin/gammu --sendsms TEXT +*yournumber* -text "$line"; done Show Sample Output

    rsstail -o -n 1 --f 'RedditQuote: {title}'
    Youpfu · 2014-01-08 15:33:48 0

  • 3
    dpkg-query -W --showformat='${Installed-Size}\t${Package}\n' | sort -nr | less
    dfear · 2014-01-06 01:11:36 0

  • 0
    export KEEP_KERNEL=2; dpkg -l 'linux-image*' | awk '/^ii/ { print $2 }' | grep "[0-9]" | awk 'BEGIN{i=1}{print i++, $0}' | grep `uname -r` -B99 | sort -r | tail -n+$(($KEEP_KERNEL+2)) | awk '{print $2}'| xargs apt-get -y purge
    The_IceMan_Blog · 2013-11-23 15:35:42 1
  • If you run dpkg --clear-selections or have otherwise selected installed packages for deinstall, but want to undo it, run this. It will set all installed packages back to installed status so that they won't be removed by commands like "dpkg -Pa"

    dpkg -l | grep ^ri | awk '{print $2 " install"}' | sudo dpkg --set-selections
    ajmccluskey · 2013-11-23 06:41:18 0

  • 0
    % sudo yum remove streams-$(uname-r)
    totalnut151 · 2013-11-21 17:41:19 0

  • 0
    dpkg-query -Wf '${Installed-Size}\t${Status}\t${Package}\n' | sort -n | grep installed
    falcald · 2013-09-29 15:12:03 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

  • 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
    salt -G 'os_family:Debian' ' /usr/lib/update-notifier/apt-check --human-readable'
    hinnerk · 2013-06-22 22:55:04 2

  • 0
    sudo cp /usr/share/zoneinfo/Europe/Paris /etc/localtime
    egeoffray · 2013-03-14 11:53:09 0
  • 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
  • This will take the packages matching a given `apt-cache search` query (a collection of AND'd words or regexps) and tell you how popular they are. This is particularly nice for those times you have to figure out which solution to use for e.g. a PDF reader or a VNC client. Substitute "" for "" if you want this to use Ubuntu's data instead. Everything else will work perfectly. Show Sample Output

    apt-popcon() { (echo \#rank; apt-cache search "$@" |awk '$1 !~ /^lib/ {print " "$1" "}') |grep -Ff- <(wget -qqO- |gunzip); }
    adamhotep · 2012-09-08 00:29:31 0
  •  1 2 3 >  Last ›

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

Print text string vertically, one character per line.

Fastest segmented parallel sync of a remote directory over ssh
Mirror a remote directory using some tricks to maximize network speed. lftp:: coolest file transfer tool ever -u: username and password (pwd is merely a placeholder if you have ~/.ssh/id_rsa) -e: execute internal lftp commands set sftp:connect-program: use some specific command instead of plain ssh ssh:: -a -x -T: disable useless things -c arcfour: use the most efficient cipher specification -o Compression=no: disable compression to save CPU mirror: copy remote dir subtree to local dir -v: be verbose (cool progress bar and speed meter, one for each file in parallel) -c: continue interrupted file transfers if possible --loop: repeat mirror until no differences found --use-pget-n=3: transfer each file with 3 independent parallel TCP connections -P 2: transfer 2 files in parallel (totalling 6 TCP connections) sftp://remotehost:22: use sftp protocol on port 22 (you can give any other port if appropriate) You can play with values for --use-pget-n and/or -P to achieve maximum speed depending on the particular network. If the files are compressible removing "-o Compression=n" can be beneficial. Better create an alias for the command.

Command Line to Get the Stock Quote via Yahoo
Retrieve the current stock price from Yahoo Finance. The output is simply the latest price (which could be delayed). If you want to look up stock for a different company, replace csco with your symbol.

Batch edition of all Writer files in the current directory (body text)
This function does a batch edition of all OOO3 Writer files in current directory. It uses sed to search a FOO pattern into body text of each file, then replace it to foo pattern (only the first match) . I did it because I've some hundreds of OOO3 Writer files where I did need to edit one word in each ones and open up each file in OOO3 gui wasn't an option. Usage: bsro3 FOO foo

View any already in progress copy command in detail
If you spot a dubious looking cp command running you can use this command to view what is being copied and to where. 1234 is the PID of the cp command being passed to the lsof utility. 3r.*REG will display the file/directory that is being read/copied. 4w.*REG will display the destination it is being written to.

Generate random valid mac addresses
First set the variable $hexchars: $hexchars="0123456789ABCDEF" Change the number in the first for loop if you need less then 1200 mac addresses

Install pip with Proxy
Installs pip packages defining a proxy

Super Speedy Hexadecimal or Octal Calculations and Conversions to Decimal.
^Hexadecimal Ten minus Octal Ten is Eight(in Decimal). $ echo "$(( 0xaf )) = $(( 0257 ))" ^Hexadecimal AF and Octal 257 are both Decimal 175.

Which processes are listening on a specific port (e.g. port 80)
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"

find process associated with a port
e.g. fuser 25/tcp (see which pid is listening on smtp)

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: