<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2683555476832093925</id><updated>2011-07-28T21:34:03.676-07:00</updated><title type='text'>Linux Tips</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://cooltux.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2683555476832093925/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://cooltux.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Ultimobyte</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>4</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2683555476832093925.post-7787512538797775943</id><published>2008-11-04T03:27:00.000-08:00</published><updated>2010-08-26T01:12:04.287-07:00</updated><title type='text'>Simple "nsping"</title><content type='html'>&lt;span class="smalltext3"&gt;&lt;b&gt;there's no need to install a separate utility to run "nsping", you have "dig" already ...&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="author"&gt;&lt;/span&gt;&lt;br /&gt;A simple network diagnostic tool to determine the health and reachability of name servers is &lt;em&gt;nsping&lt;/em&gt;. as the name suggests you &lt;em&gt;ping&lt;/em&gt; a name server, not with an ICMP echo request but with a (random) lookup. the time interval it takes to get a reply back is what you're after. serious lags can indicate network issues. the tool &lt;em&gt;nsping&lt;/em&gt; is a standalone binary, and on most UN*X systems it's another package to install.  however, almost everyone already has &lt;em&gt;dig&lt;/em&gt; installed, part of the BIND package. &lt;em&gt;dig&lt;/em&gt; is a complex name server query and diagnostic tool. one useful feature of it is that it reports the amount of time it takes to perform it's query in milliseconds ... exactly what we're after. so, let's use &lt;em&gt;dig&lt;/em&gt; to do exactly what &lt;em&gt;nsping&lt;/em&gt; does and trim down the answer to look like &lt;em&gt;nsping&lt;/em&gt;. all we have to do is a random lookup and report only the query time. this simple shell hack uses the built in random number generator from &lt;em&gt;ksh&lt;/em&gt; (i think the tool can work in &lt;em&gt;bash&lt;/em&gt;, too) and &lt;em&gt;awk&lt;/em&gt; to trim down the query from &lt;em&gt;dig&lt;/em&gt;. &lt;span class="secondary3"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="secondary3"&gt;&lt;pre&gt;&lt;span style="font-weight: bold;"&gt;#!/bin/ksh&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;SERVER=$1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;dig @${SERVER} -t a ${RANDOM}.${RANDOM}${RANDOM}.${RANDOM} | \&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;        awk '{if ($0 ~/Query/) print $4" "$5}'&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;put this in your path and ping a name server: &lt;br /&gt;&lt;pre&gt;$ nsping ns.oreilly.com     &lt;br /&gt;97 msec&lt;br /&gt;&lt;/pre&gt;i have used this in the past to query the root nameservers as a network connectivity monitor (with much success).         &lt;br /&gt;&lt;b&gt;See also:&lt;/b&gt; man dig&lt;br /&gt;"dns &amp;amp; bind", the book from o'reilly&lt;br /&gt;"sed &amp;amp; awk", another book from o'reilly&lt;br /&gt;&lt;br /&gt;[&lt;span class="smalltext3"&gt;Contributed by: &lt;/span&gt;&lt;span class="author"&gt;&lt;a class="author" href="http://hacks.oreilly.com/contributed.csp?u=80881"&gt;jose nazario&lt;/a&gt;]&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2683555476832093925-7787512538797775943?l=cooltux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cooltux.blogspot.com/feeds/7787512538797775943/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2683555476832093925&amp;postID=7787512538797775943' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2683555476832093925/posts/default/7787512538797775943'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2683555476832093925/posts/default/7787512538797775943'/><link rel='alternate' type='text/html' href='http://cooltux.blogspot.com/2008/11/simple-nsping.html' title='Simple &quot;nsping&quot;'/><author><name>Ultimobyte</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2683555476832093925.post-115409070183396676</id><published>2008-09-15T02:05:00.000-07:00</published><updated>2010-08-26T01:05:14.070-07:00</updated><title type='text'>Introduction to Named Pipes (by Andy Vaught )</title><content type='html'>&lt;a href="http://4.bp.blogspot.com/_O9-fRJsssMI/SNpHG4eoNOI/AAAAAAAAACg/2uXzib_3Ha0/s1600-h/Pipa3.gif" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5249586499219371234" src="http://4.bp.blogspot.com/_O9-fRJsssMI/SNpHG4eoNOI/AAAAAAAAACg/2uXzib_3Ha0/s320/Pipa3.gif" style="cursor: pointer; float: left; margin: 0pt 10px 10px 0pt;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;One of the fundamental features that makes Linux and other Unices useful is the “&lt;span style="color: #990000; font-weight: bold;"&gt;pipe&lt;/span&gt;”. Pipes allow separate processes to communicate without having been designed explicitly to work together. This allows tools quite narrow in their function to be combined in complex ways.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;A simple example of using a pipe is the command:&lt;br /&gt;&lt;strong&gt;ls | grep x&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;When bash examines the command line, it finds the vertical bar character | that separates the two commands. Bash and other shells run both commands, connecting the output of the first to the input of the second. The ls program produces a list of files in the current directory, while the grep program reads the output of ls and prints only those lines containing the letter x.&lt;br /&gt;&lt;br /&gt;The above, familiar to most Unix users, is an example of an “unnamed pipe”. The pipe exists only inside the kernel and cannot be accessed by processes that created it, in this case, the bash shell. For those who don't already know, a parent process is the first process started by a program that in turn creates separate child processes that execute the program.&lt;br /&gt;&lt;br /&gt;The other sort of pipe is a “named” pipe, which is sometimes called a FIFO. FIFO stands for “First In, First Out” and refers to the property that the order of bytes going in is the same coming out. The “name” of a named pipe is actually a file name within the file system.&lt;br /&gt;Pipes are shown by ls as any other file with a couple of differences:&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;% ls -l fifo1&lt;/span&gt;&lt;br /&gt;prw-r--r-- 1 andy users 0 Jan 22 23:11 fifo1|&lt;br /&gt;&lt;br /&gt;The p in the leftmost column indicates that fifo1 is a pipe. The rest of the permission bits control who can read or write to the pipe just like a regular file. On systems with a modern ls, the | character at the end of the file name is another clue, and on Linux systems with the color option enabled, fifo| is printed in red by default.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;On older Linux systems, named pipes are created by the mknod program, usually located in the /etc directory. On more modern systems, mkfifo is a standard utility. The mkfifo program takes one or more file names as arguments for this task and creates pipes with those names. For example, to create a named pipe with the name pipe1 give the command:&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;mkfifo pipe&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The simplest way to show how named pipes work is with an example. Suppose we've created pipe as shown above. In one virtual console1, type: (&lt;a href="http://cooltux.blogspot.com/2008/09/introduction-to-named-pipes-by-andy.html"&gt;read more&lt;/a&gt;)&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;ls -l &amp;gt; pipe1&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;and in another type:&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;cat &amp;lt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Voila! The output of the command run on the first console shows up on the second console. Note that the order in which you run the commands doesn't matter. If you haven't used virtual consoles before, see the article “Keyboards, Consoles and VT Cruising” by John M. Fisk in the November 1996 Linux Journal. If you watch closely, you'll notice that the first command you run appears to hang. This happens because the other end of the pipe is not yet connected, and so the kernel suspends the first process until the second process opens the pipe. In Unix jargon, the process is said to be “blocked”, since it is waiting for something to happen. One very useful application of named pipes is to allow totally unrelated programs to communicate with each other. For example, a program that services requests of some sort (print files, access a database) could open the pipe for reading. Then, another process could make a request by opening the pipe and writing a command. That is, the “server” can perform a task on behalf of the “client”. Blocking can also happen if the client isn't writing, or the server isn't reading. Pipe Madness Create two named pipes, pipe1 and pipe2. Run the commands:&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;echo -n x | cat - pipe1 &amp;gt; pipe2 &amp;amp;&lt;/span&gt; &lt;span style="font-weight: bold;"&gt;cat   pipe1&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;On screen, it will not appear that anything is happening, but if you run top (a command similar to ps for showing process status), you'll see that both cat programs are running like crazy copying the letter x back and forth in an endless loop.&lt;br /&gt;&lt;br /&gt;After you press ctrl-C to get out of the loop, you may receive the message “broken pipe”. This error occurs when a process writing to a pipe when the process reading the pipe closes its end. Since the reader is gone, the data has no place to go. Normally, the writer will finish writing its data and close the pipe. At this point, the reader sees the EOF (end of file) and executes the request.&lt;br /&gt;&lt;br /&gt;Whether or not the “broken pipe” message is issued depends on events at the exact instant the ctrl-C is pressed. If the second cat has just read the x, pressing ctrl-C stops the second cat, pipe1 is closed and the first cat stops quietly, i.e., without a message. On the other hand, if the second cat is waiting for the first to write the x, ctrl-C causes pipe2 to close before the first cat can write to it, and the error message is issued. This sort of random behavior is known as a “race condition”.&lt;br /&gt;Command Substitution&lt;br /&gt;&lt;br /&gt;Bash uses named pipes in a really neat way. Recall that when you enclose a command in parenthesis, the command is actually run in a “subshell”; that is, the shell clones itself and the clone interprets the command(s) within the parenthesis. Since the outer shell is running only a single “command”, the output of a complete set of commands can be redirected as a unit. For example, the command:&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;(ls -l; ls -l) &amp;gt;ls.out&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;writes two copies of the current directory listing to the file ls.out.&lt;br /&gt;&lt;br /&gt;Command substitution occurs when you put a &amp;lt;&amp;gt; in front of the left parenthesis. For instance, typing the command:&lt;br /&gt;cat &amp;lt;(ls -l) results in the command ls -l executing in a subshell as usual, but redirects the output to a temporary named pipe, which bash creates, names and later deletes. Therefore, cat has a valid file name to read from, and we see the output of ls -l, taking one more step than usual to do so. Similarly, giving &amp;gt;(commands) results in Bash naming a temporary pipe, which the commands inside the parenthesis read for input.&lt;br /&gt;&lt;br /&gt;If you want to see whether two directories contain the same file names, run the single command:&lt;br /&gt;cmp &amp;lt;(ls /dir1) &amp;lt;(ls /dir2) The compare program cmp will see the names of two files which it will read and compare. Command substitution also makes the tee command (used to view and save the output of a command) much more useful in that you can cause a single stream of input to be read by multiple readers without resorting to temporary files—bash does all the work for you. The command:  &lt;span style="font-weight: bold;"&gt;ls | tee &amp;gt;(grep foo | wc &amp;gt;foo.count) \&lt;/span&gt; &lt;span style="font-weight: bold;"&gt;&amp;gt;(grep bar | wc &amp;gt;bar.count) \&lt;/span&gt; &lt;span style="font-weight: bold;"&gt;| grep baz | wc &amp;gt;baz.count&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;counts the number of occurrences of foo, bar and baz in the output of ls and writes this information to three separate files. Command substitutions can even be nested:&lt;br /&gt;cat &amp;lt;(cat &amp;lt;(cat &amp;lt;(ls -l)))) works as a very roundabout way to list the current directory.  As you can see, while the unnamed pipes allow simple commands to be strung together, named pipes, with a little help from bash, allow whole trees of pipes to be created. The possibilities are limited only by your imagination.  &lt;a href="http://life.awardspace.co.uk/"&gt;&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div align="center"&gt;&lt;a href="http://life.awardspace.co.uk/"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5246175090844684530" src="http://4.bp.blogspot.com/_O9-fRJsssMI/SM4ocx9M0PI/AAAAAAAAABo/dkYEF-WAcY8/s320/foto_links.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2683555476832093925-115409070183396676?l=cooltux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cooltux.blogspot.com/feeds/115409070183396676/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2683555476832093925&amp;postID=115409070183396676' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2683555476832093925/posts/default/115409070183396676'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2683555476832093925/posts/default/115409070183396676'/><link rel='alternate' type='text/html' href='http://cooltux.blogspot.com/2008/09/introduction-to-named-pipes-by-andy.html' title='Introduction to Named Pipes (by Andy Vaught )'/><author><name>Ultimobyte</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_O9-fRJsssMI/SNpHG4eoNOI/AAAAAAAAACg/2uXzib_3Ha0/s72-c/Pipa3.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2683555476832093925.post-742417819290288518</id><published>2008-09-05T07:32:00.000-07:00</published><updated>2008-09-05T07:40:54.420-07:00</updated><title type='text'>System Information</title><content type='html'>&lt;strong&gt;This is a linux command line reference for system information operations&lt;br /&gt;&lt;br /&gt;uname -a&lt;/strong&gt;&lt;br /&gt;Show kernel version and system architecture&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;head -n1 /etc/issue&lt;/strong&gt;&lt;br /&gt;Show name and version of distribution&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;cat /proc/partitions&lt;/strong&gt;&lt;br /&gt;Show all partitions registered on the system&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;grep MemTotal /proc/meminfo&lt;/strong&gt;&lt;br /&gt;Show RAM total seen by the system&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;grep "model name" /proc/cpuinfo&lt;/strong&gt;&lt;br /&gt;Show CPU(s) info&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;lspci -tv&lt;/strong&gt;&lt;br /&gt;Show PCI info&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;lsusb -tv&lt;/strong&gt;&lt;br /&gt;Show USB info&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;mount | column -t&lt;/strong&gt;&lt;br /&gt;List mounted filesystems on the system (and align output)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2683555476832093925-742417819290288518?l=cooltux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cooltux.blogspot.com/feeds/742417819290288518/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2683555476832093925&amp;postID=742417819290288518' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2683555476832093925/posts/default/742417819290288518'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2683555476832093925/posts/default/742417819290288518'/><link rel='alternate' type='text/html' href='http://cooltux.blogspot.com/2008/09/system-information_05.html' title='System Information'/><author><name>Ultimobyte</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2683555476832093925.post-1677577183218605980</id><published>2008-08-27T06:09:00.000-07:00</published><updated>2008-08-27T06:14:37.810-07:00</updated><title type='text'>Tcpdump</title><content type='html'>&lt;span style="font-size:100%;"&gt;Tcpdump is a really great tool for network security analyst, you can dump packets that flows within your networks into file for further analysis. With some filters you can capture only the interested packets, which it reduce the size of saved dump and further reduce loading and processing time of packets analysis. &lt;/span&gt;&lt;p&gt;&lt;span style="font-size:100%;"&gt;This post will only covers the fundamental of tcpdump usage, bare in mind tcpdump can do much much more than what I illustrate here.&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:100%;"&gt;Lets start with capturing packets based on network interface, ports and protocols. Let assume I wanna capture tcp packets that flow over &lt;strong&gt;eth1&lt;/strong&gt;, port &lt;strong&gt;6881&lt;/strong&gt;. The dump file with be save as &lt;strong&gt;test.pcap&lt;/strong&gt;.&lt;/span&gt;&lt;/p&gt; &lt;pre style="font-weight: bold; color: rgb(153, 0, 0);"&gt;&lt;span style="font-size:100%;"&gt;&lt;code&gt;tcpdump -w test.pcap -i eth1 tcp port 6881&lt;/code&gt;&lt;/span&gt;&lt;/pre&gt; &lt;p&gt;&lt;span style="font-size:100%;"&gt;Simple right? What if at the same time I am interested on getting packets on udp port 33210 and 33220?&lt;/span&gt;&lt;/p&gt; &lt;pre style="font-weight: bold;"&gt;&lt;span style="font-size:100%;"&gt;&lt;code&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;tcpdump -w test.pcap -i eth1 tcp port 6881 or udp \( 33210 or 33220 \)&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/pre&gt;&lt;p&gt;&lt;span style="font-size:100%;"&gt; ‘\’ is an escape symbol for ‘(’ and ‘)’. Logic OR implies PLUS (+). In plain text is I want to capture tcp packets flows over port 6881 plus udp ports 33210 and 33220. &lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:100%;"&gt;Careful with ‘and’ in tcpdump filter expression, it means intersection. Thats why I put ‘or’ instead of and within udp port 33210 and 33220. The usage of ‘and’ in tcpdump will be illustrate later.&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:100%;"&gt;Ok, how about reading pcap that I saved previously?&lt;/span&gt;&lt;/p&gt; &lt;pre style="font-weight: bold; color: rgb(153, 0, 0);"&gt;&lt;span style="font-size:100%;"&gt;&lt;code&gt;tcpdump -nnr test.pcap&lt;/code&gt;&lt;/span&gt;&lt;/pre&gt; &lt;p&gt;&lt;span style="font-size:100%;"&gt;The -nn is to tell tcpdump not to resolve DNS on IP and Ports, where &lt;strong&gt;r&lt;/strong&gt; is read.  &lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:100%;"&gt;Adding -tttt to makes the timestamp appears more readable format.&lt;/span&gt;&lt;/p&gt; &lt;pre style="color: rgb(153, 0, 0); font-weight: bold;"&gt;&lt;span style="font-size:100%;"&gt;&lt;code&gt;tcpdump -ttttnnr test.pcap&lt;/code&gt;&lt;/span&gt;&lt;/pre&gt; &lt;p&gt;&lt;span style="font-size:100%;"&gt;&lt;strong&gt;How about capture based on IP ?&lt;/strong&gt;&lt;br /&gt;You need to tell tcpdump which IP you are interested in? Destination IP? or Source IP ? Let say I wanna sniff on destination IP 10.168.28.22 tcp port 22, how should i write?&lt;/span&gt;&lt;/p&gt; &lt;pre style="font-weight: bold; color: rgb(204, 0, 0);"&gt;&lt;span style="font-size:100%;"&gt;&lt;code&gt;tcpdump -w test.pcap dst 10.168.28.22 and tcp port 22&lt;/code&gt;&lt;/span&gt;&lt;/pre&gt; &lt;p&gt;&lt;span style="font-size:100%;"&gt;So the ‘and’ makes the intersection of destination IP and port.&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:100%;"&gt;By default the sniff size of packets is 96 bytes, you somehow can overload that size by specified with -s.&lt;/span&gt;&lt;/p&gt; &lt;pre style="font-weight: bold; color: rgb(153, 0, 0);"&gt;&lt;span style="font-size:100%;"&gt;&lt;code&gt;tcpdump -w test.pcap -s 1550 dst 10.168.28.22 and tcp port 22&lt;/code&gt;&lt;/span&gt;&lt;/pre&gt; &lt;p&gt;&lt;span style="font-size:100%;"&gt;Some version of tcpdump allows you to define port range. You can as bellow for capturing packets based on a range of tcp port.&lt;/span&gt;&lt;/p&gt; &lt;pre style="font-weight: bold; color: rgb(153, 0, 0);"&gt;&lt;span style="font-size:100%;"&gt;&lt;code&gt;tcpdump tcp portrange 20-24&lt;/code&gt;&lt;/span&gt;&lt;/pre&gt; &lt;p&gt;&lt;span style="font-size:100%;"&gt;Bare in mind, the line above I didn’t specified -w which it won’t write to a file but i will just print the captured packets on the screen.&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2683555476832093925-1677577183218605980?l=cooltux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cooltux.blogspot.com/feeds/1677577183218605980/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2683555476832093925&amp;postID=1677577183218605980' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2683555476832093925/posts/default/1677577183218605980'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2683555476832093925/posts/default/1677577183218605980'/><link rel='alternate' type='text/html' href='http://cooltux.blogspot.com/2008/08/tcpdump-is-really-great-tool-for.html' title='Tcpdump'/><author><name>Ultimobyte</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
