Tips tagged bash


20

Tip #882   Find last modified files on a filesystem

To find the last modified files in a directory you can use ls -ltr. To find the last modified file on a file system it will not work, but the following command will work:

Read more »

17

Tip #872   Reverse geocode with bash

The following bash script, which depends on lynx web browser, uses Google's reverse geocode service to find a nearby address given a latitude and longitude pair:

Read more »

-34

Tip #864   Read a file line-by-line

This short script reads a file line-by-line ( whith whitespace characters too ) and outputs to STDOUT.

Read more »

6

Tip #850   Checksum directory recursively

Do a sha256sum of an entire directory name directory and check for integrity.
Modifying the IFS variable is necessary for filename with space.

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 »

12

Tip #814   Quit bash without saving history

If you're working in bash and want to quit without saving your history, you can do so using:

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 »

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 »

20

Tip #744   Close shell keeping all subprocess running

I often use 'screen' to run a command that I want to leave running when I logout but sometimes I forget and kick off a long job without screen. If you want to keep these things running, the following command will close the shell keeping all subprocess running

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 »