bash – Grey Panthers Savannah https://grey-panther.net Just another WordPress site Tue, 06 Sep 2011 09:36:00 +0000 en-US hourly 1 https://wordpress.org/?v=6.7 206299117 Quick’n’dirty Mediawiki file crawler https://grey-panther.net/2011/09/quickndirty-mediawiki-file-crawler.html https://grey-panther.net/2011/09/quickndirty-mediawiki-file-crawler.html#respond Tue, 06 Sep 2011 09:36:00 +0000 https://grey-panther.net/?p=56

URL='http://10.0.0.1' MIME='image/jpeg' 
  bash -c 'wget -q -O - "$URL/wiki/index.php?title=Special:MIMESearch&mime=$MIME&limit=500&offset=0" 
  | grep -Po "/wiki/images[^"]+" 
  | xargs -n1 -I {} wget "$URL{}"'

What it does: it uses the “MIME search” functionality on the wiki to locate files of a certain mime type and then xargs+wget each of them.

Limitations:

  • A maximum of 500 files are downloaded
  • Downloads are not parallelized, thus slower than they could be
]]>
https://grey-panther.net/2011/09/quickndirty-mediawiki-file-crawler.html/feed 0 56
Adding tab completition to Maven3 under Ubuntu https://grey-panther.net/2011/06/adding-tab-completition-to-maven3-under-ubuntu.html https://grey-panther.net/2011/06/adding-tab-completition-to-maven3-under-ubuntu.html#respond Wed, 01 Jun 2011 17:10:00 +0000 https://grey-panther.net/?p=62

Maven 3 was released recently (depending on your definition of recent), but is not yet packaged for Ubuntu. This is generally not a problem, since the installation instructions are easy to follow (alternatively here are the installation instructions from the Sonatype maven book), but you don’t get tab completion in your terminal, which is quite a bummer, since I don’t know how to write correctly without a spellchecker.

Fortunately the steps to add it are simple:

  • Download an older Maven2 package
  • Extract from it the /etc/bash_completion.d/maven2 file (take care not to install the package by mistake)
  • Put the extracted file into /etc/bash_completion.d/maven3
  • Restart your terminal

These steps should also work with other Linux distributions if they have bash-completion installed.

This is a cross-post from the Transylvania-JUG blog.

]]>
https://grey-panther.net/2011/06/adding-tab-completition-to-maven3-under-ubuntu.html/feed 0 62
Bash shortcuts https://grey-panther.net/2007/12/bash-shortcuts.html https://grey-panther.net/2007/12/bash-shortcuts.html#comments Mon, 03 Dec 2007 07:43:00 +0000 https://grey-panther.net/?p=795 Or: never do history | grep again!

The command line interface of the *nix systems is amazing and Windows doesn’t have anything that comes even close to it (although I still have to experiment with PowerShell – I like very much the base idea that instead of text lines you get objects with well defined properties and you don’t have to play the I check two cases and throw out a regular expression which will die in the particular cases game). A nice thing I discovered recently are the shortcut keys you can use:

Ctrl + A
Go to the beginning of the line you are currently typing on
Ctrl + E
Go to the end of the line you are currently typing on
Ctrl + L
Clears the Screen, similar to the clear command
Ctrl + U
Clears the line before the cursor position. If you are at the end of the line, clears the entire line.
Ctrl + H
Same as backspace
Ctrl + R
Let’s you search through previously used commands. This is the one that can replace the history | grep process.
Ctrl + C
Kill whatever you are running – proably a well known to everyone
Ctrl + D
Exit the current shell. Also known as end of stream – basically the shell terminates because you’ve said there will be no more input from here!
Ctrl + Z
Puts whatever you are running into a suspended background process. fg restores it.
Ctrl + W
Delete the word before the cursor
Ctrl + K
Clear the line after the cursor
Ctrl + T
Swap the last two characters before the cursor
Esc + T
Swap the last two words before the cursor
Alt + F
Move cursor forward one word on the current line
Alt + B
Move cursor backward one word on the current line
Tab
Auto-complete files and folder names

For more keyboard shortcut goodies, visit the following sites:

Or just search for bash shortcuts with your favorite search engine.

]]>
https://grey-panther.net/2007/12/bash-shortcuts.html/feed 1 795