All Tips


20

Tip #173   Count files by type

To find out the number of files of each type in your current directory try the following:

Read more »

19

Tip #6  

Use || to run a second command if and only if a first command fails:

Read more »
  • TAGS:

19

Tip #177   Copy and paste from the command line

Add the following alias and function to your profile to be able to copy and paste files at the command line:

Read more »

19

Tip #376   Change prompt color dynamically

I'm frequently logged into multiple different boxes concurrently. To help me keep track of which box I'm working on at the moment, I have this in my .bashrc file, which I keep rsynced across the various boxes.

Read more »

19

Tip #869   BOFH Excuses

Get an excuse in a single command...

form the BOFH...

Read more »
  • TAGS:

18

Tip #181   Remove empty directories

To remove empty directories (even if filenames or dirnames contain spaces or weird characters) from a tree you can do:

Read more »

17

Tip #180   Permanent bash history

Often I find myself using Ctrl-R in Bash to get an old command, only to find that too many days have passed and it's no longer in the .bash_history file.

It is possible to increase the number of lines in the history file, but there can always be a moment when you'll need a long command from many months ago. The solution below uses the PROMPT_COMMAND variable, a command that bash executes before showing each prompt. Here are the two lines to add to your profile:

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 »

16

Tip #25  

Instead of adding a prefix to the previous command with 'Up-arrow Home prefix Space' try 'prefix !!' to repeat the last command with 'prefix ' before it.
You can also use '!-n' to use commands other than the most recent. Read more »