Redundant key strokes

[problem]

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

[/problem]

[solution]

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

[/solution]

[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. 🙂

[/example]

[reference]

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

[/reference]

If you have found my website useful, please consider buying me a coffee below 😉

Leave a Reply

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