<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>AskApache &#187; Search Results  &#187;  ccze</title>
	<atom:link href="http://www.askapache.com/search/ccze/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.askapache.com</link>
	<description>Advanced Web Development</description>
	<lastBuildDate>Thu, 26 Apr 2012 11:29:28 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Advanced Linux Debugging using a Bootloader (GRUB)</title>
		<link>http://www.askapache.com/linux/advanced-linux-grub.html</link>
		<comments>http://www.askapache.com/linux/advanced-linux-grub.html#comments</comments>
		<pubDate>Thu, 07 Apr 2011 16:35:41 +0000</pubDate>
		<dc:creator>AskApache</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.askapache.com/?p=4846</guid>
		<description><![CDATA[<p>As an example, here is the boot line that I am using at the moment on an older Dell Desktop, just to illustrate module parameters and environment vars.  </p>
<pre>title  Arch Linux X-256
kernel /vmlinuz26 root=/dev/disk/by-label/ROOT ro rootwait pause_on_oops=5 panic=60 i915.modeset=1 no_console_suspend ipv6.disable=1 TERM=xterm-256color quiet 5
initrd /kernel26.img</pre>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.askapache.com/linux/advanced-linux-grub.html"></a><a href="http://www.askapache.com/linux/advanced-linux-grub.html"><cite>AskApache.com</cite></a></p><p>This is part of the <a href="https://wiki.archlinux.org/index.php/GRUB">GRUB article on the Arch Linux wiki that I contributed</a>.   As of now, just a copy.</p>

<p>The grub <code>menu.lst</code> provides for a convenient way to add a number of entries with <a href="http://www.kernel.org/doc/Documentation/kernel-parameters.txt" class="external text" rel="nofollow">extended kernel parameters</a> to configure all sorts of advanced settings to enable you to quickly and conveniently boot into your existing system with varying levels of debugging output.  It's very easy and useful to create several levels of debugging just by adding additional entries to your grub configuration. And if you ever have issues or problems down the road due to a power-failure or hardware failure, it can save you hours of trouble, and of course nothing can beat debugging output when it comes to learning about your system.</p>

<h2><span class="mw-headline" id="Useful_Menu.lst_Entries">Useful Menu.lst Entries</span></h2>
<p>If you are interested in debugging, then you deserve some grub entries for powerusers, here are a few that I like (just add to your <code>menu.lst</code>).</p>

<pre>title Shutdown the Computer
halt
&nbsp;
title Reboot the Computer
reboot
&nbsp;
title Command Line
commandline
&nbsp;
title Install GRUB to hd0 MBR
root (hd0,0)
setup (hd0)
&nbsp;
title Matrix
color green/black light-green/green
&nbsp;
title Scan for /boot/grub/menu.lst
find --set-root --ignore-floppies /boot/grub/menu.lst
configfile /boot/grub/menu.lst
&nbsp;
title Scan for /boot/menu.lst
find --set-root --ignore-floppies /menu.lst
configfile /boot/menu.lst
&nbsp;
# http://www.vortex.prodigynet.co.uk/x86test/
title    Run x86test (CPU Info)
kernel /boot/x86test_zImage.bin
#wget http://www.vortex.prodigynet.co.uk/x86test/x86test_zImage.bin
&nbsp;
# http://www.memtest.org/
title    Run memtest86+ (Memory Testing)
kernel /boot/memtest86+-1.70.bin</pre>

<h2> <span class="mw-headline" id="Light_Debug">Light Debug</span></h2>
<p>A quick way to see more verbose messages on your console is to bootup your normal grub entry after appending <strong>verbose</strong> to the kernel line.  This simple word added to your kernel line turns on more logging thanks to the <code>/etc/rc.sysinit</code> file, which at the top of the file runs:</p>
<pre>if /bin/grep -q " verbose" /proc/cmdline; then /bin/dmesg -n 8; fi</pre>
<p>Very simple way to get a bit more messages and debug output in your logs.</p>
<pre>title  Arch Linux DEBUG Light
kernel /vmlinuz26 root=/dev/disk/by-label/ROOT ro rootwait verbose
initrd /kernel26.img</pre>

<h2> <span class="mw-headline" id="Medium_Debug">Medium Debug</span></h2>
<p>This example <code>menu.lst</code> entry turns on real logging that is set by the kernel and not in an init script.  Adding the <strong>debug</strong> kernel parameter to your kernel line is recognized by a lot of linux internals and enables quite a bit of debugging compared to the default. </p>

<pre>title Arch Linux DEBUG Medium
kernel /vmlinuz26 root=/dev/disk/by-label/ROOT ro rootdelay=5 panic=10 debug
initrd /kernel26.img</pre>

<h2> <span class="mw-headline" id="Heavy_Debug">Heavy Debug</span></h2>
<p>An even more impressive kernel parameter is the <strong>ignore_loglevel</strong>, which causes the system to ignore any loglevel and keeps the internal loglevel at the maximum debugging level, basically rendering dmesg unable to lower the debug level.</p>
<pre>title Arch Linux DEBUG Heavy
kernel /vmlinuz26 root=/dev/disk/by-label/ROOT ro rootdelay=5 panic=10 debug ignore_loglevel
initrd /kernel26.img</pre>

<h2> <span class="mw-headline" id="Extreme_Debug">Extreme Debug</span></h2>
<p>If the "Heavy Debug" seemed like a lot of output, thats about 1/2 of the logging that occurs with this example.  This does a couple things, it uses the <strong>earlyprintk</strong> parameter to setup your kernel for "early" "printing" of messages to your "vga" screen.  The <strong>,keep</strong> just lets it stay on the screen longer.  This will let you see logs that normally are hidden due to the boot-up process.
This also changes the log buffer length to 10MB, and also instructs that any fatal signals be printed with <strong>print_fatal_signals</strong>.  The last one, <strong>sched_debug</strong>, you can look up in the very excellent kernel documentation on <a href="http://www.kernel.org/doc/Documentation/kernel-parameters.txt" class="external text" rel="nofollow">kernel parameters</a>.</p>

<pre>title Arch Linux DEBUG Extreme
kernel /vmlinuz26 root=/dev/disk/by-label/ROOT ro debug ignore_loglevel log_buf_len=10M print_fatal_signals=1 LOGLEVEL=8 earlyprintk=vga,keep sched_debug
initrd /kernel26.img</pre>

<h2> <span class="mw-headline" id="Insane_Debug">Insane Debug</span></h2>
<p>The first few debugging examples showed some really nice kernel parameters to turn on really verbose debugging.  This kind of debugging is absolutely critical if you want to max out your system or just learn more about what is going on behind the scenes.  But there is a final trick that is my favorite, it's the ability to set both environment variables, and more importantly, module parameters at boot.</p>

<p>As an example, here is the boot line that I am using at the moment on an older Dell Desktop, just to illustrate module parameters and environment vars.  </p>
<pre>title  Arch Linux X-256
kernel /vmlinuz26 root=/dev/disk/by-label/ROOT ro rootwait pause_on_oops=5 panic=60 i915.modeset=1 no_console_suspend ipv6.disable=1 TERM=xterm-256color quiet 5
initrd /kernel26.img</pre>
<p>Since it's low on both memory and CPU, I disable ipv6. I also turn on kernel modesetting for the i915 video card, set my terminal to be xterm-256color, and boot straight into <a href="https://wiki.archlinux.org/index.php/Xorg" title="Xorg">X</a>.  This lets me use a very optimized arch-linux configuration, amazing how fast thanks to using <a href="https://wiki.archlinux.org/index.php/SLiM" title="SLiM">slim</a> as the login manager, <a href="https://wiki.archlinux.org/index.php/Ratpoison" title="Ratpoison">ratpoison</a> as my <a href="https://wiki.archlinux.org/index.php/Display_Manager" title="Display Manager">window manager</a>, and terminal with <a href="https://wiki.archlinux.org/index.php/Tmux" title="Tmux">tmux</a> as my login shell, all from boot, as the pstree shows (plus <a href="https://wiki.archlinux.org/index.php/Synergy" title="Synergy">Synergy</a>!).</p>
<pre>init,1
  |-slim,3096
  |   |-X,3098 -nolisten tcp vt07 -auth /var/run/slim.auth
  |   `-ratpoison,3107,askapache
  |       |-terminal,5341 -x sh -c exec /usr/bin/tmux -2 -l -u -q attach -d -t tmux-askapache
  |       |   |-bash,11165
  |       |   |-tmux,5345 -2 -l -u -q attach -d -t tmux-askapache
  |       |   `-{terminal},5346
  |       `-xscreensaver,3113 -no-splash
  |-synergyc,6121,galileo -f --name galileo-fire --restart 10.66.66.2:26666
  |
  `-tmux,5348,askapache -2 -l -u -q attach -d -t tmux-askapache
      |-bash,5351
      |   `-ssh,9969 lug@askapache.com
      `-bash,5868
         `-vim,11149 -p sda1/grub/menu.lst /boot/grub/menu.lst</pre>
<p>That kind of optimized system is only possible if you first can figure out your system, by debugging both the kernel as previously illustrated, debugging the init process, and most importantly, by debugging the modules enabled for your system's hardware/firmware/software.  Debugging modules is challenging but worth the effort, and then you are able to do some truly insane debugging from grub like the following example, note that the actual grub entry is all on one line, but I split it into 4 lines so you could see it all.  This basically turns on every module on this little Dell desktop to be at the absolute max debug level.  There is so much logging when I boot this that the system grinds to a halt and is slower than a TI-89 calculator (See <a href="https://wiki.archlinux.org/index.php/Improve_Boot_Performance" title="Improve Boot Performance">Improve Boot Performance</a>).</p>
<pre>title  Arch Linux DEBUG INSANE
kernel /vmlinuz26 root=/dev/disk/by-label/ROOT ro rootwait ignore_loglevel debug debug_locks_verbose=1 sched_debug initcall_debug mminit_loglevel=4 udev.log_priority=8
       loglevel=8 earlyprintk=vga,keep log_buf_len=10M print_fatal_signals=1 apm.debug=Y i8042.debug=Y drm.debug=1 scsi_logging_level=1 usbserial.debug=Y
       option.debug=Y pl2303.debug=Y firewire_ohci.debug=1 hid.debug=1 pci_hotplug.debug=Y pci_hotplug.debug_acpi=Y shpchp.shpchp_debug=Y apic=debug
       show_lapic=all hpet=verbose lmb=debug pause_on_oops=5 panic=10 sysrq_always_enabled
initrd /kernel26.img</pre>
<p>A couple key items from that grub entry are <strong>sysrq_always_enabled</strong> which forces on the sysrq magic, which really is a lifesaver when debugging at this level as your machine will freeze/stop-responding sometimes and it's nice to use sysrq to kill all tasks, change the loglevel, unmount all filesystems, or do a hard reboot.  Another key parameter is the <strong>initcall_debug</strong>, which debugs the init process in excruciating detail.  Very useful at times.  The last parametery I find very useful is the <strong>udev.log_priority=8</strong> to turn on <a href="https://wiki.archlinux.org/index.php/Udev" title="Udev">udev</a> logging.  </p>


<h2><span class="mw-headline" id="Break_Into_Init">Break Into Init</span></h2>
<p>For instance, If you add <strong>break=y</strong> to your kernel cmdline, init will pause early in the <a href="https://wiki.archlinux.org/index.php/Arch_Boot_Process" title="Arch Boot Process">boot process</a> (after loading modules) and launch an interactive sh shell which can be used for troubleshooting purposes. (Normal boot continues after logout.)  This is very similar to the shell that shows up if your computer gets turned off before it is able to shutdown properly.  But using this parameter lets you enter into this mode differently at will.</p>
<pre>title  Arch Linux Init Break
kernel /vmlinuz26 root=/dev/disk/by-label/ROOT ro rootwait break=y
initrd /kernel26.img</pre>

<h2><span class="mw-headline" id="Debugging_init">Debugging init</span></h2>

<p>This awesome parameter <strong>udev.log_priority=8</strong> does the same thing as editing the file <code>/etc/udev/udev.conf</code> except it executes earlier, turning on debugging output for <a href="https://wiki.archlinux.org/index.php/Udev" title="Udev">udev</a>.  If you want to know your hardware, that is the key parameter right there.  Another trick is if you change the <code>/etc/udev/udev.conf</code> to be verbose, then you can make your initrd image include that file to turn on verbose udeb debugging by adding it to your {{Filename|/etc/mkinitcpio.conf} like:</p>
<pre>FILES="/etc/modprobe.d/modprobe.conf /etc/udev/udev.conf"</pre>
<p>, which on arch is as easy as </p>
<pre># mkinitcpio -p kernel26</pre>
<p>Debugging <a href="https://wiki.archlinux.org/index.php/Udev" title="Udev">udev</a> is key because the <a href="https://wiki.archlinux.org/index.php/Initrd" title="Initrd">initrd</a> performs a <a href="https://wiki.archlinux.org/index.php/Change_Root" title="Change Root">root change</a> at the end of its run to usually launch a program like /sbin/init as part of a chroot, and unless the new file system has a valid /dev directory, udev must be initialized before invoking chroot in order to provide <code>/dev/console</code>.  </p>
<pre>exec chroot . /sbin/init &lt;dev/console &gt;dev/console 2&gt;&amp;1</pre>
<p>So basically, you aren't able to view the logs that are generated before /dev/console is initialized by udev or by a special initrd you compiled yourself.  One method the kernel developers use to be able to still get the log messages generated before /dev/console is available is to provide an alternative console that you can enable or disable from grub.</p>



<h2><span class="mw-headline" id="Net_Console">Net Console</span></h2>
<p>If you read through the kernel documentation regarding debugging, you will hear about Netconsole, which can be loaded from the kernel line in GRUB, compiled into your kernel, or loaded at runtime as a module.  Having a netconsole entry in your <code>menu.lst</code> is most excellent for debugging slower computers like old laptops or thin-clients.  It's easy to use.  Just setup a 2nd computer (running arch) to accept syslog requests on a remote port, very fast and quick to do on arch-linux, 1 line to syslog.conf.  Then you could use a log-color-parser like ccze to view all syslog logs, or just tail your everything.log. Then on your laptop, boot up and select the netconsole entry from the grub menu, and you will start seeing as much logging as you want on your syslog system.  This logging lets you view even earlier log output than is available with the earlyprintk=vga kernel parameter, as netconsole is used by kernel hackers and developers, so it's very powerful.</p>
<pre>title  Arch Linux DEBUG Netconsole
kernel /vmlinuz26 root=/dev/disk/by-label/ROOT ro netconsole=514@10.0.0.2/12:34:56:78:9a:bc debug ignore_loglevel
initrd /kernel26.img</pre>

<h2><span class="mw-headline" id="Hijacking_cmdline">Hijacking cmdline</span></h2>
<p>If you do not have access to GRUB or the kernel boottime cmdline, like on a server or virtual machine, as long as you have root permissions you can still enable this kind of simplistic verbose logging using a neat hack.  While you cannot modify the <code>/proc/cmdline</code> even as root, you can place your own cmdline file on top of /proc/cmdline, so that accessing /proc/cmdline actually accesses your file.</p>
<p>For example if I <strong>cat /proc/cmdline</strong>, I have the following:</p>
<pre>root=/dev/disk/by-label/ROOT ro console=tty1 logo.nologo quiet</pre>
<p>So I use a simple sed command to replace <strong>quiet</strong> with <strong>verbose</strong> like:</p>
<pre>sed &#039;s/ quiet/ verbose/&#039; /proc/cmdline &gt; /root/cmdline</pre>
<p>Then I bind mount /root/cmdline so that it becomes /proc/cmdline, using the <strong>-n</strong> option to mount so that this mount won't be recorded in the systems mtab.</p>
<pre>mount -n --bind -o ro /root/cmdline /proc/cmdline</pre>
<p>Now if I <strong>cat /proc/cmdline</strong>, I have the following:</p>
<pre>root=/dev/disk/by-label/ROOT ro console=tty1 logo.nologo verbose</pre><p><a href="http://www.askapache.com/linux/advanced-linux-grub.html"></a><a href="http://www.askapache.com/linux/advanced-linux-grub.html">Advanced Linux Debugging using a Bootloader (GRUB)</a> originally appeared on <cite>AskApache.com</cite> </p>]]></content:encoded>
			<wfw:commentRss>http://www.askapache.com/linux/advanced-linux-grub.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Magic in the Terminal: Screen, Bash, and SSH</title>
		<link>http://www.askapache.com/hacking/magic-terminal-screen-bash-ssh.html</link>
		<comments>http://www.askapache.com/hacking/magic-terminal-screen-bash-ssh.html#comments</comments>
		<pubDate>Tue, 07 Sep 2010 04:14:47 +0000</pubDate>
		<dc:creator>AskApache</dc:creator>
				<category><![CDATA[Hacking]]></category>

		<guid isPermaLink="false">http://www.askapache.com/?p=3923</guid>
		<description><![CDATA[<p><strong>Oh ya lets get it on!</strong>  <em>short but sweet</em></p>
<p><a href="http://uploads.askapache.com/2010/02/htopp.png" class="lightbox" rel="lightbox"><img src="http://uploads.askapache.com/2010/02/htopp.png" alt="running htop in bash over ssh to different server" title="running htop in bash over ssh to different server" width="561" height="370" /></a></p>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.askapache.com/hacking/magic-terminal-screen-bash-ssh.html"></a><a href="http://www.askapache.com/hacking/magic-terminal-screen-bash-ssh.html"><cite>AskApache.com</cite></a></p><p><strong>Back in the mid-90's</strong> I was doing a lot of <a href="#war_dialing">war-dialing</a> with modems (<em>a more recent phenomenon is wardriving, the searching for wireless networks (Wi-Fi) from a moving vehicle. Wardriving was named after wardialing, since both techniques involve brute-force searches to find computer networks</em>) and discovering all sorts of networks and machines, many of them were Unix and Solaris based public systems, and when I managed to gain access to the system and found myself staring at a unix shell I was very excited but also a total idiot.  In those days of using the phone networks to research unknown systems it was very difficult for anyone to actually get the phone company to trace a call, so instead of what happens today where it is child's play to trace an IP address, back then it was a very real back-and-forth battle between the system admin and whoever was gaining access to their system.</p>
<div><div id="screenmagic"></div></div>
<p>Essentially, I would gain a shell or some kind of terminal, and just go at it trying to figure out what it could do, trying all kinds of commands.  Inevitably this would eventually alert even the laziest admin and they would proceed to attempt to lock me out. It was great sport and extremely addictive.  When my favorite system (a massive sun machine in the basement of a big library) finally locked me out and I couldn't get back in I went to my local library and got some reading material -- one of my favorites was the red hat bible.  I was able to acquire my own computer and the first thing I did was install red hat linux onto it from the discs included with the book.  For the next several years I was essentially offline, all we had at home was a modem and it was becoming difficult to locate any more systems in my area code.. I was into phreaking of course as well, but I never was able to make free long-distance war-dialing a reality.</p>

<p>So I just read the books and learned what I could.  I would also goto the library when I could in order to use their machines which were connected to the internet (before aol it was much different than today's internet) and since my time was short I would download as many documents as I could so that I could read them offline.  The TLDP documentation that we know today was around back then in various forms, and I read every HOWTO in the index, though not understanding half.  The other big resource I found for really intense reading was the <a href="http://www.kernel.org/doc/Documentation/">kernel documentation</a>, which admitedly I still don't comprehend 1/4th of..   I try and peruse all the new documents when a new kernel is released, since the kernel is where all the real action is, hence the military authoritative name, and that is how I discovered one of the coolest features of Linux that I have found.  TMPFS!</p>


<h3>What I learned</h3>
<p>I learned that with our present technology, which I try to keep somewhat updated on, using a mouse to point and click your way to a solution is always much much much slower than just getting dirty and writing straight code to a terminal.  BTW, you know they are close (within 100 years) of enabling connection at the speed of thought.  Yes it's a mind-meld between you and a super-computer AI to process it.  That's the whole story behind popular Japanese anime like "Ghost in the Shell".</p>
<p>That's also a fundamental reason that certain vast segments of the computing world have a dislike of Microsoft, the way they build (to sell) their operating systems..  no open-code, which is their obvious #1 problem, and why they have a million viruses.  Perhaps even a bigger issue some have with "the empire", is how they stuck this gooey, thats how you pronounce GUI - graphical user interface, in a way that tries to create multiple classes of people, those behind the scenes with all the control (they are a middleman between you and your real computer, for millions), and a second group of people on the outside, sheep - I believe they are referred to as sheep.</p>





<a href='http://uploads.askapache.com/2010/02/screenrc-example.txt' >screenrc-example</a>
<p><a href="http://uploads.askapache.com/2010/02/vim-in-screen.png"><img src="http://uploads.askapache.com/2010/02/vim-in-screen.png" alt="256color Enabled Vim Syntax Highlighting" title="256color Enabled Vim Syntax Highlighting" width="561" height="256" class="alignnone size-full wp-image-3986" /></a></p>



<h3>Cleanup Screenrc Files</h3>
<p>You can run this command to get a wildly confusing screenrc file under control.  You could have a heavily commented version, and then run this to create the actual... I like to start there but because the screenrc file is read in order, you should take out the 'sort'.</p>
<pre>sed -e &#039;/^#/d; s/^[\t\ ]*//g; /^[a-z]/I!d&#039; /etc/screenrc|sort|tr -s &#039; \t&#039; | tr -d &#039;\015\032&#039;</pre>


<h3>Read lots of .screenrc files</h3>
<p>This is easy with Google's futuristic Code Searching Engine!  I get excited about this search engine because it is sooo dope!  Here's a <a href="http://www.google.com/codesearch?q=file%3Ascreenrc&hl=en&btnG=Search+Code">search for files named .screenrc</a>, thanks for this <strong>free</strong> tool Google, much love!</p>
Here it is with lots of messy comments still in place.

<pre>autodetach on
bufferfile $HOME/.screen/buffer
&nbsp;
nethack on # print wackier status messages
chdir $HOME
password HJa4Dp4UIDlLA
&nbsp;
setenv LC_CTYPE en_US.UTF-8
sorendition =s Gk
startup_message off
shell bash # use the default shell
shelltitle "$ |bash"
term screen-256color #By default, screen uses an 8-color terminal emulator. Use the following line to enable more colors, more-capable terminal emulator:
&nbsp;
defmode 620
defmonitor off # turn monitoring on
defnonblock 5 # flaky/slow ssh lines
defscrollback 300
defutf8 on
hardcopydir ~/.hardcopy/screen_%y-%m-%d_%0c.%n
&nbsp;
defbce on # erase background with current bg color
defencoding UTF-8
defflow auto # will force screen to process ^S/^Q
defflow on # disable Ctrl-S/Ctrl-Q "flow control"
defhstatus "screen: ^En (^Et)"
deflogin off
&nbsp;
deflog off
logfile ~/.screen/screen_%y-%m-%d_%0c.%n
&nbsp;
silencewait 15
vbell_msg " Wuff ---- Wuff!! "
&nbsp;
activity "%C -&gt; %n%f %t activity!"
bell "%C -&gt; %n%f %t bell!~"
&nbsp;
altscreen on # restore window contents after using (e.g.) vi
attrcolor b ".I" # allow bold colors - necessary for some reason
&nbsp;
hardstatus on
hardstatus alwayslastline "[%02c] %`%-w%{=b bw}%n %t%{-}%+w %=%{..Lw} %H %{..g} %m/%d %C%a "
caption always "%{kG}%?%-Lw%?%{bw}%n*%f %t%?(%u)%?%{kG}%?%+Lw%?"
&nbsp;
idle 3600 eval "screen nice -n 19 /opt/s/cmatrix" "idle 6400 detach"
&nbsp;
msgwait 5 # 1 second messages
multiuser off
nonblock on # If a window goes unresponsive, don&#039;t block the whole session waiting for it.
pow_detach_msg "Screen session of $LOGNAME $:cr:$:nl:ended." # emulate .logout message
&nbsp;
screen -h 500 -t &#039;bash&#039; sh $HOME/welcome.sh
screen -h 0 -t &#039;MATRIX&#039; nice -n 19 /opt/s/cmatrix
screen -h 0 -t &#039;WHO&#039; sudo /opt/s/whowatch
screen -h 100 -t &#039;gator&#039; sh $HOME/.ssh/start_control.sh
screen -h 100 -t &#039;gator&#039; ssh gator sh ~/welcome.sh
screen -h 500 -t &#039;root&#039; sudo bash -l
screen -h 0 -t &#039;MEM&#039; nice -n 19 sh -c &#039;sleep 4 &amp;&amp; tput civis; CLS=$`tput clear`; trap "tput cnorm; exit 0" 1 2 3; while :; do free -olt &amp;&amp; sleep 2 &amp;&amp; echo $CLS; done;&#039;
screen -h 0 -t &#039;TOP&#039; nice -n 19 sh -c &#039;sleep 4 &amp;&amp; tput civis; CLS=$`tput clear`; trap "tput cnorm; exit 0" 1 2 3; while :; do top -b -n 1 -H -d 10 -c |sed "/$USER/!d" &amp;&amp; echo $CLS; done;&#039;
screen -h 0 -t &#039;NET&#039; nice -n 19 sh -c &#039;while :; do /bin/netstat --numeric-ports -a -e --tcp |sort --key=4 &amp;&amp; sleep 5; done;&#039;
select 0
&nbsp;
#select -h 100 -t &#039;log&#039; 4 sudo sh -c &#039;nice tail -n 60 -s 10 -f /var/log/everything.log | ccze -A&#039;
&nbsp;
zombie "^[" # don&#039;t kill window after the process died</pre>


<p><a id="war_dialing" name="war_dialing"></a></p>
<h2>More on War Dialing</h2>

<blockquote cite="">
<p><p>War dialing or wardialing is a technique of using a modem to automatically scan a list of telephone  numbers, usually dialing every number in a local area code to search for computers, Bulletin board systems and fax machines. Hackers use the resulting lists for various purposes, hobbyists for exploration, and crackers - hackers that specialize in computer security - for password guessing.</p>
<p>A single wardialing call would involve calling an unknown number, and waiting for one or two rings, since answering computers usually pick up on the first ring. If the phone rings twice, the modem hangs up and tries the next number. If a modem or fax machine answers, the wardialer program makes a note of the number. If a human or answering machine answers, the wardialer program hangs up. Depending on the time of day, wardialing 10,000 numbers in a given area code might annoy dozens or hundreds of people, some who attempt and fail to answer a phone in two rings, and some who succeed, only to hear the wardialing modem's carrier tone and hang up. The repeated incoming calls are especially annoying to businesses that have many consecutively numbered lines in the exchange, such as used with a Centrex telephone system.</p>
<p>The popularity of wardialing in 1980s and 1990s prompted some states to enact legislation prohibiting the use of a device to dial telephone numbers without the intent of communicating with a person.</p>
<p>The name for this technique originated in the 1983 film WarGames. In the film, the protagonist programmed his computer to dial every telephone number in Sunnyvale, California to find other computer systems. 'WarGames Dialer' programs became common on bulletin board systems of the time, with file names often truncated to wardial.exe and the like due to length restrictions on such systems. Eventually, the etymology of the name fell behind as "war dialing" gained its own currency within computing culture.[1]</p>
<p>A more recent phenomenon is wardriving, the searching for wireless networks (Wi-Fi) from a moving vehicle. Wardriving was named after wardialing, since both techniques involve brute-force searches to find computer networks. The aim of wardriving is to collect information about wireless access points (not to be confused with piggybacking).</p>
<p>Similar to war dialing is a port scan under TCP/IP, which "dials" every TCP port of every IP address to find out what services are available. Unlike wardialing, however, a port scan will generally not disturb a human being when it tries an IP address, regardless of whether there is a computer responding on that address or not. Related to wardriving is warchalking, the practice of drawing chalk symbols in public places to advertise the availability of wireless networks. Despite its widespread coverage [in the news?], warchalking never particularly caught on as a popular activity.</p>
<p>The term is also used today by analogy for various sorts of exhaustive brute force attack against an authentication mechanism, such as a password. While a dictionary attack might involve trying each word in a dictionary as the password, "wardialing the password" would involve trying every possible password. Password protection systems are usually designed to make this impractical, by making the process slow and/or locking out an account for minutes or hours after some low number of wrong password entries.</p>
<p>War dialing is sometimes used as a synonym for demon dialing, a related technique which also involves automating a computer modem in order to repeatedly place telephone calls.</p></p>
</blockquote>

<p class="wikicop">This page contains content by <a title="* New Window" rel="nofollow" href="http://en.wikipedia.org/w/index.php?title=War_dialing&amp;action=history">Author</a> of <a title="* New Window" href="http://en.wikipedia.org/wiki/War_dialing" rel="nofollow">Article</a> from <a title="* New Window" href="http://en.wikipedia.org/wiki/Main_Page" rel="nofollow">Wikipedia</a> and is licensed under the <a href="http://www.askapache.com/gnu-fdl.txt" rel="nofollow" title="GNU BABY!">GNU FDL</a>.</p>
<a href="http://uploads.askapache.com/2010/02/htopp.png"><img src="http://uploads.askapache.com/2010/02/htopp-350x230.png" alt="running htop in bash over ssh to different server" title="running htop in bash over ssh to different server" width="350" height="230" class="alignnone size-medium wp-image-3984" /></a><p><a href="http://www.askapache.com/hacking/magic-terminal-screen-bash-ssh.html"></a><a href="http://www.askapache.com/hacking/magic-terminal-screen-bash-ssh.html">Magic in the Terminal: Screen, Bash, and SSH</a> originally appeared on <cite>AskApache.com</cite> </p>]]></content:encoded>
			<wfw:commentRss>http://www.askapache.com/hacking/magic-terminal-screen-bash-ssh.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Custom bash_profile for Advanced Shell Users</title>
		<link>http://www.askapache.com/linux/bash_profile-functions-advanced-shell.html</link>
		<comments>http://www.askapache.com/linux/bash_profile-functions-advanced-shell.html#comments</comments>
		<pubDate>Mon, 23 Nov 2009 20:32:26 +0000</pubDate>
		<dc:creator>AskApache</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.askapache.com/?p=3183</guid>
		<description><![CDATA[<p>Looking for some <strong>advanced uses for the shell</strong>?  Here is <del>some of</del> my best.  The shell is where 70% of my work takes place, and I have at least one terminal open almost 100% of the time, for viewing tailing color-coded logs, and of course for the SSH Tunnels that I use to route various networking through, like my email.  So I decided that to standardize and create a bash_profile containing the most time-saving and helpful functions that I could use on all the various hosting environments would really be some sweet sugar, so here is my constant Work-in-progress.</p>
<p>It works for all shells I encounter, including BackTrack, Debian, Knoppix, Arch Linux, etc.   Also works for many hosting environments I use including DreamHost, HostGator, WiredTree, and pretty much any linux VPS.</p>
<p>I also rely on this heavily from within shell scripts I write to access all the functions and stuff in this .bash_profile, and to do that I just do like:</p>
<pre>
#!/bin/bash
&#160;
source ~/.bash_profile &#38;amp;&#62;/dev/nulll
&#160;
pm "PM is a function to output nice messages with color"
yn "Are you enjoying the shell" &#38;amp;&#38;amp; pm "Thats great!" &#124;&#124; pm "Perhaps you&#039;re better suited for DOS"
yn "Show Calendar" &#38;amp;&#38;amp; aa_calendar
yn "Show Fortune" &#38;amp;&#38;amp; aa_fortune
</pre>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.askapache.com/linux/bash_profile-functions-advanced-shell.html"></a><a href="http://www.askapache.com/linux/bash_profile-functions-advanced-shell.html"><cite>AskApache.com</cite></a></p><p>Looking for some <strong>advanced uses for the shell</strong>?  Here is <del>some of</del> my best.  Works for all shells I encounter, including BackTrack, Debian, Knoppix, Arch Linux, etc.   Also works for many hosting environments I use including DreamHost, HostGator, WiredTree, and pretty much any linux VPS.</p>

<p class="anote">Want to get started?  Type the following in your shell to download the script and run it.  You should go over the code first and then you can just save it as your .bash_profile - whenever you want to get updated to the latest version just type aaup, a cool update function that auto dos2unix's and runs via an exec command.</p>
<pre>
curl -O http://static.askapache.com/askapache-bash-profile.txt &amp;&amp; source askapache-bash-profile.txt
Or if you trust me and my hosting provider (and you aren&#039;t on production)
curl -o ~/.bash_profile http://static.askapache.com/askapache-bash-profile.txt &amp;&amp; exec bash -l
</pre>

<p>For those of you power users and server admins that use Bash, ksh, csh, vanilla sh, etc.., or if you are just passionate about shell scripting, because it allows you to get advanced tasks done fast and efficiently, not to mention automated automatically.  I give you my .bash_profile file.   You should edit it to fit your needs, (especially the exported vars like PATH, LDFLAGS, if you don't understand something just comment it out) but it's pretty universal because I work on alot of other people's servers not to mention many different distros and platforms, and when I get hired to do some server work through a shell, I bring this script along for the ride.</p>


<h2>askapache-bash-profile.txt</h2>
<p>You can download the latest version: <a href="http://static.askapache.com/askapache-bash-profile.txt">http://static.askapache.com/askapache-bash-profile.txt</a></p>
<p>The functions and variables below are the way bash sees them, using declare -f, and alias, to make it easier for you to read and understand them.    The actual file at <a href="http://static.askapache.com/askapache-bash-profile.txt">http://static.askapache.com/askapache-bash-profile.txt</a> will always be the most updated version, as I use it personally.  And it has the whole file the way I wrote it, meaning many extra notes and much simpler to follow. Enjoy!</p>


<h2>Gist of the Script..</h2>
<p>I also rely on this heavily from within shell scripts I write to access all the functions and stuff in this .bash_profile, and to do that I just do like:</p>
<pre class='prettyprint'>
#!/bin/bash
&nbsp;
source ~/.bash_profile &amp;&gt;/dev/nulll
&nbsp;
pm "PM is a function to output nice messages with color"
yn "Are you enjoying the shell" &amp;&amp; pm "Thats great!" || pm "Perhaps you&#039;re better suited for DOS"
yn "Show Calendar" &amp;&amp; aa_calendar
yn "Show Fortune" &amp;&amp; aa_fortune
</pre>

<pre>
alias chmod=&#039;command chmod -c&#039;
alias cpr=&#039;command cp -rpv&#039;
alias df=&#039;command df -kTh&#039;
alias df1=&#039;command df -iTa&#039;
alias diff=&#039;diff -up&#039;
alias dsiz=&#039;du -sk * | sort -n --&#039;
alias du=&#039;command du -kh&#039;
alias du1=&#039;echo *|tr " " "\n" |xargs -iFF command du -hs FF|sort&#039;
alias env=&#039;command env | sort&#039;
alias h=&#039;history&#039;
alias inice=&#039;ionice -c3 -n7 nice&#039;
alias j=&#039;jobs -l&#039;
alias la=&#039;command ls -Al --color=auto&#039;
alias lc=&#039;command ls -lAcr --color=auto&#039;
alias less=&#039;vless&#039;
alias lessc=&#039;ccze -A |`type -P less` -R&#039;
alias lk=&#039;command ls -lASr --color=auto&#039;
alias llh=&#039;ll -h&#039;
alias lll=&#039;stat -c %a\ %N\ %G\ %U ${PWD}/*|sort&#039;
alias lr=&#039;command ls -lAR --color=auto&#039;
alias lt=&#039;command ls -lAtr --color=auto&#039;
alias lu=&#039;command ls -lAur --color=auto&#039;
alias lx=&#039;command ls -lAXB --color=auto&#039;
alias mann=&#039;command man -H&#039;
alias n=&#039;/usr/bin/nano3&#039;
alias p=&#039;command ps -HAcl -F S -A f|uniq -w3&#039;
alias path=&#039;echo -e ${PATH//:/\\n}&#039;
alias php=&#039;php -d report_memleaks=1 -d report_zend_debug=1 -d log_errors=0 -d ignore_repeated_errors=0 -d ignore_repeated_source=0 -d error_reporting=30719 -d display_startup_errors=1 -d display_errors=1&#039;
alias pp=&#039;command ps -HAcl -F S -A f&#039;
alias ps1=&#039;command ps -lFA&#039;
alias ps2=&#039;command ps -H&#039;
alias resetw=&#039;echo $&#039;\&#039;&#039;\33[H\33[2J&#039;\&#039;&#039;&#039;
alias subash=&#039;sudo sh -c &#039;\&#039;&#039;export HOME=/root; cd /root; exec bash -l&#039;\&#039;&#039;&#039;
alias top=&#039;top -c&#039;
alias tree=&#039;command tree -Csuflapi&#039;
alias updatedb=&#039;( ( updatedb 2&gt;/dev/null ) &amp; )&#039;
alias vim=&#039;command vim --noplugin&#039;
alias who=&#039;command who -ar -pld&#039;
alias wtf=&#039;watch -n 1 w -hs&#039;
</pre>




<p><a href="http://uploads.askapache.com/2009/08/askapache-bash_profile.png"><img src="http://uploads.askapache.com/2009/08/askapache-bash_profile.png" alt="Custom bash profile for Advanced Shell Users" title="askapache-bash_profile" width="571" height="2879" /></a></p><p><a href="http://www.askapache.com/linux/bash_profile-functions-advanced-shell.html"></a><a href="http://www.askapache.com/linux/bash_profile-functions-advanced-shell.html">Custom bash_profile for Advanced Shell Users</a> originally appeared on <cite>AskApache.com</cite> </p>]]></content:encoded>
			<wfw:commentRss>http://www.askapache.com/linux/bash_profile-functions-advanced-shell.html/feed</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Elite Log File Scrolling with Color Syntax</title>
		<link>http://www.askapache.com/linux/elite-log-file-scrolling-color-syntax.html</link>
		<comments>http://www.askapache.com/linux/elite-log-file-scrolling-color-syntax.html#comments</comments>
		<pubDate>Sat, 09 Aug 2008 04:56:10 +0000</pubDate>
		<dc:creator>AskApache</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.askapache.com/?p=1067</guid>
		<description><![CDATA[<p><a class="IFR hs hs07" href="http://www.askapache.com/security/elite-log-file-scrolling-with-color-syntax.html" title="Colored Server Log Scrolling"></a>Scrolls the latest log entries for multiple log files to the current screen or to any other monitor or TTY <strong>in color using syntax highlighting</strong>, making debugging easier and saving a lot of time for multi-monitor workstations.<br class="C" /></p>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.askapache.com/linux/elite-log-file-scrolling-color-syntax.html"></a><a href="http://www.askapache.com/linux/elite-log-file-scrolling-color-syntax.html"><cite>AskApache.com</cite></a></p><p><a class="IFR" rel="lb" href="http://uploads.askapache.com/2008/08/colored-logs2.png"><img src="http://uploads.askapache.com/2008/08/colored-logs2.png" alt="Scroll Logs on Alternate Monitor for Server Debugging" title="colored-logs2" width="350" height="143" /></a>Ok peeps, one of the coolest hacks yet.  If you have multiple PC's/Monitors at your workstation like I do, it can be helpful to display various information on one screen while you work on another.<br class="C" /></p>

<p>This article shows how I <strong>continuously scroll the logs</strong> for a server/site I am working on, thus saving me a lot of time by providing <em>real-time debugging</em> on a separate screen.  Not only does this scroll the latest log entries as they are created, it <strong>displays them in color using syntax highlighting</strong> to make your logs incredibly easy to understand and parse.</p>


<h2>Example Output</h2>
<p>The thing to realize is that this output is continuously scrolling on your monitor, and using some cool linux shell tricks you can make it output at a certain speed and show a certain number of lines.  Another cool feature is you can display multiple files at the same time, and the filename will be output for each file above the log output.</p>
<p><a rel="lb" href="http://uploads.askapache.com/2008/08/colored-logs1.png"><img src="http://uploads.askapache.com/2008/08/colored-logs.png" alt="Colored Apache Server Logs Scrolling Display" title="Colored Server Log Scrolling" width="640" height="570" /></a></p>


<h2>What Logs</h2>
<p>I've explained in various articles on this site how to create and use various custom log files using .htaccess files and other tricks for non-root users. I use shared hosting all the time too you know...  Here are some log files you can generally use if you can use .htaccess files <em>(if you can control .htaccess you can control a binary php-cgi, which could be a shell script thats execs the php binary of your choice with your own environment variables, which is a workaround to getting a custom php.ini, which is how you specify a php error log)</em>.</p>
<ul>
<li>php error log</li>
<li>mod_security audit log</li>
<li>mod_security debug log</li>
<li>apache error log</li>
<li>apache access log</li>
</ul>
<p>Any log file can be used with this method, actually ANY file containing text can be used with this method, even fifo pipes as we will see in a bit ;)</p>



<h2>Installation</h2>
<h3>PCRE</h3>
<p>First you need <a href="http://www.pcre.org/">PCRE</a> - Perl Compatible Regular Expressions, which you can download <a href="ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/">here</a>.  Note that I had to install <a href="ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-6.7.tar.gz">pcre version 6.7</a> to get it to work with ccze.</p>

<h3>CCZE</h3>
<p>Now you need <a href="http://freshmeat.net/projects/ccze/">CCZE</a>, which colorizes and outputs (emulating tail) the log files.</p>
<blockquote><p>CCZE is a robust and modular log colorizer with plugins for apm, exim, fetchmail, httpd, postfix, procmail, squid, syslog, ulogd, vsftpd, xferlog, and more.</p></blockquote>


<h2>Post-Install Setup</h2>
<p>Ok so once you've installed ccze you can start using it right away, or you can continue reading to see how I've set it up for readable scrolling.  If the following setup isn't to your taste, you can always just use <a href="http://www.teaser.fr/~amajorel/wtail/wtail-0.2.2.tar.gz">wtail</a>, a colorless multi-file scroller that uses separate scrolling windows in your terminal similar to the screen program.</p>

<h3>Create Logs Folder</h3>
<p>First I created a folder called <code>/logs/</code> for my site, then for all subsequent commands chdir to it.</p>
<pre class='prebash'>$ mkdir /home/site.com/logs
$ cd /home/site.com/logs</pre>

<h3>Create Symlinks to Logs</h3>
<p>In the new logs folder I created soft symlinks to all the various log files, not neccessary but makes everything much easier and organized.</p>
<pre class='prebash'>$ ln -s /actual/logs/site.com/http/access.log access.log
$ ln -s /actual/logs/site.com/http/error.log error.log
$ ln -s /home/site.com/php_error.log php_error.log
$ ln -s /home/site.com/modsec_audit.log modsec_audit.log
$ ln -s /home/site.com/modsec_debug.log modsec_debug.log</pre>

<h3>Make a fifo Pipe</h3>
<p>FIFO stands for first-in-first-out and is a somewhat complex feature of linux/bsd/unix shells that let you send data into it and read the data that comes out of it, just like a pipe.</p>
<pre class='prebash'>$ mkfifo pipe</pre>



<h2>Scrolling the Logs</h2>
<p><strong>First</strong> cd to the log directory you created.</p>
<pre class='prebash'>$ cd /home/site.com/logs</pre>

<p>Now we will use the tail program to output 120 lines of each of these log files every half of a second, only displaying changes/new log entries.  We send that output into the fifo pipe we created using shell redirection and then instruct the command to run in the background using the ampersand to access built-in <em>(bash/sh)</em> job control.</p>
<pre class='prebash'>$ tail -s .5 -n 120 -f access.log php_error.log error.log modsec_audit.log &gt;pipe &amp;</pre>

<h3>Displaying the Colorized Scrolling Output</h3>
<p>So every .5 seconds the tail command outputs any new log entries from those files into the fifo pipe, so now we need to use the ccze program to use the fifo pipe as its input log file.  Normally you run ccze like the cat command and it just outputs the input colorized, by using tail and a fifo pipe we are able to make this awesome trick work.</p>

<h4>To current TTY</h4>
<pre class='prebash'>$ ccze &lt;pipe</pre>

<h4>To any TTY</h4>
<pre class='prebash'>$ ccze &lt; pipe &gt;/dev/pts/2 &amp;</pre>



<h3>Save All Colored Output</h3>
<p>This appends the colorized output to the file in the CWD, super.log</p>
<pre class='prebash'>$ ccze -A &lt;pipe | tee -a super.log</pre>


<h3>Kill the Scrolling</h3>
<p>Immediately kills any processes used by tail and ccze.</p>
<pre class='prebash'>$ pkill -9 ccze\|tail</pre>





<h2>Going Further. Hackers only.</h2>
<p>Here are some other examples of using ccze with fifo pipes, more as an excercise than anything practical as most lines don't work, I just grabbed them from my shell history file.</p>
<pre class='prebash'>tail -f access.log &gt;pipe &amp; ccze &lt;pipe | tee -a super.log &gt;/dev/pts/2
tail -f access.log &gt;pipe &amp; ccze &lt;pipe | tee -a super.log &gt;/dev/pts/2 &amp;
&nbsp;
exec 3&lt;&gt; pipe; while ccze &gt;/dev/pts/2 &lt;&amp;3; do tail -f access.log &gt;pipe; done; exec 3&gt;&amp;-
exec 3&lt;&gt; pipe; ccze &lt;&amp;3 &gt;/dev/pts/2 &amp; ; tail -f access.log &gt;pipe; exec 3&gt;&amp;-
exec 3&lt;&gt; pipe; ccze &lt;&amp;3 &gt;/dev/pts/2 &amp; ; tail -f access.log &gt;pipe
exec 3&lt;&gt; pipe; ccze &lt;&amp;3 &gt;/dev/pts/2 &amp; tail -f access.log &gt;pipe
ccze &lt;&amp;3 &gt;/dev/pts/2 &amp;
ccze 0&lt;&amp;3 |tee -a super.log &gt; /dev/pts/2 &amp;
ccze &lt;&amp;3 |tee -a super.log &gt; /dev/pts/2 &amp;
ccze &lt;pipe |tee -a /dev/pts/2 &amp; tail -s .5 -n 120 -f php_error.log error.log modsec_audit.log &gt;pipe &amp;
ccze | tee -a /dev/pts/2 &lt;pipe
&nbsp;
ccze &lt; tee -a /dev/pts/2 pipe &gt;/dev/pts/2
ccze &lt;|tee -a /dev/pts/2 pipe &gt;/dev/pts/2
ccze &lt;tee -a /dev/pts/2 &lt;pipe
ccze &lt;pipe &gt;&gt; tee -a super.log &gt;/dev/pts/2
cat &lt;pipe | ccze
ccze &lt;pipe &gt;&gt;/dev/pts/2 &amp;
&nbsp;
tail -fq access.log | ccze  &amp;&gt;/dev/pts/1
tail -qf access.log |ccze &amp;&gt;/dev/pts/1 &amp;
tail -f access.log | ccze &gt; $SSH_TTY
&nbsp;
( ccze &gt; /dev/pts/2 )&lt;pipe
( ccze &gt; /dev/pts/2 )&lt;pipe
( ccze &gt; /dev/pts/2 )&lt;pipe &amp; tail -f access.log | pipe
( ccze &gt; /dev/pts/2 )&lt;pipe &amp; tail -f access.log | ./pipe
&nbsp;
ccze &lt;pipe &gt; /dev/pts/2 &amp; tail -f access.log &gt;pipe
ccze  &lt;pipe&gt; /dev/pts/2 &amp; tail -f access.log &gt;pipe
ccze  &lt; pipe &gt; /dev/pts/2 &amp; tail -f access.log &gt;pipe
ccze &lt; pipe &gt;/dev/pts/2 &amp; tail -f access.log &gt;pipe
ccze &lt; pipe &gt;/dev/pts/2 &amp; tail -f access.log &gt;pipe &amp;
ccze &lt; pipe &gt;/dev/pts/2 &amp; tail -n 40 -s 2 -f error.log modsec_audit.log php_error.log  &gt;pipe &amp;
ccze &lt; pipe &gt;| tee -a super.log | &gt;/dev/pts/2 &amp; tail -n 80 -s 1 -f error.log modsec_audit.log php_error.log  &gt;pipe &amp;
ccze &lt; pipe &gt;/dev/pts/2 &amp; tail -n 100 -s 1 -f error.log modsec_audit.log php_error.log &gt;pipe &amp;
ccze &lt; pipe &gt;/dev/pts/2 &amp; tail -n 100 -s 1 -f error.log modsec_audit.log php_error.log &gt;pipe &amp;
&nbsp;
tail -f access.log | ccze &gt; pipe &amp; /dev/pts/2/&lt;pipe
tail -f access.log | ccze &gt; pipe &amp; /dev/pts/2&lt;pipe
&nbsp;
ccze &lt; $(tail -n 20 -s 1 -f access.log)
ccze &lt; | $(tail -n 20 -s 1 -f access.log)
ccze &lt; |$(tail -n 20 -s 1 -f access.log)</pre>


<h3>Shell Script</h3>
<p>I also hacked together a little shell script that you may wish to hack to your needs.  Its actually pretty sweet if you can figure it out.</p>
<pre class='prebash'>#!/bin/bash -l
set -o xtrace
renice -p $$ 15
&nbsp;
pkill -9 tee\|ccze &amp;&gt;/dev/null || echo -n
disown -a &amp;&gt;/dev/null || echo
&nbsp;
[[ -r "~/pipe" ]] &amp;&amp; rm -rf ~/pipe
&nbsp;
mkfifo ~/pipe
&nbsp;
cd /home/askapache.com/logs
&nbsp;
[[ -r "superlog.log" ]] &amp;&amp; echo "Found old logfile, moving." &amp;&amp; mv superlog.log `command ls|wc -l`-superlog.log
&nbsp;
ccze &lt;$HOME/pipe &gt; $SSH_TTY &amp; tail -n 150 -s .5 -f  php_error.log error.log modsec_audit.log &gt;$HOME/pipe &amp;
disown %2; &amp;&amp; disown %3;
&nbsp;
disown -a
&nbsp;
sleep 60 &amp;
disown $! || disown %1
&nbsp;
for i in `seq 1 4`;do echo -n $&#039;\a&#039;; sleep 1;done
kill -9 $J1
kill -9 $J2
&nbsp;
logout
exit 0</pre><p><a href="http://www.askapache.com/linux/elite-log-file-scrolling-color-syntax.html"></a><a href="http://www.askapache.com/linux/elite-log-file-scrolling-color-syntax.html">Elite Log File Scrolling with Color Syntax</a> originally appeared on <cite>AskApache.com</cite> </p>]]></content:encoded>
			<wfw:commentRss>http://www.askapache.com/linux/elite-log-file-scrolling-color-syntax.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

