Commands by adamhotep (4)

  • 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 "ubuntu.com" for "debian.org" if you want this to use Ubuntu's data instead. Everything else will work perfectly. Show Sample Output


    5
    apt-popcon() { (echo \#rank; apt-cache search "$@" |awk '$1 !~ /^lib/ {print " "$1" "}') |grep -Ff- <(wget -qqO- http://popcon.debian.org/by_inst.gz |gunzip); }
    adamhotep · 2012-09-08 00:29:31 4
  • This is like `cd -` but doesn't echo the new directory name, which is preferable (to me) for an alias, e.g. alias cdo="cd $OLDPWD"


    -2
    cd $OLDPWD
    adamhotep · 2012-04-16 21:18:27 3
  • shorter version. I believe find is faster than ls as well.


    0
    find . -type d |sed 's:[^-][^/]*/:--:g; s:^-: |:'
    adamhotep · 2012-04-14 00:51:09 5
  • A tweak using Patola's code as a base, this full-width green matrix display has all the frills (and all the printable characters). You don't need the surrounding parens if you don't care about losing globbing capabilities. Z-shell (/bin/zsh) needs neither the parens nor the `set -o noglob` Screen shot (animated): http://desmond.imageshack.us/Himg32/scaled.php?server=32&filename=matrixh.gif&res=landing If it's too slow, try lowering the `sleep 0.05` or even replacing it with `true` (which is faster than `sleep 0`). I squashed it as narrow as I could to conserve space, though somebody could probably squeeze a char or two out. Enjoy!


    0
    (set -o noglob;while sleep 0.05;do for r in `grep -ao '[[:print:]]' /dev/urandom|head -$((COLUMNS/3))`;do [ $((RANDOM%6)) -le 1 ] && r=\ ;echo -ne "\e[$((RANDOM%7/-6+2));32m $r ";done;echo;done)
    adamhotep · 2012-04-13 02:09:10 3

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

Most used commands from history (without perl)
I copied this (let's be honest) somewhere on internet and I just made it as a function ready to be used as alias. It shows the 10 most used commands from history. This seems to be just another "most used commands from history", but hey.. this is a function!!! :D

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"

save date and time for each command in history
Date-time format: YYYY-MM-DD HH:MM:SS

Write comments to your history.
A null operation with the name 'comment', allowing comments to be written to HISTFILE. Prepending '#' to a command will *not* write the command to the history file, although it will be available for the current session, thus '#' is not useful for keeping track of comments past the current session.

sort lines by length
making it "sound" more "natural" language like -- additionally sorting the longest words alphabetically: this approach is using: * to get at all lines of input * post-"for" structure * short-circuit-or in sort: if the lengths are the same, then sort alphabetically otherwise don't even evaluate the right hand side of the or * -C sets all input and ouput channels to utf8

create a simple version of ls with extended output
create a short alias for 'ls' with multi-column (-C), file type syntax additions (slashes after directories, @ for symlinks, etc... (-F), long format (-l), including hidden directories (all ./, ../, .svn, etc) (-a), show file-system blocks actually in use (-s), human readable file sizes (-h)

List detailed information about a ZIP archive
list zipfile info in long Unix ``ls -l'' format.

Recursively remove .svn directories from the current location

check open ports without netstat or lsof

Create a zip file ignoring .svn files


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: