PageRenderTime 57ms CodeModel.GetById 30ms RepoModel.GetById 0ms app.codeStats 0ms

/doc/okas.pm

https://gitlab.com/glensc/okas
Perl | 242 lines | 149 code | 90 blank | 3 comment | 15 complexity | d5df10616b7353d20126b9568a3d730a MD5 | raw file
  1. =head1 NAME
  2. okas - okas
  3. when unix invented two character commands, then okas makes them one :)
  4. =head1 bash aliases
  5. B<ls>, B<df>, B<du> all use human readable forms. (B<-h> switch)
  6. B<cp>, B<mv> will ask you when you overwrite a file.
  7. =head1 dns tools
  8. =over 2
  9. =item B<mx> I<HOST>
  10. Lookup mx record for host.
  11. =item B<soa> I<DOMAIN>
  12. Lookup SOA for I<DOMAIN>.
  13. =item B<nsa> I<HOST>
  14. Do ANY query for I<HOST>.
  15. =back
  16. =head1 web tools
  17. =over 2
  18. =item B<hdrs> I<URL>
  19. Fetch http headers from URL (does GET request) to be fully compatible (some
  20. servers might have different behaviour if you do HEAD request).
  21. =item B<ws>
  22. Fetch L<http://localhost/server-status> and display it in terminal.
  23. =item B<wr>
  24. Show running Apache/Lightttpd requests from C<ws> output.
  25. =item B<mailescape>
  26. To avoid get emails caught by crawlers and spamspiders, there is way to "crypt"
  27. email addresses. input stream is searched for email addresses and matched
  28. addresses are replaced with html numeric entities every RFC-compiliant browser
  29. can render these, and there's no visible change for user.
  30. Example:
  31. $ echo "here's bill address: bill@microsoft.com" | mailescape
  32. replace [bill@microsoft.com] -> [&#98;&#105;&#108;&#108;&#64;&#109;&#105;&#99;&#114;&#111;&#115;&#111;&#102;&#116;&#46;&#99;&#111;&#109;]
  33. here's bill address: &#98;&#105;&#108;&#108;&#64;&#109;&#105;&#99;&#114;&#111;&#115;&#111;&#102;&#116;&#46;&#99;&#111;&#109;
  34. $ mailescape < index.html > new.html
  35. =back
  36. =head1 shell tools
  37. =over 2
  38. =item B<cronlogger> PROGRAM
  39. Runs program, redirects all output to logfile. Output is also displayed on
  40. screen if there's attached terminal. Intented to be run from cron.
  41. The log is stored in C<$LOGDIR> with a indent detected from started program and
  42. current date in filename, existing files are detected and incrementing serial
  43. is appended to log filename.
  44. ENVIRONMENT
  45. LOGDIR - defines directory where to store the logs. defaults to 'logs/'
  46. INDENT - enforce indent for logfile. defaults to one detected from PROGRAM.
  47. =item B<pcat>
  48. cat(1) null terminated strings.
  49. $ pcat /proc/$$/cmdline
  50. =item B<punserialize>
  51. dump files serialized by php.
  52. =item B<zl>
  53. Display contents of file, without empty lines and comments. the result is piped
  54. do less(1), but it can be captured to file or another pipe.
  55. $ zl /etc/sysctl.conf | sort > a1
  56. $ zl /etc/sysctl.conf.rpmnew | sort > a2
  57. $ dif a[12]
  58. =item B<diffcol>
  59. This command will colourize unidiff according to vim colour schema. pipe output
  60. of cvs diff, regular patch to it to see diff coloured nicely.
  61. $ cvs diff -u -r1.1 -r1.2 foo.c | diffcol
  62. =item B<dif>
  63. dif combines diffcol and less to one command.
  64. it also excludes VCS control dirs C<.svn>, C<.bzr>, C<.git>, C<CVS>
  65. $ dif /etc/passwd~ /etc/passwd
  66. =item B<d>
  67. C<d> is alias showing you dif(1) of your last edited file:
  68. # vim /etc/passwd
  69. # d /etc/passwd
  70. --- /etc/passwd~ 2009-11-20 12:13:38.000000000 +0200
  71. +++ /etc/passwd 2009-11-20 12:13:40.000000000 +0200
  72. @@ -1,4 +1,4 @@
  73. -root:x:0:0:root:/root:/bin/sh
  74. +root:x:0:0:root:/root:/bin/bash
  75. bin:x:1:1:bin:/bin:/sbin/nologin
  76. daemon:x:2:2:daemon:/sbin:/sbin/nologin
  77. adm:x:3:4:adm:/var/adm:/sbin/nologin
  78. =item B<rgrep>
  79. grep-r is alias to C<grep -r> with exclusion of VCS control dirs C<.svn>,
  80. C<.bzr>, C<.git>, C<CVS>
  81. $ rgrep "sometext" .
  82. =item B<clean>
  83. Clean up all backups (I<*~>) recursively.
  84. =item B<cleand>
  85. Clean up all backups from current dir.
  86. =item B<undos>
  87. Convert filelist from DOS line endings to UNIX (CRLF -> CR).
  88. =item B<unansi>
  89. Remove ansi colour escapes from stream (STDIN).
  90. =item B<cdwd>
  91. chdir to current real directory (bash emulates symlinks).
  92. it's also sometimes needed to cd back to current path (when someone has
  93. replaced your current dir (rpm upgrade for example))
  94. =item B<src>
  95. Reloads your I<~/.bashrc>
  96. =item B<nt>
  97. Report status of TCP sockets. It's reporting summary of C<ss -nat> command. If
  98. your host has a lot of sockets, load C<tcp_diag> module for kernel side
  99. acceleration.
  100. =item B<pcharmap>
  101. Display all 256 chars in ASCII table with their hex and decimal values.
  102. =item B<unurilfy>
  103. Returns host part only from url. Useful to copy url for host based tools like, ping(1), traceroute(1).
  104. =item B<upa>
  105. upa is alias for C<(poldek --up || poldek --upa)>. the alias was created because the poldek indexes are *CONSTANTLY* broken.
  106. =item B<upaa>
  107. upa is alias for C<upa && poldek --upgrade->, which means update all poldek indexes and in case of success update all packages for distribution.
  108. =item B<showline> I<FILE:LINE [FILE:LINE]>
  109. show context of FILE:LINE of 5 lines. colorized if ran on terminal.
  110. =item B<ssh-user>
  111. login to ssh server using using sudo information to figure out real user. it is useful to cvs+ssh using root.
  112. To use ssh+cvs using sush (sudo wrapper):
  113. export CVS_RSH=ssh-user
  114. =item B<sshcvs>
  115. ssh to cvs server via ssh and chdir to cvs root. first looks into C<$CVSROOT> and it that is unset looks at C<CVS/Root> file.
  116. =back
  117. =head1 SCREEN
  118. screenrc is overriden from the system via C<SYSSCREENRC> variable. but not all
  119. settings are activated because people tend to have custom taste of settings.
  120. so, if you want cool statusbar in screen, you should enable in B<~/.screenrc>:
  121. caption always
  122. You could also check the other statusbars from B</usr/share/okas/screenrc>.
  123. Copy one to your B<~/.screenrc> and restart screen.
  124. B<NOTE:> You could change these runtime, using B<E<lt>ESCE<gt>+:>, but the screen buffer
  125. is too small to paste there, so you have to restart screen to see effects.
  126. also, you probably didn't know, but you can switch windows in screen by typing window name:
  127. try: B<E<lt>ESCE<gt>+'>. similiar one is B<E<lt>ESCE<gt>+">.
  128. inside screen, you can create ssh connection to another host, type
  129. B<E<lt>ESCE<gt>+s> and enter hostname you want to ssh. this is different from
  130. just typing 'ssh' from command prompt, because it changes window title, and it
  131. will not fork bash to do ssh. so after you end the ssh, or it gets terminate,
  132. you could type 'r' to restore the ssh connection!
  133. B<PS:> B<E<lt>ESCE<gt>> denotes screen escape, which by default is B<E<lt>CTRLE<gt>+a>.
  134. =head1 AUTHOR
  135. Elan RuusamE<auml>e <glen@delfi.ee>
  136. =cut
  137. # vim:ft=pod