Redundant key strokes

Problem

Carrying on with my lazy steps, there are bits of code used with UNIX commands, which are completely redundant.



Solution

Save yourself some key strokes, remember these examples. Or come back to unix.coding-school.com and check them out again. 🙂



Example



chmod a+r filename

The "a" is redundant – if you just do a "+r" – all is implied.


ls -l | awk ' $4 > 1000 { print $0 } '

In awk printing $0 is default action.


find . -type f -print

With find default action is to print.


echo a b c | tr '[abcdef]' '[ABCDEF]'

Use a range: echo a b c | tr '[a-z]' '[A-Z]'

In vi use ZZ instead of :wq 🙂

Only 2 chars less (including the shift) – but also just your little finger, instead of a hand span. 🙂



Reference

[tags]Redundant key strokes, UNIX shortcuts, Unix Coding School[/tags]



1 thought on “Redundant key strokes”

Leave a Reply

Your email address will not be published. Required fields are marked *