Tips tagged bash


8

Tip #768   Stream shell commands to Twitter

When I read the tip yesterday (Twitter from the terminal), I thought it would be fun to set something up to tweet all the commands I enter. After a bit of playing around I have come up with the following:

First you'll need to create a script, it doesn't matter what you call it, just remember the name and path to it for later.

Read more »

8

Tip #571   Change file extension revisited

And again about file extension changing.

There are two tips about this:
#27 - http://www.shell-fu.org/lister.php?id=27
#544 - http://www.shell-fu.org/lister.php?id=544

I'm happy to provide one more variant. It's up to you which one is the most useful. Read more »

8

Tip #167   Find and replace with backup

Find and replace recursively over several files:
Read more »

8

Tip #821   Command line currency conversion

The script below can be used to convert between different currencies on the command line. In order to use the script, you would enter something like "[scriptname] 150 USD GBP" to give the value of 150 US dollars in British pounds.

Supported currencies are Euro, U.S. dollar British pound, Japanese yen, Swiss franc, Canadian dollar, Australian dollar, and Indian rupee.

Read more »

8

Tip #304   Get your IP in one line

#!/bin/bash
# by dj.r4iden
echo "Your ip Address is" `lynx --source http://www.formyip.com/ |grep The | awk {'print $5'}` Read more »

7

Tip #769   .. revisited

Tip 550 gives a script for a '..' command which will go up n directory levels, however the version there messes up your previous directory so "cd -" will not work. The version below fixes this problem:

.. v1.1
Usage .. [n]
Go up n-levels.
i.e.: .. 3 will go up 3 levels

Read more »

7

Tip #412   Vi mode in bash

Add "set -o vi" at the bottom of ~/.bashrc or /etc/bashrc, then press ESC in prompt to enter vi mode and search your issued command in history by giving a "/" at front.

For example, in shell command line, press ESC, type /ls, enter. Read more »

7

Tip #362   Tar remote dir over SSH

If you work on remote boxes a lot, you ll probably need a to backup a directory from there onto your machine sooner or later.. This can easilly be done using ssh & tar; all in 1 line of (script friendly) code:

Read more »

7

Tip #170   SVN resolve all conflicts

Resolve all your conflicted files. Use with caution!!

Read more »