Skip to main content
added 35 characters in body
Source Link
miguel.de.icaza
  • 5.4k
  • 3
  • 32
  • 25

If you are a fast typist, these come in handy:

alias grpe='grep --color=tty' alias gpre='grep --color=tty' alias rgep='grep --color=tty' alias gerp='grep --color=tty' 

This macro helps you compute totals of a column of output: file sizes, bytes, packets, all you have to do is specify the column that you want to add:

total () { if [ x$1 = x ]; then set `echo 1`; fi awk "{total += \$$1} END {print total}" } 

You use it like this for example, with no arguments, it adds the total of the first column:

du | total 

If you provide the argument, it will sum that column, for example, this gives you the total number of bytes used by all the C# files in /tmp:

ls -l /tmp/*cs | total 5 

Sometimes your console gets messed up because you accidentally viewed a binary file (cat /bin/ls for example), you can restore the terminal with this shell function:

restaura () { perl -e 'print "\e)B";' } 

I like my ls to use characters to distinguish the class of files, and also to hide the backup files generated by my editor (backup files end with the ~ character):

alias ls='ls -FB' 

If you are a fast typist, these come in handy:

alias grpe='grep --color=tty' alias gpre='grep --color=tty' alias rgep='grep --color=tty' 

This macro helps you compute totals of a column of output: file sizes, bytes, packets, all you have to do is specify the column that you want to add:

total () { if [ x$1 = x ]; then set `echo 1`; fi awk "{total += \$$1} END {print total}" } 

You use it like this for example, with no arguments, it adds the total of the first column:

du | total 

If you provide the argument, it will sum that column, for example, this gives you the total number of bytes used by all the C# files in /tmp:

ls -l /tmp/*cs | total 5 

Sometimes your console gets messed up because you accidentally viewed a binary file (cat /bin/ls for example), you can restore the terminal with this shell function:

restaura () { perl -e 'print "\e)B";' } 

I like my ls to use characters to distinguish the class of files, and also to hide the backup files generated by my editor (backup files end with the ~ character):

alias ls='ls -FB' 

If you are a fast typist, these come in handy:

alias grpe='grep --color=tty' alias gpre='grep --color=tty' alias rgep='grep --color=tty' alias gerp='grep --color=tty' 

This macro helps you compute totals of a column of output: file sizes, bytes, packets, all you have to do is specify the column that you want to add:

total () { if [ x$1 = x ]; then set `echo 1`; fi awk "{total += \$$1} END {print total}" } 

You use it like this for example, with no arguments, it adds the total of the first column:

du | total 

If you provide the argument, it will sum that column, for example, this gives you the total number of bytes used by all the C# files in /tmp:

ls -l /tmp/*cs | total 5 

Sometimes your console gets messed up because you accidentally viewed a binary file (cat /bin/ls for example), you can restore the terminal with this shell function:

restaura () { perl -e 'print "\e)B";' } 

I like my ls to use characters to distinguish the class of files, and also to hide the backup files generated by my editor (backup files end with the ~ character):

alias ls='ls -FB' 
Post Made Community Wiki
Source Link
miguel.de.icaza
  • 5.4k
  • 3
  • 32
  • 25

If you are a fast typist, these come in handy:

alias grpe='grep --color=tty' alias gpre='grep --color=tty' alias rgep='grep --color=tty' 

This macro helps you compute totals of a column of output: file sizes, bytes, packets, all you have to do is specify the column that you want to add:

total () { if [ x$1 = x ]; then set `echo 1`; fi awk "{total += \$$1} END {print total}" } 

You use it like this for example, with no arguments, it adds the total of the first column:

du | total 

If you provide the argument, it will sum that column, for example, this gives you the total number of bytes used by all the C# files in /tmp:

ls -l /tmp/*cs | total 5 

Sometimes your console gets messed up because you accidentally viewed a binary file (cat /bin/ls for example), you can restore the terminal with this shell function:

restaura () { perl -e 'print "\e)B";' } 

I like my ls to use characters to distinguish the class of files, and also to hide the backup files generated by my editor (backup files end with the ~ character):

alias ls='ls -FB'