Posted By

hyper3xpl0iter on 02/25/13


Tagged

Bash linux tips


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

dvertigo


BashTips


 / Published in: Bash
 

  1. #!/bin/bash
  2.  
  3. ###########################################################################
  4. #
  5. # Filename: bashtips.list
  6. # Description: List of tips for Bash scripts
  7. # Version: 1.0
  8. # Source: source is unknown I found it around the web and will add to it
  9. # : from time to time
  10. # Author: hyper3xpl0iter
  11. # Date: 02/23/2013 19:22:20
  12. #
  13. #
  14. ###########################################################################
  15. function bashtips {
  16. cat <<EOF
  17. DIRECTORIES
  18. -----------
  19. ~- Previous working directory
  20. pushd tmp Push tmp && cd tmp
  21. popd Pop && cd
  22.  
  23. GLOBBING AND OUTPUT SUBSTITUTION
  24. --------------------------------
  25. ls a[b-dx]e Globs abe, ace, ade, axe
  26. ls a{c,bl}e Globs ace, able
  27. \$(ls) \`ls\` (but nestable!)
  28.  
  29. HISTORY MANIPULATION
  30. --------------------
  31. !! Last command
  32. !?foo Last command containing \`foo'
  33. ^foo^bar^ Last command containing \`foo', but substitute \`bar'
  34. !!:0 Last command word
  35. !!:^ Last command's first argument
  36. !\$ Last command's last argument
  37. !!:* Last command's arguments
  38. !!:x-y Arguments x to y of last command
  39. C-s search forwards in history
  40. C-r search backwards in history
  41.  
  42. LINE EDITING
  43. ------------
  44. M-d kill to end of word
  45. C-w kill to beginning of word
  46. C-k kill to end of line
  47. C-u kill to beginning of line
  48. M-r revert all modifications to current line
  49. C-] search forwards in line
  50. M-C-] search backwards in line
  51. C-t transpose characters
  52. M-t transpose words
  53. M-u uppercase word
  54. M-l lowercase word
  55. M-c capitalize word
  56.  
  57. COMPLETION
  58. ----------
  59. M-/ complete filename
  60. M-~ complete user name
  61. M-@ complete host name
  62. M-\$ complete variable name
  63. M-! complete command name
  64. M-^ complete history
  65. EOF
  66. }
  67.  

Report this snippet  

You need to login to post a comment.