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]
[…] UNIX Coding School ยป Redundant key strokes Redundant key strokes, UNIX shortcuts, Unix Coding School (tags: Redundant key strokes UNIX shortcuts Coding School) […]