All Tips


19

Tip #6  

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

Read more »
  • TAGS:

13

Tip #11  

Add commas to all numeric strings in a file, changing "1234567" to "1,234,567"

Read more »

0

Tip #12  

Add a leading angle bracket and space to each line (quote a message)

Read more »

183

Tip #21  

Place a filename at the beginning of the line to make it easier to edit the search at the end of the command.

Read more »

24

Tip #22   Grepping for processes

Grepping for a process will return the grep command, this can be avoided by adding '| grep -v grep' to a command or easier in some cases altering the regular expression by adding brackets around a character.

Read more »

16

Tip #23  

It can be useful to not only know what has gone to stdout and stderr but also where they occurred with respect to each other.
Allow stderr to go to err.txt, stdout to out.txt and both to mix.txt

Read more »

199

Tip #24  

Don't search history by grepping ~/.bash_history, or repeatedly hitting the up arrow, instead use CTRL+r (or '/' in vi-mode) for search-as-you type. You can immediately run the command by pressing Enter. 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 »

311

Tip #26  

Running a second command with the same arguments as the previous command, use '!*' to repeat all arguments or '!:2' to use the second argument. '!$' uses the final argument.

Read more »

6

Tip #27  

Use awk to change the file extension for a group of files. For example to change all .htm files to .php:

Read more »