How to investigate a random reset on TCP client port connected via loopback interface to a server

I have a test suite which initializes a server on the localhost and then runs thousands of stress tests which include starting and stopping clients connecting to this local server on same machine. I am trying to find the reason for a RST sent by client to the server. This is the sequence of events:   1. client initializes SYN    2. Server sends back SYN,ACK    3. client sends RST (instead of ACK and establishing connection) One observation is on many occasions servers runs around 99 percent CPU although it returns back to normal in few seconds/minutes. Initially I thought this could be because client is using a port from previously closed connection which is in TIME_WAIT state and so when server sends a SYN,ACK on that connection client issues RST. Although I was skeptical as to why client should use a port in TIME_WAIT state but then I am using old fedora core 4 and thought may be it doesn't have proper implementation of TCP/IP :-). Now I don't believe that is the reason because all the tuning done around fixing above issue did not help alleviate the problem. FYI following are the changes I tried in `/etc/sysctl.conf`:               net.ipv4.ip_local_port_range = 1024     65535     net.ipv4.tcp_fin_timeout = 15     net.ipv4.tcp_rfc1337 = 1     net.ipv4.tcp_tw_reuse = 1      One more point, this issue isn't consistent. In fact I can reproduce this problem only after I go thru 15 to 35 cycles of Re-starting the server and running all client tests. I ran out of all the reasons I can think of why this could be happening so let me know if anyone has any ideas on what might be happening. Packet details               Date & Time                No.     Time        Source                Destination           Protocol Length Source port Dest port Info     2014-06-25 14:49:45.378209 1032719 1858.494749 ::1                   ::1                   TCP      94     netview-aix-5 navisphere netview-aix-5 > navisphere [SYN] Seq=0 Win=32752 Len=0 MSS=16376 SACK_PERM=1 TSval=1587252 TSecr=0 WS=128          Frame 1032719: 94 bytes on wire (752 bits), 94 bytes captured (752 bits)         Arrival Time: Jun 25, 2014 14:49:45.378209000 EDT         Epoch Time: 1403722185.378209000 seconds         [Time delta from previous captured frame: 0.005893000 seconds]         [Time delta from previous displayed frame: 0.000000000 seconds]         [Time since reference or first frame: 1858.494749000 seconds]         Frame Number: 1032719         Frame Length: 94 bytes (752 bits)         Capture Length: 94 bytes (752 bits)         [Frame is marked: False]         [Frame is ignored: False]         [Protocols in frame: eth:ipv6:tcp]         [Coloring Rule Name: TCP SYN/FIN]         [Coloring Rule String: tcp.flags & 0x02 || tcp.flags.fin == 1]     Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 (00:00:00:00:00:00)         Destination: 00:00:00_00:00:00 (00:00:00:00:00:00)             Address: 00:00:00_00:00:00 (00:00:00:00:00:00)             .... ...0 .... .... .... .... = IG bit: Individual address (unicast)             .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)         Source: 00:00:00_00:00:00 (00:00:00:00:00:00)             Address: 00:00:00_00:00:00 (00:00:00:00:00:00)             .... ...0 .... .... .... .... = IG bit: Individual address (unicast)             .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)         Type: IPv6 (0x86dd)     Internet Protocol Version 6, Src: ::1 (::1), Dst: ::1 (::1)         0110 .... = Version: 6             [0110 .... = This field makes the filter "ip.version == 6" possible: 6]         .... 0000 0000 .... .... .... .... .... = Traffic class: 0x00000000             .... 0000 00.. .... .... .... .... .... = Differentiated Services Field: Default (0x00000000)             .... .... ..0. .... .... .... .... .... = ECN-Capable Transport (ECT): Not set             .... .... ...0 .... .... .... .... .... = ECN-CE: Not set         .... .... .... 0000 0000 0000 0000 0000 = Flowlabel: 0x00000000         Payload length: 40         Next header: TCP (0x06)         Hop limit: 64         Source: ::1 (::1)         Destination: ::1 (::1)     Transmission Control Protocol, Src Port: netview-aix-5 (1665), Dst Port: navisphere (2162), Seq: 0, Len: 0         Source port: netview-aix-5 (1665)         Destination port: navisphere (2162)         [Stream index: 3374]         Sequence number: 0    (relative sequence number)         Header length: 40 bytes         Flags: 0x02 (SYN)             000. .... .... = Reserved: Not set             ...0 .... .... = Nonce: Not set             .... 0... .... = Congestion Window Reduced (CWR): Not set             .... .0.. .... = ECN-Echo: Not set             .... ..0. .... = Urgent: Not set             .... ...0 .... = Acknowledgement: Not set             .... .... 0... = Push: Not set             .... .... .0.. = Reset: Not set             .... .... ..1. = Syn: Set                 [Expert Info (Chat/Sequence): Connection establish request (SYN): server port navisphere]             .... .... ...0 = Fin: Not set         Window size value: 32752         [Calculated window size: 32752]         Checksum: 0xf489 [validation disabled]             [Good Checksum: False]             [Bad Checksum: False]         Options: (20 bytes)             Maximum segment size: 16376 bytes             TCP SACK Permitted Option: True             Timestamps: TSval 1587252, TSecr 0             No-Operation (NOP)             Window scale: 7 (multiply by 128)          Date & Time                No.     Time        Source                Destination           Protocol Length Source port Dest port Info     2014-06-25 14:49:45.378222 1032720 1858.494762 ::1                   ::1                   TCP      94     navisphere  netview-aix-5 navisphere > netview-aix-5 [SYN, ACK] Seq=0 Ack=1 Win=32728 Len=0 MSS=16376 SACK_PERM=1 TSval=1587252 TSecr=1587252 WS=128          Frame 1032720: 94 bytes on wire (752 bits), 94 bytes captured (752 bits)         Arrival Time: Jun 25, 2014 14:49:45.378222000 EDT         Epoch Time: 1403722185.378222000 seconds         [Time delta from previous captured frame: 0.000013000 seconds]         [Time delta from previous displayed frame: 0.000013000 seconds]         [Time since reference or first frame: 1858.494762000 seconds]         Frame Number: 1032720         Frame Length: 94 bytes (752 bits)         Capture Length: 94 bytes (752 bits)         [Frame is marked: False]         [Frame is ignored: False]         [Protocols in frame: eth:ipv6:tcp]         [Coloring Rule Name: TCP SYN/FIN]         [Coloring Rule String: tcp.flags & 0x02 || tcp.flags.fin == 1]     Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 (00:00:00:00:00:00)         Destination: 00:00:00_00:00:00 (00:00:00:00:00:00)             Address: 00:00:00_00:00:00 (00:00:00:00:00:00)             .... ...0 .... .... .... .... = IG bit: Individual address (unicast)             .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)         Source: 00:00:00_00:00:00 (00:00:00:00:00:00)             Address: 00:00:00_00:00:00 (00:00:00:00:00:00)             .... ...0 .... .... .... .... = IG bit: Individual address (unicast)             .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)         Type: IPv6 (0x86dd)     Internet Protocol Version 6, Src: ::1 (::1), Dst: ::1 (::1)         0110 .... = Version: 6             [0110 .... = This field makes the filter "ip.version == 6" possible: 6]         .... 0000 0000 .... .... .... .... .... = Traffic class: 0x00000000             .... 0000 00.. .... .... .... .... .... = Differentiated Services Field: Default (0x00000000)             .... .... ..0. .... .... .... .... .... = ECN-Capable Transport (ECT): Not set             .... .... ...0 .... .... .... .... .... = ECN-CE: Not set         .... .... .... 0000 0000 0000 0000 0000 = Flowlabel: 0x00000000         Payload length: 40         Next header: TCP (0x06)         Hop limit: 64         Source: ::1 (::1)         Destination: ::1 (::1)     Transmission Control Protocol, Src Port: navisphere (2162), Dst Port: netview-aix-5 (1665), Seq: 0, Ack: 1, Len: 0         Source port: navisphere (2162)         Destination port: netview-aix-5 (1665)         [Stream index: 3374]         Sequence number: 0    (relative sequence number)         Acknowledgement number: 1    (relative ack number)         Header length: 40 bytes         Flags: 0x12 (SYN, ACK)             000. .... .... = Reserved: Not set             ...0 .... .... = Nonce: Not set             .... 0... .... = Congestion Window Reduced (CWR): Not set             .... .0.. .... = ECN-Echo: Not set             .... ..0. .... = Urgent: Not set             .... ...1 .... = Acknowledgement: Set             .... .... 0... = Push: Not set             .... .... .0.. = Reset: Not set             .... .... ..1. = Syn: Set                 [Expert Info (Chat/Sequence): Connection establish acknowledge (SYN+ACK): server port navisphere]             .... .... ...0 = Fin: Not set         Window size value: 32728         [Calculated window size: 32728]         Checksum: 0xf7fa [validation disabled]             [Good Checksum: False]             [Bad Checksum: False]         Options: (20 bytes)             Maximum segment size: 16376 bytes             TCP SACK Permitted Option: True             Timestamps: TSval 1587252, TSecr 1587252             No-Operation (NOP)             Window scale: 7 (multiply by 128)         [SEQ/ACK analysis]             [This is an ACK to the segment in frame: 1032719]             [The RTT to ACK the segment was: 0.000013000 seconds]          Date & Time                No.     Time        Source                Destination           Protocol Length Source port Dest port Info     2014-06-25 14:49:45.378228 1032721 1858.494768 ::1                   ::1                   TCP      74     netview-aix-5 navisphere netview-aix-5 > navisphere [RST] Seq=1 Win=0 Len=0          Frame 1032721: 74 bytes on wire (592 bits), 74 bytes captured (592 bits)         Arrival Time: Jun 25, 2014 14:49:45.378228000 EDT         Epoch Time: 1403722185.378228000 seconds         [Time delta from previous captured frame: 0.000006000 seconds]         [Time delta from previous displayed frame: 0.000006000 seconds]         [Time since reference or first frame: 1858.494768000 seconds]         Frame Number: 1032721         Frame Length: 74 bytes (592 bits)         Capture Length: 74 bytes (592 bits)         [Frame is marked: False]         [Frame is ignored: False]         [Protocols in frame: eth:ipv6:tcp]         [Coloring Rule Name: TCP RST]         [Coloring Rule String: tcp.flags.reset eq 1]     Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 (00:00:00:00:00:00)         Destination: 00:00:00_00:00:00 (00:00:00:00:00:00)             Address: 00:00:00_00:00:00 (00:00:00:00:00:00)             .... ...0 .... .... .... .... = IG bit: Individual address (unicast)             .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)         Source: 00:00:00_00:00:00 (00:00:00:00:00:00)             Address: 00:00:00_00:00:00 (00:00:00:00:00:00)             .... ...0 .... .... .... .... = IG bit: Individual address (unicast)             .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)         Type: IPv6 (0x86dd)     Internet Protocol Version 6, Src: ::1 (::1), Dst: ::1 (::1)         0110 .... = Version: 6             [0110 .... = This field makes the filter "ip.version == 6" possible: 6]         .... 0000 0000 .... .... .... .... .... = Traffic class: 0x00000000             .... 0000 00.. .... .... .... .... .... = Differentiated Services Field: Default (0x00000000)             .... .... ..0. .... .... .... .... .... = ECN-Capable Transport (ECT): Not set             .... .... ...0 .... .... .... .... .... = ECN-CE: Not set         .... .... .... 0000 0000 0000 0000 0000 = Flowlabel: 0x00000000         Payload length: 20         Next header: TCP (0x06)         Hop limit: 64         Source: ::1 (::1)         Destination: ::1 (::1)     Transmission Control Protocol, Src Port: netview-aix-5 (1665), Dst Port: navisphere (2162), Seq: 1, Len: 0         Source port: netview-aix-5 (1665)         Destination port: navisphere (2162)         [Stream index: 3374]         Sequence number: 1    (relative sequence number)         Header length: 20 bytes         Flags: 0x04 (RST)             000. .... .... = Reserved: Not set             ...0 .... .... = Nonce: Not set             .... 0... .... = Congestion Window Reduced (CWR): Not set             .... .0.. .... = ECN-Echo: Not set             .... ..0. .... = Urgent: Not set             .... ...0 .... = Acknowledgement: Not set             .... .... 0... = Push: Not set             .... .... .1.. = Reset: Set                 [Expert Info (Chat/Sequence): Connection reset (RST)]             .... .... ..0. = Syn: Not set             .... .... ...0 = Fin: Not set         Window size value: 0         [Calculated window size: 0]         [Window size scaling factor: 128]         Checksum: 0x4eea [validation disabled]             [Good Checksum: False]             [Bad Checksum: False]          Date & Time                No.     Time        Source                Destination           Protocol Length Source port Dest port Info     2014-06-25 14:49:48.375927 1032722 1861.492467 ::1                   ::1                   TCP      94     netview-aix-5 navisphere netview-aix-5 > navisphere [SYN] Seq=0 Win=32752 Len=0 MSS=16376 SACK_PERM=1 TSval=1588002 TSecr=0 WS=128          Frame 1032722: 94 bytes on wire (752 bits), 94 bytes captured (752 bits)         Arrival Time: Jun 25, 2014 14:49:48.375927000 EDT         Epoch Time: 1403722188.375927000 seconds         [Time delta from previous captured frame: 2.997699000 seconds]         [Time delta from previous displayed frame: 2.997699000 seconds]         [Time since reference or first frame: 1861.492467000 seconds]         Frame Number: 1032722         Frame Length: 94 bytes (752 bits)         Capture Length: 94 bytes (752 bits)         [Frame is marked: False]         [Frame is ignored: False]         [Protocols in frame: eth:ipv6:tcp]         [Coloring Rule Name: TCP SYN/FIN]         [Coloring Rule String: tcp.flags & 0x02 || tcp.flags.fin == 1]     Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 (00:00:00:00:00:00)         Destination: 00:00:00_00:00:00 (00:00:00:00:00:00)             Address: 00:00:00_00:00:00 (00:00:00:00:00:00)             .... ...0 .... .... .... .... = IG bit: Individual address (unicast)             .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)         Source: 00:00:00_00:00:00 (00:00:00:00:00:00)             Address: 00:00:00_00:00:00 (00:00:00:00:00:00)             .... ...0 .... .... .... .... = IG bit: Individual address (unicast)             .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)         Type: IPv6 (0x86dd)     Internet Protocol Version 6, Src: ::1 (::1), Dst: ::1 (::1)         0110 .... = Version: 6             [0110 .... = This field makes the filter "ip.version == 6" possible: 6]         .... 0000 0000 .... .... .... .... .... = Traffic class: 0x00000000             .... 0000 00.. .... .... .... .... .... = Differentiated Services Field: Default (0x00000000)             .... .... ..0. .... .... .... .... .... = ECN-Capable Transport (ECT): Not set             .... .... ...0 .... .... .... .... .... = ECN-CE: Not set         .... .... .... 0000 0000 0000 0000 0000 = Flowlabel: 0x00000000         Payload length: 40         Next header: TCP (0x06)         Hop limit: 64         Source: ::1 (::1)         Destination: ::1 (::1)     Transmission Control Protocol, Src Port: netview-aix-5 (1665), Dst Port: navisphere (2162), Seq: 0, Len: 0         Source port: netview-aix-5 (1665)         Destination port: navisphere (2162)         [Stream index: 3374]         Sequence number: 0    (relative sequence number)         Header length: 40 bytes         Flags: 0x02 (SYN)             000. .... .... = Reserved: Not set             ...0 .... .... = Nonce: Not set             .... 0... .... = Congestion Window Reduced (CWR): Not set             .... .0.. .... = ECN-Echo: Not set             .... ..0. .... = Urgent: Not set             .... ...0 .... = Acknowledgement: Not set             .... .... 0... = Push: Not set             .... .... .0.. = Reset: Not set             .... .... ..1. = Syn: Set                 [Expert Info (Chat/Sequence): Connection establish request (SYN): server port navisphere]             .... .... ...0 = Fin: Not set         Window size value: 32752         [Calculated window size: 32752]         Checksum: 0xf19b [validation disabled]             [Good Checksum: False]             [Bad Checksum: False]         Options: (20 bytes)             Maximum segment size: 16376 bytes             TCP SACK Permitted Option: True             Timestamps: TSval 1588002, TSecr 0             No-Operation (NOP)             Window scale: 7 (multiply by 128)          Date & Time                No.     Time        Source                Destination           Protocol Length Source port Dest port Info     2014-06-25 14:49:48.375950 1032723 1861.492490 ::1                   ::1                   TCP      94     navisphere  netview-aix-5 [TCP Previous segment lost] navisphere > netview-aix-5 [SYN, ACK] Seq=2997725 Ack=1 Win=32728 Len=0 MSS=16376 SACK_PERM=1 TSval=1588002 TSecr=1588002 WS=128          Frame 1032723: 94 bytes on wire (752 bits), 94 bytes captured (752 bits)         Arrival Time: Jun 25, 2014 14:49:48.375950000 EDT         Epoch Time: 1403722188.375950000 seconds         [Time delta from previous captured frame: 0.000023000 seconds]         [Time delta from previous displayed frame: 0.000023000 seconds]         [Time since reference or first frame: 1861.492490000 seconds]         Frame Number: 1032723         Frame Length: 94 bytes (752 bits)         Capture Length: 94 bytes (752 bits)         [Frame is marked: False]         [Frame is ignored: False]         [Protocols in frame: eth:ipv6:tcp]         [Coloring Rule Name: Bad TCP]         [Coloring Rule String: tcp.analysis.flags]     Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 (00:00:00:00:00:00)         Destination: 00:00:00_00:00:00 (00:00:00:00:00:00)             Address: 00:00:00_00:00:00 (00:00:00:00:00:00)             .... ...0 .... .... .... .... = IG bit: Individual address (unicast)             .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)         Source: 00:00:00_00:00:00 (00:00:00:00:00:00)             Address: 00:00:00_00:00:00 (00:00:00:00:00:00)             .... ...0 .... .... .... .... = IG bit: Individual address (unicast)             .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)         Type: IPv6 (0x86dd)     Internet Protocol Version 6, Src: ::1 (::1), Dst: ::1 (::1)         0110 .... = Version: 6             [0110 .... = This field makes the filter "ip.version == 6" possible: 6]         .... 0000 0000 .... .... .... .... .... = Traffic class: 0x00000000             .... 0000 00.. .... .... .... .... .... = Differentiated Services Field: Default (0x00000000)             .... .... ..0. .... .... .... .... .... = ECN-Capable Transport (ECT): Not set             .... .... ...0 .... .... .... .... .... = ECN-CE: Not set         .... .... .... 0000 0000 0000 0000 0000 = Flowlabel: 0x00000000         Payload length: 40         Next header: TCP (0x06)         Hop limit: 64         Source: ::1 (::1)         Destination: ::1 (::1)     Transmission Control Protocol, Src Port: navisphere (2162), Dst Port: netview-aix-5 (1665), Seq: 2997725, Ack: 1, Len: 0         Source port: navisphere (2162)         Destination port: netview-aix-5 (1665)         [Stream index: 3374]         Sequence number: 2997725    (relative sequence number)         Acknowledgement number: 1    (relative ack number)         Header length: 40 bytes         Flags: 0x12 (SYN, ACK)             000. .... .... = Reserved: Not set             ...0 .... .... = Nonce: Not set             .... 0... .... = Congestion Window Reduced (CWR): Not set             .... .0.. .... = ECN-Echo: Not set             .... ..0. .... = Urgent: Not set             .... ...1 .... = Acknowledgement: Set             .... .... 0... = Push: Not set             .... .... .0.. = Reset: Not set             .... .... ..1. = Syn: Set                 [Expert Info (Chat/Sequence): Connection establish acknowledge (SYN+ACK): server port navisphere]             .... .... ...0 = Fin: Not set         Window size value: 32728         [Calculated window size: 32728]         Checksum: 0x3414 [validation disabled]             [Good Checksum: False]             [Bad Checksum: False]         Options: (20 bytes)             Maximum segment size: 16376 bytes             TCP SACK Permitted Option: True             Timestamps: TSval 1588002, TSecr 1588002             No-Operation (NOP)             Window scale: 7 (multiply by 128)         [SEQ/ACK analysis]             [This is an ACK to the segment in frame: 1032722]             [The RTT to ACK the segment was: 0.000023000 seconds]             [TCP Analysis Flags]                 [A segment before this frame was lost]                     [Expert Info (Warn/Sequence): Previous segment lost (common at capture start)]          Date & Time                No.     Time        Source                Destination           Protocol Length Source port Dest port Info     2014-06-25 14:49:48.375958 1032724 1861.492498 ::1                   ::1                   TCP      74     netview-aix-5 navisphere netview-aix-5 > navisphere [RST] Seq=1 Win=0 Len=0          Frame 1032724: 74 bytes on wire (592 bits), 74 bytes captured (592 bits)         Arrival Time: Jun 25, 2014 14:49:48.375958000 EDT         Epoch Time: 1403722188.375958000 seconds         [Time delta from previous captured frame: 0.000008000 seconds]         [Time delta from previous displayed frame: 0.000008000 seconds]         [Time since reference or first frame: 1861.492498000 seconds]         Frame Number: 1032724         Frame Length: 74 bytes (592 bits)         Capture Length: 74 bytes (592 bits)         [Frame is marked: False]         [Frame is ignored: False]         [Protocols in frame: eth:ipv6:tcp]         [Coloring Rule Name: TCP RST]         [Coloring Rule String: tcp.flags.reset eq 1]     Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 (00:00:00:00:00:00)         Destination: 00:00:00_00:00:00 (00:00:00:00:00:00)             Address: 00:00:00_00:00:00 (00:00:00:00:00:00)             .... ...0 .... .... .... .... = IG bit: Individual address (unicast)             .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)         Source: 00:00:00_00:00:00 (00:00:00:00:00:00)             Address: 00:00:00_00:00:00 (00:00:00:00:00:00)             .... ...0 .... .... .... .... = IG bit: Individual address (unicast)             .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)         Type: IPv6 (0x86dd)     Internet Protocol Version 6, Src: ::1 (::1), Dst: ::1 (::1)         0110 .... = Version: 6             [0110 .... = This field makes the filter "ip.version == 6" possible: 6]         .... 0000 0000 .... .... .... .... .... = Traffic class: 0x00000000             .... 0000 00.. .... .... .... .... .... = Differentiated Services Field: Default (0x00000000)             .... .... ..0. .... .... .... .... .... = ECN-Capable Transport (ECT): Not set             .... .... ...0 .... .... .... .... .... = ECN-CE: Not set         .... .... .... 0000 0000 0000 0000 0000 = Flowlabel: 0x00000000         Payload length: 20         Next header: TCP (0x06)         Hop limit: 64         Source: ::1 (::1)         Destination: ::1 (::1)     Transmission Control Protocol, Src Port: netview-aix-5 (1665), Dst Port: navisphere (2162), Seq: 1, Len: 0         Source port: netview-aix-5 (1665)         Destination port: navisphere (2162)         [Stream index: 3374]         Sequence number: 1    (relative sequence number)         Header length: 20 bytes         Flags: 0x04 (RST)             000. .... .... = Reserved: Not set             ...0 .... .... = Nonce: Not set             .... 0... .... = Congestion Window Reduced (CWR): Not set             .... .0.. .... = ECN-Echo: Not set             .... ..0. .... = Urgent: Not set             .... ...0 .... = Acknowledgement: Not set             .... .... 0... = Push: Not set             .... .... .1.. = Reset: Set                 [Expert Info (Chat/Sequence): Connection reset (RST)]             .... .... ..0. = Syn: Not set             .... .... ...0 = Fin: Not set         Window size value: 0         [Calculated window size: 0]         [Window size scaling factor: 128]         Checksum: 0x4eea [validation disabled]             [Good Checksum: False]             [Bad Checksum: False]          Date & Time                No.     Time        Source                Destination           Protocol Length Source port Dest port Info     2014-06-25 14:49:54.376072 1032725 1867.492612 ::1                   ::1                   TCP      94     netview-aix-5 navisphere netview-aix-5 > navisphere [SYN] Seq=0 Win=32752 Len=0 MSS=16376 SACK_PERM=1 TSval=1589502 TSecr=0 WS=128          Frame 1032725: 94 bytes on wire (752 bits), 94 bytes captured (752 bits)         Arrival Time: Jun 25, 2014 14:49:54.376072000 EDT         Epoch Time: 1403722194.376072000 seconds         [Time delta from previous captured frame: 6.000114000 seconds]         [Time delta from previous displayed frame: 6.000114000 seconds]         [Time since reference or first frame: 1867.492612000 seconds]         Frame Number: 1032725         Frame Length: 94 bytes (752 bits)         Capture Length: 94 bytes (752 bits)         [Frame is marked: False]         [Frame is ignored: False]         [Protocols in frame: eth:ipv6:tcp]         [Coloring Rule Name: TCP SYN/FIN]         [Coloring Rule String: tcp.flags & 0x02 || tcp.flags.fin == 1]     Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 (00:00:00:00:00:00)         Destination: 00:00:00_00:00:00 (00:00:00:00:00:00)             Address: 00:00:00_00:00:00 (00:00:00:00:00:00)             .... ...0 .... .... .... .... = IG bit: Individual address (unicast)             .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)         Source: 00:00:00_00:00:00 (00:00:00:00:00:00)             Address: 00:00:00_00:00:00 (00:00:00:00:00:00)             .... ...0 .... .... .... .... = IG bit: Individual address (unicast)             .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)         Type: IPv6 (0x86dd)     Internet Protocol Version 6, Src: ::1 (::1), Dst: ::1 (::1)         0110 .... = Version: 6             [0110 .... = This field makes the filter "ip.version == 6" possible: 6]         .... 0000 0000 .... .... .... .... .... = Traffic class: 0x00000000             .... 0000 00.. .... .... .... .... .... = Differentiated Services Field: Default (0x00000000)             .... .... ..0. .... .... .... .... .... = ECN-Capable Transport (ECT): Not set             .... .... ...0 .... .... .... .... .... = ECN-CE: Not set         .... .... .... 0000 0000 0000 0000 0000 = Flowlabel: 0x00000000         Payload length: 40         Next header: TCP (0x06)         Hop limit: 64         Source: ::1 (::1)         Destination: ::1 (::1)     Transmission Control Protocol, Src Port: netview-aix-5 (1665), Dst Port: navisphere (2162), Seq: 0, Len: 0         Source port: netview-aix-5 (1665)         Destination port: navisphere (2162)         [Stream index: 3374]         Sequence number: 0    (relative sequence number)         Header length: 40 bytes         Flags: 0x02 (SYN)             000. .... .... = Reserved: Not set             ...0 .... .... = Nonce: Not set             .... 0... .... = Congestion Window Reduced (CWR): Not set             .... .0.. .... = ECN-Echo: Not set             .... ..0. .... = Urgent: Not set             .... ...0 .... = Acknowledgement: Not set             .... .... 0... = Push: Not set             .... .... .0.. = Reset: Not set             .... .... ..1. = Syn: Set                 [Expert Info (Chat/Sequence): Connection establish request (SYN): server port navisphere]             .... .... ...0 = Fin: Not set         Window size value: 32752         [Calculated window size: 32752]         Checksum: 0xebbf [validation disabled]             [Good Checksum: False]             [Bad Checksum: False]         Options: (20 bytes)             Maximum segment size: 16376 bytes             TCP SACK Permitted Option: True             Timestamps: TSval 1589502, TSecr 0             No-Operation (NOP)             Window scale: 7 (multiply by 128)      `iptables-save` output:               # Generated by iptables-save v1.3.0 on Thu Jun 26 10:15:33 2014     *filter     :FORWARD ACCEPT [0:0]     :INPUT ACCEPT [675:236200]     :OUTPUT ACCEPT [241:21540]     COMMIT     # Completed on Thu Jun 26 10:15:33 2014


keep aliases when I use sudo bash

I have a Centos 5.5 server that has my own alias commands for my account. When I do "sudo bash" I can still use those aliases, I didn't have to add the aliases to the root bashrc. I have another server that is Centos 6.5. But when I sudo bash it will not use my aliases of the user that I'm logged in as. Does anyone know where I configure it to include the aliases of the user I am logged into when I use sudo bash?


How to discard/TRIM a range in an open file ?

For an SSD, I can open the row device and discard a range of pages using `ioctl()` with `BLKDISCARD` command. My question is for an open file, how to discard a range of data? and Is that depends on the implementation of the underlying filesystem?


Can I create a 2 TB RAID-1 array out of one 2 TB disk and two 1 TB disks while preserving 1 TB of data?

I currently have 1 TB of data on a RAID-1 mdadm array. This array consists of one 1 TB disk and a 1 TB partition on a 2 TB disk. I have now bought a second 1 TB disk, and I would like to use this to create a 2 TB RAID-1 array. The data on this array will be encrypted with dm-crypt, so I want to overwrite each disk with data from `/dev/urandom` before putting data on it. The question is if I can create this 2 TB RAID-1 array, and securely overwrite each disk with random data while preserving the 1 TB of data I have on my current 1 TB RAID-1 array. So to recap: I have 2 x 1 TB disks and 1 x 2 TB disk. I want to create a 2 TB RAID-1 array where one side of the mirror consists of two 1 TB disks pooled together, and the other side of the mirror is the whole 2 TB disk. Also, I want to preserve 1 TB of data using only these disks, while still being able to overwrite each disk with random data.


What is a good way of layering zfs filsystems to manage unpredictable future workload that doesn't severely compromise performance?

I've been playing around with ZFS and using sparse files as virtual devices to learn how to use the zfs tools. It seems that there isn't much of a hit in performance by creating a raid pool out of sparse files which are on top of JBOD filesystems that are located on different devices. So I'm wondering if this is a good way to have a flexible system going forward seen as it's not possible to shrink zfs filesystems. So for example I have four disks. Each one has a single device filesystem on it. I create 4 sparse files, one on each filesystem therefore disk. The load is spread across the devices and they are also providing redundancy. Until the raid array fills, I still have all the rest of the disk space for some things which may not need raid such as temporary bulky files. I expect that there would be a major performance penalty when both types of filesystem would be busy at the same time. Are there some more pros and cons of such an approach?


How to use `cat` or `less` depending on the line count?

When looking at the content of files, I'd like to automatically `cat` short files but `less` those that exceed the screen size. I could use something with `wc -l`, but is there a better way that maybe also considers the window size / current amount of lines available?


Easily unpack DEB, edit postinst, and repack DEB

I'm attempting to install Intel's OpenCL SDK but the DEB files are buggy conversions from RPM (see https://software.intel.com/en-us/forums/topic/515680 for the curious). I need to edit the `postinst` script in the DEB they provide. How can I take an existing DEB, extract the contents (including the control information), then later repackage the contents to make a new DEB? I will only edit files, no files will be added or removed.


What is the most correct way to pass an array to a function?

Consider I have a very large array `$large_list`, is there a way to write a function that will take the array as an argument? For example:               echo_idx_array () {         arr="$1"         idx="$2"              echo "${arr[$idx]}"     }      What is the usual strategy to do something like that? I tried giving the variable `$large_list` but it was empty. I am willing to modify the function to adapt it to any change in the argument list. For the record, I am using ksh88, and I am looking for answers as portable as can be. * * * **EDIT** : So far the best I could come up with is to loop through the array and send each element as an argument to the function. This seems incredibly ugly and error-prone, not to mention that it is bound to hit some limit quickly. Here's what I did:               foo () {         echo $*     }          cmd="foo "     while [[ $i -lt $MAX_ARR_SIZE ]]; do         cmd="$cmd ${large_list[$i]}"         ((i=i+1))     done          eval $cmd      Isn't there something better to do?


Table align in two column page style in IEEEtran latex

I am writing a paper using the IEEEtran class. I need to insert a 3 tables in the top of the 3rd page in the two column page style. my table having 15 columns and 4 rows..... can anybody tell how to do this..... thanks in advance


dpkg: warning: 'ldconfig' not found in PATH or not executable - Ubuntu 12 - Vagrant

I am working on setting up a Vagrant / Puppet install so that new developers can have a clean development environment for our Rails project. The basic Vagrant configure commands are:                 config.vm.box      = 'precise32'       config.vm.box_url  = 'http://files.vagrantup.com/precise32.box'      Overall, the install seems to be going well. I've got RVM, Postgres, and Ruby installed and running. However, whenever I try to install the "Heroku Toolbelt" using this command:               su -l vagrant -c 'wget -qO- https://toolbelt.heroku.com/install-ubuntu.sh | sh'      I run into this problem:               ... Lots of Hits and downloads...     The following extra packages will be installed:       foreman heroku libruby1.9.1 ruby1.9.1     Suggested packages:       ruby1.9.1-examples ri1.9.1 graphviz ruby1.9.1-dev     The following NEW packages will be installed:       foreman heroku heroku-toolbelt libruby1.9.1 ruby1.9.1     0 upgraded, 5 newly installed, 0 to remove and 132 not upgraded.     Need to get 0 B/4,997 kB of archives.     After this operation, 13.1 MB of additional disk space will be used.     dpkg: warning: 'ldconfig' not found in PATH or not executable.     dpkg: warning: 'start-stop-daemon' not found in PATH or not executable.     dpkg: error: 2 expected programs not found in PATH or not executable.     Note: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin.     E: Sub-process /usr/bin/dpkg returned an error code (2)      ( _Note_ ) This happens if I run the command manually after vagrant ssh. Also, the actual shell configuration gets the error when it initially runs. Since this is a vagrant box, it is easy to 'vagrant destroy' and then try again but I get the same issue consistently. The strange thing is, my PATH does definitely include those folders:               echo $PATH     /home/vagrant/.rvm/gems/ruby-1.9.3-p194/bin:/home/vagrant/.rvm/gems/ruby-1.9.3-p194@global/bin:/home/vagrant/.rvm/rubies/ruby-1.9.3-p194/bin:/home/vagrant/.rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/vagrant_ruby/bin      the file 'ldconfig' is in /sbin and is an executable:               cd /sbin     ls -l l*     -rwxr-xr-x 1 root root    465 Apr 20  2012 ldconfig      Same with start-stop-daemon:               -rwxr-xr-x 1 root root 26752 Apr 12  2012 start-stop-daemon      So, not sure what it is really complaining about... Any suggestions? Some permissions issue with Vagrant?


I ran fdisk on a wrong drive. How can I recover

I ran **fdisk** on the wrong HD. I basically cleared partition table, pressed **w** and quited fdisk and only then realized that that was my main harddrive... I got this message: > WARNING: Re-reading the partition table failed with error 16: Device or > resource busy. The kernel still uses the old table. The new table will be > used at the next reboot or after you run partprobe(8) or kpartx(8) Syncing > disks. I looked through /sys/class/block/sdb/sdb* start and size files - I knew that that's were kernel kept old partition offsets and sizes until restart... And here's my table reconstruction.               name  |  startsector  | size, sectors  | type?                     ------------------------------------------------------------          sdb1  |  2048         | 2048           |        sdb2  |  195510270    | 2              |        sdb3  |  4096         | 195504128      | /       sdb5  |  195510272    | 761716736      | /home       sdb6  |  957229056    | 19542016       | swap partition         Here's testing for what type of partition there were:               cr1tter@cr1tterhost:~$ sudo file -s /dev/sdb{1,2,3,5,6}     /dev/sdb1: data     /dev/sdb2: x86 boot sector; partition 1: ID=0x83, starthead 254, startsector 2, 761716736 sectors; partition 2: ID=0x5, starthead 254, startsector 761716738, 19544064 sectors, code offset 0x97     /dev/sdb3: Linux rev 1.0 ext4 filesystem data, UUID=b6d939b9-c197-4513-a1fe-9c614574afb0 (needs journal recovery) (extents) (large files) (huge files)     /dev/sdb5: Linux rev 1.0 ext4 filesystem data, UUID=96f97705-f292-49db-b31d-249fab87d3d7 (needs journal recovery) (extents) (large files) (huge files)     /dev/sdb6: Linux/i386 swap file (new style), version 1 (4K pages), size 2442751 pages, no label, UUID=a5744b72-248c-4ceb-8009-db6351cdc231      I guess I'm confused what **sdb1** and **sdb2** are? I honestly cannot recall what they are.... When I was installing os - I had to specify paths, as in /home, or root path: / - fdisk doesn't seem to allow to do that... P.S> RESOLVED. Thank you Jim Paris! HERE's the transcript of what I've done. I've already rebooted and system is working just as well..!               sudo fdisk /dev/sdb     Command (m for help): p          Disk /dev/sdb: 500.1 GB, 500107862016 bytes     255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors     Units = sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0x000cd649             Device Boot      Start         End      Blocks   Id  System          Command (m for help): n     Partition type:        p   primary (0 primary, 0 extended, 4 free)        e   extended     Select (default p): p     Partition number (1-4, default 1): 1     First sector (2048-976773167, default 2048):      Using default value 2048     Last sector, +sectors or +size{K,M,G} (2048-976773167, default 976773167): +1M          Command (m for help): p          Disk /dev/sdb: 500.1 GB, 500107862016 bytes     255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors     Units = sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0x000cd649             Device Boot      Start         End      Blocks   Id  System     /dev/sdb1            2048        4095        1024   83  Linux          Command (m for help): n     Partition type:        p   primary (1 primary, 0 extended, 3 free)        e   extended     Select (default p): p     Partition number (1-4, default 2): 3     First sector (4096-976773167, default 4096):      Using default value 4096     Last sector, +sectors or +size{K,M,G} (4096-976773167, default 976773167): +95461M          Command (m for help): t     Partition number (1-4): 3     Hex code (type L to list codes): 83          Command (m for help): n     Partition type:        p   primary (2 primary, 0 extended, 2 free)        e   extended     Select (default p): e     Partition number (1-4, default 2):      Using default value 2     First sector (195508224-976773167, default 195508224):      Using default value 195508224     Last sector, +sectors or +size{K,M,G} (195508224-976773167, default 976773167):      Using default value 976773167          Command (m for help): n     Partition type:        p   primary (2 primary, 1 extended, 1 free)        l   logical (numbered from 5)     Select (default p): l     Adding logical partition 5     First sector (195510272-976773167, default 195510272):      Using default value 195510272     Last sector, +sectors or +size{K,M,G} (195510272-976773167, default 976773167): +371932M          Command (m for help): t     Partition number (1-5): 5     Hex code (type L to list codes): 83          Command (m for help): n     Partition type:        p   primary (2 primary, 1 extended, 1 free)        l   logical (numbered from 5)     Select (default p): l     Adding logical partition 6     First sector (957229056-976773167, default 957229056):      Using default value 957229056     Last sector, +sectors or +size{K,M,G} (957229056-976773167, default 976773167): +9542M          Command (m for help): t     Partition number (1-6): 6     Hex code (type L to list codes): L           0  Empty           24  NEC DOS         81  Minix / old Lin bf  Solaris              1  FAT12           27  Hidden NTFS Win 82  Linux swap / So c1  DRDOS/sec (FAT-      2  XENIX root      39  Plan 9          83  Linux           c4  DRDOS/sec (FAT-      3  XENIX usr       3c  PartitionMagic  84  OS/2 hidden C:  c6  DRDOS/sec (FAT-      4  FAT16 <32M      40  Venix 80286     85  Linux extended  c7  Syrinx               5  Extended        41  PPC PReP Boot   86  NTFS volume set da  Non-FS data          6  FAT16           42  SFS             87  NTFS volume set db  CP/M / CTOS / .      7  HPFS/NTFS/exFAT 4d  QNX4.x          88  Linux plaintext de  Dell Utility         8  AIX             4e  QNX4.x 2nd part 8e  Linux LVM       df  BootIt               9  AIX bootable    4f  QNX4.x 3rd part 93  Amoeba          e1  DOS access           a  OS/2 Boot Manag 50  OnTrack DM      94  Amoeba BBT      e3  DOS R/O              b  W95 FAT32       51  OnTrack DM6 Aux 9f  BSD/OS          e4  SpeedStor            c  W95 FAT32 (LBA) 52  CP/M            a0  IBM Thinkpad hi eb  BeOS fs              e  W95 FAT16 (LBA) 53  OnTrack DM6 Aux a5  FreeBSD         ee  GPT                  f  W95 Ext'd (LBA) 54  OnTrackDM6      a6  OpenBSD         ef  EFI (FAT-12/16/     10  OPUS            55  EZ-Drive        a7  NeXTSTEP        f0  Linux/PA-RISC b     11  Hidden FAT12    56  Golden Bow      a8  Darwin UFS      f1  SpeedStor           12  Compaq diagnost 5c  Priam Edisk     a9  NetBSD          f4  SpeedStor           14  Hidden FAT16 <3 61  SpeedStor       ab  Darwin boot     f2  DOS secondary       16  Hidden FAT16    63  GNU HURD or Sys af  HFS / HFS+      fb  VMware VMFS         17  Hidden HPFS/NTF 64  Novell Netware  b7  BSDI fs         fc  VMware VMKCORE      18  AST SmartSleep  65  Novell Netware  b8  BSDI swap       fd  Linux raid auto     1b  Hidden W95 FAT3 70  DiskSecure Mult bb  Boot Wizard hid fe  LANstep             1c  Hidden W95 FAT3 75  PC/IX           be  Solaris boot    ff  BBT                 1e  Hidden W95 FAT1 80  Old Minix           Hex code (type L to list codes): 82      Changed system type of partition 6 to 82 (Linux swap / Solaris)               Command (m for help): a     Partition number (1-6): 1               Command (m for help): p          Disk /dev/sdb: 500.1 GB, 500107862016 bytes     255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors     Units = sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0x000cd649             Device Boot      Start         End      Blocks   Id  System     /dev/sdb1   *        2048        4095        1024   83  Linux     /dev/sdb2       195508224   976773167   390632472    5  Extended     /dev/sdb3            4096   195508223    97752064   83  Linux     /dev/sdb5       195510272   957227007   380858368   83  Linux     /dev/sdb6       957229056   976771071     9771008   82  Linux swap / Solaris          Partition table entries are not in disk order          Command (m for help): w     The partition table has been altered!          Calling ioctl() to re-read partition table.          WARNING: Re-reading the partition table failed with error 16: Device or resource busy.     The kernel still uses the old table. The new table will be used at     the next reboot or after you run partprobe(8) or kpartx(8)     Syncing disks.


place the aliased version of an existing command in /usr/bin/

I use **Vim** a lot, and I know how I can start vim in insert mode. So I have an alias named `vii` in my `.bash_aliases` file. On other hand I use **Git** a lot too, and I have this line in my `.gitconfig`:               [core]         editor = vi      To write a commit message the vi editor is opened every time and I have to go in insert mode. So I thought of replacing `vi` with `vii`, and did. But the problem is when I do `git commit`, instead of opening the vim in insert mode, it gives this error:               error: cannot run vii: No such file or directory     error: There was a problem with the editor 'vii'.     Please supply the message using either -m or -F option.      This makes clear that git does not looks to `.bash_aliases` file, even it isn't related to bash in any way. It does directly looks if there is `/usr/bin/vii` or not. And executes it if it is. ### The Question Can I place the aliased version of vi as `vii` in `/usr/bin/`? _(and please don't suggest me to use`git commit -m "<commit message>"`. There are other situation where I need vim in insert mode.)_


Merge multiple flv files?

What tool in Linux can I use to merge multiple flv files ? Files are already in order, just put them altogether seamlessly


How to chmod without /usr/bin/chmod?

Today I was told a tale by a Unix trainer, a tale where the root password got leaked to the students, and one of the fellas removed the execute permission from /usr/bin/chmod itself. How do you recover chmod in this case and make it executable again? Let's say getting it from an external source or recompiling it is not a preferable option, is there some smart hack that can recover this chmod itself? Note that this happened a long time ago and I'm not looking for a solution for some current problem, just curious about what ways Unix provides us around such an issue.


is squid 2.x configuration still roughly the same as for squid 3.x?

I have the o'reilly squid book which covers squid 2.x - will this book still be useful for me to configure squid 3.x, or has too much changed between the versions? Is there any documentation describing the configuration differences between 2.x and 3.x?


Multiple SSH tunnels (local and remote forwarding) over one master OpenSSH connection? Good idea?

The question Using an already established SSH channel has an answer that intrigued me. It suggests that I can reuse an existing SSH connection. However, after further reading, I see that this solution may not work in my case (multiple tunnels at the same time). I'm using OpenSSH_5.9p1 Debian-5ubuntu1.1, OpenSSL 1.0.1 14 Mar 2012 (on Kubuntu 12.04). Here is what I'm currently doing in a bash script:               echo "establishing SSH tunnel for SFTP && opening Dolpin with SFTP connection to remote computer..."     ssh -i "$ID_RSA" "$MIDDLEMAN_USER@$MIDDLEMAN_SERVER" -fL $PORT_NUMBER:localhost:$PORT_NUMBER sleep 20; dolphin sftp://HostSftp:$PORT_NUMBER &          echo "establishing SSH tunnel for VNC && connecting to VNC server for remote desktop support..."     sudo ssh -fL 5901:localhost:$VNC_PORT_NUMBER -i "$ID_RSA" "$MIDDLEMAN_USER@$MIDDLEMAN_SERVER" sleep 20; vncviewer localhost:5901      My concerns (why I think this might not work for me) include things like this: > A negative to this is that some uses of ssh may fail to work with your > multiplexed connection. Most notably commands which use tunneling like git, > svn or rsync, or forwarding a port. Source and this: > If you use LocalForward or RemoteForward in your configuration file, you > might run into a subtle problem. ... SSH1 ( **but not OpenSSH** ) provides a > solution. Source I'm looking for clarification as well as instruction:   1. Can I establish the two tunnels above with one master connection?   2. Will this be as reliable as establishing separate connections?   3. If yes to both the above, how do I do it? Thanks


How to load Facebook chat history in KDE Telepathy?

I've started using IM client for lower bandwidth usage - no images and other stuff. However, a lot of people writing me refers to context written in older posts. Therefore I've got to go to facebook's site and load all unnecessary stuff... So I would like to load few older messages when I open chat window. Is it somehow possible?


Passing values to a parameter in script

Following is the script to copy all libraries of a certain command to make my chroot environment. For example: `./cplb.sh /bin/ls` will copy all the libraries of `ls` command (i.e., the files listed by `ldd /bin/ls` command). **cplb.sh**               CHROOT='/var/chroot'     mkdir $CHROOT          for i in $( ldd $* |cut -d " " -f3 |sort |uniq)     do     cp --parents $i $CHROOT     done          echo "Chroot jail is ready. To access it execute: chroot $CHROOT" Now, when I run `./cplb.sh /bin/ls` it works like a charm. But when I run it for multiple commands at the same time, for example: `./cplb.sh /bin/{ls,cat}` it throws an error saying:               cannot stat : '/bin/ls:' file or dir not found     cannot stat : '/bin/cat:' file or dir not found      I can see a colon after the command, i.e., `/bin/ls:` and that colon causes the error. Now, where does it come from and how to resolve this, so that I can run the script for multiple commands at the same time?


linux command to check POSIX message queue

We can check the details of system V message queue with the help of `ipcs`command. Is there any command to check POSIX message queue in Linux?


Transfering files using ssh

I've found the following command pretty convenient for transferring files to servers I have ssh access to:               cat myfile.txt | ssh my.host.edu "cat > myfile.txt"      Is there a similarly convenient command for bringing files to my local computer? If it would make it any easier, I don't mind installing command line utilities from the standard Ubuntu repos.


Cups configuration does not consider my new PPD driver (Debian Wheezy)

My Brother HL-4040CN is very unpredictible when trying to print images or PDFs. Searching around, I found an accurate driver description file at openprinting.org: http://www.openprinting.org/printer/Brother/Brother- HL-4040CN I downloaded it to /usr/lib/cups/driver and, using cups admin console, I tried to change the driver of my printer. Unfortunately, even when deleting/recreating the printer, cups is putting back the default driver: Brother HL-4040CN Foomatic/pxlcolor (recommended) (color, 2-sided printing) Do you have any suggestion to solve my printing issue ?


how to execute lines coming from a grep result?

I've got a text file with certain installation instructions, and I know I can grep for a unique occurrence in the file. For example, the text file has something like:               MYDIR=`find /home/user -name somedir`     export PERL5LIB=$PERL5LIB:$MYDIR      In bash, how can I execute the lines after a grep in the file? Something like:               execute result from "grep somedir INSTALLFILE"     execute result from "grep 'export PERL5LIB' INSTALLFILE"


iptables port-mirroring

I need to be able to get a copy of packets received on port 8001 to port 8002. I have tried the following but I get an error that --tee is undefined.               sudo iptables -t nat -A PREROUTING -p TCP -s 127.0.0.1 --sport 8001 -j DNAT --to-destination 127.0.0.1:8002 --tee


Howto create a permanent client connection with netcat?

I'm writing a bash script that constantly read a folder in a loop to send data to a server at a defined time interval. I'm using netcat as the tool to connect to the server and send the data. My pseudo code would look like:               while true     do         read_folder()         process_data() > result.txt         cat result.txt > netcat ip port         wait 10 sec     done      My only problem is that in the scenario the client connects and disconnects the TCP/IP connection to the server every time. I would prefer to establish the connection at the start of the script and close it at the end. Is there any way this could be done with command line tools in a bash script?


Forcing the system to allow me to insert any character in the file name

I had an exam this week, and one of the questions was (with one correct answer): > The file name can contain the character: > > a) `\` > > b) `/` > > c) `?` > > d) `!` I chose `c) ?` because it looked OK to me. When I came home I tested it on my machine (Ubuntu 14.04) and the file was created successfully. In the ready reckoner the correct answer is marked to be `d) !`. I knew that the exam was Windows specific, but on the test paper the platform was not specified. * * * It's clear that `\` and `/` characters are not supported in a file name, **BUT** is there any way to force the operating system to allow them? It would be really cool to proove that even `\` and `/` characters are supported.


Gnome3-like alternatives

Since I discovered gnome3-shell I really appreciated the different Dekstop- type to work with, and I'm still using it. But, I'm battery-addict (using a laptop) and I'm feeling poor performances and less support with Gnome3, consuming too resources, such as long loadings of little programs and some laggy animations, the Arandr that resets to default everytime the layout for the dual-monitor, and the plug-ins that are no more developed. So my question is: is there a Gnome3-like DE solution? or what would you suggest for me? I am using the Gnome-shell because I like the multiple and dynamic multi- desktop creation and easy managing of multiple monitors without any configuration-writing. Also, I tried KDE once, but it is pretty hard to understand the usage, and I had some graphic glithces.


What does this "general protection fault" in my console mean, and how do I interpret it?

I had a couple of consoles open for other work and when I came back to them they both contained the following:               Message from syslogd@Stacey-Windows at Jun 19 09:43:28 ...          kernel:[ 4375.127165] general protection fault: 0000 [#1] SMP           Message from syslogd@Stacey-Windows at Jun 19 09:43:28 ...     kernel:[ 4375.127311] Stack:          Message from syslogd@Stacey-Windows at Jun 19 09:43:28 ...     kernel:[ 4375.127330] Call Trace:          Message from syslogd@Stacey-Windows at Jun 19 09:43:28 ...     kernel:[ 4375.127423] Code: 00 00 89 44 24 24 c7 44 24 30 04 00 00 00 c7 44 24 34 6c 00 00 00 48 89 4c 24 38 e8 e1 fa ff ff 85 c0 78 03 8b 04 24 48 83 c4 48 <c3> 48 83 ec 38 8b 07 48 8b 7f 08 48 89 54 24 24 ba 30 00 00 00       This looks like an exception has been thrown somewhere in my os, I gather it's a stacktrace of some kind. The code looks like a hexdump of something. What exactly is this and is there anything I can do with this information to know exactly what went wrong/where? What is it used for? EDIT: I just took a look at `/var/log/messages` and got this:               Jun 19 09:43:28 Stacey-Windows kernel: [ 4375.127227]      Jun 19 09:43:28 Stacey-Windows kernel: [ 4375.127241] Pid: 4462, comm: vivado Tainted: G           O 3.2.0-4-amd64 #1 Debian 3.2.51-1 innotek GmbH VirtualBox/VirtualBox     Jun 19 09:43:28 Stacey-Windows kernel: [ 4375.127247] RIP: 0010:[<ffffffffa02a0876>]  [<ffffffffa02a0876>] vboxCallCreate+0x7e/0x7f [vboxsf]     Jun 19 09:43:28 Stacey-Windows kernel: [ 4375.127259] RSP: 0018:ffff88019ab47be0  EFLAGS: 00010292     Jun 19 09:43:28 Stacey-Windows kernel: [ 4375.127263] RAX: 0000000000000000 RBX: ffff88019ab47c7c RCX: 00000000000018fb     Jun 19 09:43:28 Stacey-Windows kernel: [ 4375.127267] RDX: 0000000000000041 RSI: ffff88007131f540 RDI: 0000000000000000     Jun 19 09:43:28 Stacey-Windows kernel: [ 4375.127271] RBP: ffff88019a974000 R08: 00000000ffffffff R09: 00000000ffffffff     Jun 19 09:43:28 Stacey-Windows kernel: [ 4375.127275] R10: ffffffff81600000 R11: ffffffff81600000 R12: ffff88019ab47e78     Jun 19 09:43:28 Stacey-Windows kernel: [ 4375.127279] R13: ffff88012c06c500 R14: ffff88019b84a180 R15: ffff88012c06f300     Jun 19 09:43:28 Stacey-Windows kernel: [ 4375.127283] FS:  00007f76b998d700(0000) GS:ffff8801a2c00000(0000) knlGS:0000000000000000     Jun 19 09:43:28 Stacey-Windows kernel: [ 4375.127288] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b     Jun 19 09:43:28 Stacey-Windows kernel: [ 4375.127291] CR2: 0000000731c95000 CR3: 000000019860a000 CR4: 00000000000006f0     Jun 19 09:43:28 Stacey-Windows kernel: [ 4375.127298] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000     Jun 19 09:43:28 Stacey-Windows kernel: [ 4375.127303] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400     Jun 19 09:43:28 Stacey-Windows kernel: [ 4375.127307] Process vivado (pid: 4462, threadinfo ffff88019ab46000, task ffff880198dd0930)     Jun 19 09:43:28 Stacey-Windows kernel: [ 4375.127314]  33d59c00137905a4 33d59c00137905a5 33d59c00137905a5 001041ed137905a5     Jun 19 09:43:28 Stacey-Windows kernel: [ 4375.127320]  000003e800000002 00000002000003e8 00e6017800000801 0000000000000000     Jun 19 09:43:28 Stacey-Windows kernel: [ 4375.127325]  0000000000000000 0000000000000000 0000000000000000 0000000000000000     Jun 19 09:43:28 Stacey-Windows kernel: [ 4375.127338]  [<ffffffffa029f009>] ? sf_inode_revalidate+0x78/0xae [vboxsf]     Jun 19 09:43:28 Stacey-Windows kernel: [ 4375.127346]  [<ffffffff8110a5c7>] ? dput+0x27/0xee     Jun 19 09:43:28 Stacey-Windows kernel: [ 4375.127352]  [<ffffffff8110b5ac>] ? __d_lookup+0x3e/0xce     Jun 19 09:43:28 Stacey-Windows kernel: [ 4375.127358]  [<ffffffff8110252c>] ? path_to_nameidata+0x19/0x3a     Jun 19 09:43:28 Stacey-Windows kernel: [ 4375.127364]  [<ffffffffa029f055>] ? sf_dentry_revalidate+0x16/0x20 [vboxsf]     Jun 19 09:43:28 Stacey-Windows kernel: [ 4375.127370]  [<ffffffff81103223>] ? walk_component+0x28f/0x406     Jun 19 09:43:28 Stacey-Windows kernel: [ 4375.127376]  [<ffffffff81104fe2>] ? do_last+0x108/0x58d     Jun 19 09:43:28 Stacey-Windows kernel: [ 4375.127381]  [<ffffffff81105a5f>] ? path_openat+0xce/0x33a     Jun 19 09:43:28 Stacey-Windows kernel: [ 4375.127386]  [<ffffffff81105d8d>] ? do_filp_open+0x2a/0x6e     Jun 19 09:43:28 Stacey-Windows kernel: [ 4375.127393]  [<ffffffff8134deec>] ? _cond_resched+0x7/0x1c     Jun 19 09:43:28 Stacey-Windows kernel: [ 4375.127400]  [<ffffffff811b41f9>] ? __strncpy_from_user+0x18/0x48     Jun 19 09:43:28 Stacey-Windows kernel: [ 4375.127407]  [<ffffffff8110eb13>] ? alloc_fd+0x64/0x109     Jun 19 09:43:28 Stacey-Windows kernel: [ 4375.127413]  [<ffffffff810f9d59>] ? do_sys_open+0x5e/0xe5     Jun 19 09:43:28 Stacey-Windows kernel: [ 4375.127419]  [<ffffffff81354212>] ? system_call_fastpath+0x16/0x1b     Jun 19 09:43:28 Stacey-Windows kernel: [ 4375.127455]  RSP <ffff88019ab47be0>     Jun 19 09:43:28 Stacey-Windows kernel: [ 4375.127551] ---[ end trace 7aaadecc7e737e8f ]---      So there's a vivado in there - it's one of the applications I use, and there's a vbox in there. I'm running debian (and vivado) in virtualbox. Is this something I should be worried about? Is this something I can fix? Linux details: Debian Wheezy 7.0 64-bit


Can "find" command preserve access-time

I'm running the following command which is supposed to find specific directories according to their Access-Time metadata detail however for some reason the find command changes the access time of these directories.               find /my/directory/ -mindepth 3 -maxdepth 3 -atime +2 -type d      Every time the above command runs it changes the access-time of the directories to the time in which it was executed. I couldn't find any option for the "find" command that speaks of preserving metadata. Any ideas here would be greatly appreciated. Thanks!


Create a user that can only connect to a specific directory

I've created a SSH folder for some friends. I've created the users to log in via SSH, but they connect to `~` how can I set to which folder they can connect? I have a directory called /usbdrv/ which point to my usb Drive. PS: They can't go then in the parent directory.


Boot 32-bit OS from 64-bit GRUB2

I can't believe nobody has asked this already, but... If I've installed a 64-bit version of GRUB v2, is it supposed to be possible to load a 32-bit Linux kernel? Or will it only load a 64-bit one? Is this something that's supposed to work? Or is this effort doomed to failure?


How to change default syntax-highlighting for header-file in Kate

Often I have to open header-files (with ending .h) in **Kate**. The default syntax-highlighting with which these files will be opened is always `C++`. How could this be changed to `Fortran` so that I don't have to switch manually? **Edit1:** I already added a `*.h;` to the list of extensions in fortran.xml under               ~/.kde/share/apps/katepart/syntax/      but this doesn't help. `*.h;` is also included in several other `XML`-files in the upper directory. By the way: The priority in both files `cpp.xml` and `fortran.xml` is `9`. **Edit2:** I tested the modifications on the `XML`-files always by restarting **Kate** with the same files. Here, I see no changes. But, if I close an re-open the same files, it works.


Can I get the ffmpeg command-line from an existing video?

I want to generate a video with the exact same settings as an existing video. I can run:               ffmpeg -i original.mp4      To get human-readable info about the contents:               Duration: 00:05:32.32, start: 0.000000, bitrate: 474 kb/s       Stream #0.0(und): Video: h264, yuv420p, 480x360, 25 tbr, 25 tbn, 50 tbc       Stream #0.1(und): Audio: aac, 44100 Hz, stereo, s16      But what I'd like is to get the command-line I'd need to convert another video into the exact same format, so something like:               ffmpeg -i source.mp4 -vcodec h264 - ....      Any ideas if such a thing is possible?


vim script: how to change "put =" to an append?

I'm trying to hack the c-vim plugin because I don't like the way it inserts comments. I want this:               /* comment */      but it gives me this:               /* comment      */      I'm sure it has its reasons, but I don't like it. So I'm digging through the c.vim file and I've found this:               function! C_CodeComment( mode, style )        if a:mode=="a"          if a:style == 'yes'            silent exe ":s#^#/\* #"            silent put = ' */'          else            silent exe ":s#^#//#"          endif        endif        if a:mode=="v"          if a:style == 'yes'            silent exe ":'<,'>s/^/ \* /"            silent exe ":'< s'^ '\/'"            silent exe ":'>"            silent put = ' */'          else            silent exe ":'<,'>s#^#//#"          endif        endif      endfunction      I have not been able to find any documentation on the `put =` statement, which I'm pretty sure is the one I have to change in order to get vim to append `*/` to the last line of the comment. Can anyone point me in the right direction, please?


Do we have an undo in Linux?

I renamed a few files in one batch script. Is there a way to undo the changes without having to rename them back? Does Linux provide some native way of `undo`ing?


Linux device-mapper & ext4: what happens when the COW table fills up?

Consider the following scenario:   * I use Linux device mapper to create a snapshot of an ext4 file system.   * The snapshot is mounted as read-only; the source volume is mounted as read-write.   * I read the snapshot, and simultaneously write (too much) to the source volume. Eventually, the copy-on-write table fills up. Now exactly what happens _in practice_ from the user's perspective? What kind of messages should I expect to see in dmesg? How do the applications that read the snapshot behave? Has someone actually tried this to see what would happen?


How to enable two finger scrolling without trackpad options?

I just installed Katya (linux mint 11) on my new Dell Inspiron 15R, and in Windows, my mouse supports multitouch (two finger scroll, three finger swipe, etc.). I have checked `Preferences->Mouse` and there is supposed to be a `Touchpad`, or similar section, but there is no such section available. Sidescrolling works, but I am unable to find any trackpad/touchpad specific settings. Anyone have a solution? **EDIT:** for clarification, i am dual booting Win7 and Mint in separate partitions on the same machine.


Toggle going to sleep when laptop lid closes?

I'm running Fedora 15 Gnome on a laptop. I can't seem to find an option to toggle if the laptop goes to sleep when the lid closes. There are certain times where I want to put the laptop away or close it but still have it do some crunching on some long running task Is there a place to toggle this option?


Can I have my own version control system?

In the linux/unix machine I am using, I am just a normal user. However, I want a version control system to manage my files to prevent accidental delete/rename/lost/modification. Obviously I don't have the right to install a version control into the machine. Do we have a portable version of such version control system? Most likely I use AIX. or Red Hat Linux.


Removed GNOME desktop, cannot connect to internet from terminal

I'm using Fedora 19. I removed my GNOME-Desktop (`sudo yum remove @gnome- desktop`). After that when I try to connect to internet from command line i'm facing all sorts of issues.. Ethernet cable is also connected however when i execute               $ ping www.google.com      returns               connect: Network is unreachable      When I try to execute commands like `wifi-menu` or `netctl`, i'm getting error that               $ bash: command not found      Any idea on how to resolve this...


Automount EncFS unit

How can I automount an EncFS unit at login/start my session? I use Fedora 20 and KDE. Please don't mention apps like Cryptkeeper and so. I would rather console solutions.


How to take the log of the patches we applied?

So here's my question I recently downloaded the linux kernel patch 3.4.101 and i applied this patch directly to the base 3.4.0 with this command:               $ cd /kernel source directory     $ gzip -cd ../path to patch/patch-3.4.101 | patch -p1      And I got some failed hunks… but since the patch was too large I was not able to analyze all the hunks and rejections… so here goes my main question: How can I get the complete log of this patching process?


can initramfs be paged out to swap disk?

I am using `initramfs` to boot Centos via PXE. The `initramfs` used memory is listed within the "cached" value in `/proc/meminfo` or via `free`. Since I need to calculate performance data, I need to know whether the memory used by the `initramfs` is reclaimable (i.e. can be swapped out to disk) or not. Typically only a very small part of the `/` filesystem tree is actually in use, so a majority of the `initramfs` could be swapped out. Reading on this i got conflicting information. Some sources claimed that `initramfs` behaves like `initrd` and is based on `ramfs`, which means claimed memory cannot be paged out to swap. Other sources claim that `initramfs` is essentially `tmpfs` which in turn would imply that it can be paged out to swap. Which is true? Can the unused parts of the `initramfs` filesystem be paged out to swap space?


How to test that my server is indeed in 1gbps connection?

I ordered a server and the host say I got 1gbps connection However, because I set up the server incorrectly, the speed drop to 10mbps I think now it has been fixed. But I want to make sure. This is what my host told me > It has nothing to do with FDCServers in particular.. Its an issue that > sometimes can occur when a NIC on a computer negotiates it's speed with a > switch. It's something that can happen from time to time and part of basic > troubleshooting. > > If you are running linux you can type run the commands man ethtool or man > mii-tool > > And if you'd like to learn about basic network information. I'm sure a quick > google search can provide some information.


add .pdf to the end of text in a text file - bash

#!/bin/bash     #read the text line by line and cut off the extension     while read filenames ; do         dataset=$filenames         nameis=${dataset%.*}         echo "$nameis" >> /infanass/dev/admin/test/parsed.txt     done < /infanass/dev/admin/test/tobeparsed.txt #location where file names w/ extensions are           while read line ; do         grep "^$line$" /infanass/dev/admin/test/parsed.txt >>matches.txt     done < /infanass/dev/admin/test/file1.txt      I compare my text between the two files and if they match they get sent to the matches.txt The values that get sent to matches.txt have no extensions (just names) i want to add .pdf to all of them when they get sent to the matches.txt Does anybody have an idea?


What's the difference between 'no caching page mode present' and 'assuming drive cache. write through.'

Post-POST, post-BIOS screen, post-GRUB; when I boot Debian with a SD card or USB stick plugged in, one of the _first_ things to pop up on the screen (so quickly that usually I don't even notice) looks a little something like:               [sdX] no caching page mode present      text, text, X starts about halfway through that long list of stuff, the text gets noticeably smaller, and just before the window manager starts, I see the very familiar device message (isn't that what `dmesg` stands for, anyhow?)               [sdX] assuming drive cache. write through      So, technically speaking, what's the difference between those two states? What's being cached? What's the page? What's 'writing through'? And what precludes the assumption of drive cache so that the writing through can happen, directly following boot?


Run a command for a specified time and then abort if time exceeds

I want know how I can run a command for a specified time say, one minute and if it doesn't complete execution then I should be able to stop it.


Is there a way to call a command with a set time limit and kill it when that time passes?

> **Possible Duplicate:**   >  Run a command for a specified time and then abort if time exceeds I was working on a continuos integration build script when a need for such a command arose. Basically put, I need to launch a command with a set time limit for it to run before it gets killed and all of the proceeding commands should immediately be run once this command launches the time -limited process in the background and not wait for it get to be killed. A sort of asynchronous concurency. Here's what I imagine:               timelimited --limit=10 'somecommand --someoptions'     someothercommand //This gets launched immediately once 'timelimited' is done creating the background process


How to cat a file for a certain number of seconds?

> **Possible Duplicate:**   >  Run a command for a specified time and then abort if time exceeds Looked all over and I can't find the answer... Simple question: How can I cat a large file for, lets say, 45 seconds and output it to the screen or redirect to another file. Thanks!


How do I get the nc command to end after 2 seconds?

I have to write a maintenance script that iterates over our IPs testing their connectivity to certain services such as `nc -sip# mailin-01.mx.aol.com 25`. It has a flag `-w ...` but it's not what I think it is. That is, I only want this program to run for at max 3 seconds and the places we are connecting to are always up (unless major network problems that the script shouldn't worry about --- not its particular job and would be noticed before the script is run). I just need it to connect and see if we are getting an error message. This is required before we assign an IP to a user for their web page (this is an alternative to CPanel stuff -- we want our own).


Bash nested command substitution not working

Hi I have a bash script that intend to run via `watch ./script.sh` It's to debug a cooling problem with my laptop, however the script I wrote isn't working as intended. I'm quite new to bash scripting so I'm sure its something simple. I have a line in my script that has a nested command substitution but the inner command doesn't appear to work or at least it looks like the inner command doesn't know the value of `$i`. Any help appreciated. here's the script:               echo "THERMAL ZONE 2:"     echo "Cur Temp: $(cat /sys/class/thermal/thermal_zone2/temp)"          for i in {2..7}     do     echo "cooling_device$i STATE: $(cat /sys/class/thermal/thermal_zone2/cdev$i/cur_state) TRIP POINT TEMP: $(cat /sys/class/thermal/thermal_zone2/trip_point_$(cat /sys/class/thermal/thermal_zone2/cdev$i_trip_point)_temp)"     done      and heres the output:               THERMAL ZONE 2:     Cur Temp: 43000     cat: /sys/class/thermal/thermal_zone2/cdev: No such file or directory     cat: /sys/class/thermal/thermal_zone2/trip_point__temp: No such file or directory     cooling_device2 STATE: 1 TRIP POINT TEMP:      cat: /sys/class/thermal/thermal_zone2/cdev: No such file or directory     cat: /sys/class/thermal/thermal_zone2/trip_point__temp: No such file or directory     cooling_device3 STATE: 1 TRIP POINT TEMP:      cat: /sys/class/thermal/thermal_zone2/cdev: No such file or directory     cat: /sys/class/thermal/thermal_zone2/trip_point__temp: No such file or directory     cooling_device4 STATE: 0 TRIP POINT TEMP:      cat: /sys/class/thermal/thermal_zone2/cdev: No such file or directory     cat: /sys/class/thermal/thermal_zone2/trip_point__temp: No such file or directory     cooling_device5 STATE: 0 TRIP POINT TEMP:      cat: /sys/class/thermal/thermal_zone2/cdev: No such file or directory     cat: /sys/class/thermal/thermal_zone2/trip_point__temp: No such file or directory     cooling_device6 STATE: 0 TRIP POINT TEMP:      cat: /sys/class/thermal/thermal_zone2/cdev: No such file or directory     cat: /sys/class/thermal/thermal_zone2/trip_point__temp: No such file or directory     cooling_device7 STATE: 0 TRIP POINT TEMP:


Printing failure in Linux Mint 13

I installed Mint 13, 64-bit, Cinnamon, and have a Canon ImageClass MF4150 printer. I retrieved and installed the drivers. I added the printer and tried to print a test page. The message said "printing", then "printing completed." However, nothing printed. I used the following commands to install drivers:               dpkg -i cndrvcups-common_2.40-2_amd64.deb          dpkg -i cndrvcups-ufr2-us_2.40-2_amd64.deb Then I add the printer in Printer settings. I also add myself as an allowed user. Then I tried printing a test page and got a message saying "Printing test page on MF4100 series". After about 2 seconds I get a message saying "Printing completed ..." but nothing prints. What am I doing wrong?


Applications grabing ALSA exlusively

So, my second question about linux audio on the site. The previous one generated quite a lot introductory information. I have `ALSA` and `PulseAudio` installed.   * Before installing PulseAudio, no audio cards were being detected in the graphical "Sound" panel. And now, under "Applications" I see listed `ALSA plug-in(firefox)`. Why do I need PulseAudio to detect the sound card and to play through ALSA?   * `alsamixer` does not work - muting the master has no effect. Furthermore, only one application can play simultaniously - starting a second one reports `device busy`.  So my software mixing is not working. How do I fix it. How do I trace what path take the signals from the applications to the hardware? Note" the audio is being streamed through USB. `alsamixer` sais `no options for ths device` and the controls that I was modifying apper to be the motherboard soundcard's.


Is NetworkManager itself capable of creating a new Wifi connection?

Manual pages of NetworkManager mentions that it "manages Wifi network interfaces", however it does not say whether it can create new Wifi connections. NetworkManager applet appears to be able to create new Wifi connections, however NetworkManager CLI manual does not mention anything about Wifi. Thus adding more to my confusion. So after all, what functions does NetworkManager provide in "managing Wifi network interfaces"? Does NetworkManager rely on other programs to create new Wifi connections?


Reroute one URL

I am looking to reroute one particular URL to another, for example : `http://website.com/page1.html` to `http://website.com/page2.html` on a third party server only on my machine. But I still want it to reply as if it was page1.html. Is there a way to do that on a client UNIX ? Alex PS : If any clarification is required, please tell me


Copy a File From One Zip to Another?

I have a file named `'sourceZip.zip'` This file (`'sourceZip.zip'`) contains two files: `'textFile.txt'` `'binFile.bin'` * * * I also have a file named `'targetZip.zip'` This file (`'targetZip.zip'`) contains one file: `'jpgFile.jpg'` * * * In linux, what bash command shall I use to copy both files (`'textFile.txt'`, `'binFile.bin'`) from the source archive (`'sourceZip.zip'`) straight into the second archive (`'targetZip.zip'`), so that at the end of the process, the second archive (`'targetZip.zip'`) will include all three files? (ideally, this would be done in one command, using 'zip' or 'unzip')


difference between signalfd and sigwaitinfo?

I went through examples and man page but couldn't figure out difference between signalfd and sigwaitinfo Apart from syntax both are doing same thing i.e. waiting for signal storing it details into some structure. in man page it is written. This provides an alternative to the use of a signal **handler or sigwaitinfo(2), and has the advantage that the file descriptor may be monitored by select(2), poll(2), and epoll(7).** Can anyone please explain me what does it exactly means?


Don't expand command line mapping (cmap) until pressing enter in vim

I have               cmap w!! %!sudo tee > /dev/null %      in my `.vimrc`. When I type a `w` while writing in the vim command line (after `:`), the cursor stays over the `w` for a few seconds before moving right. This sometimes breaks my train of thought and confuses me for a few seconds. Is there a way to make the mapping happen when pressing enter after the command so that it doesn't temporarily "eat" the `w` every time I press it? (Incidentally, this mapping also makes `w!!` expand when I'm typing a search query which isn't annoying in practice (except for the fact that the `w` is similarly delayed) but seems strange.)


Is there a way to list the connected devices on my wifi access point?

I have an Angstrom Linux device acting as an access point, running `hostapd`, `dhcpd`, which works fine. Can I get a list of devices connected to the Wi-Fi? I know I can get the DHCP leases, but I need to know which devices connect through `wlan0`. I've tried this (`iwlist` has options):               iwlist wlan0 ap     iwlist wlan0 accesspoints     iwlist wlan0 peers      but all return:               wlan0     Interface doesn't have a list of Peers/Access-Points      `iwconfig`, `iwgetid`, `iwpriv` and `iwspy` are also present in `/sbin`, but don't seem to have options to display the client list.


Exiting block insert mode with Ctrl-C

In vim, if you are in block insert mode (`Ctrl-V, Shift-I`) and exit using `Ctrl-C` (instead of `Esc`), it cancels the block edit (and only edits the first row). Why is this? In almost all other contexts, `Ctrl-C` and `Esc` are synonymous. (And ideally there's a way to fix this -- I've now gotten used to doing `Ctrl-C` and it would be a shame if I had to relearn…)


How can I disable terminal resizing

`Vim` scripts sometimes resize the whole shell (in my case the `Taglist` plugin). I don't want this behavior, which is possible with the shell command `resize`, too. Is there a way to suppress the whole resizing in shell windows? Any `.*rc` files to tune? I'm using gnome-terminal.


SSH and home directory permissions

It took me hours to solve this SSH problem with one of my class accounts on my school's servers. I couldn't ssh into one particular class account without entering my password, while passwordless authentication worked with my other class accounts. The .ssh/ directory and all of its contents had the same, correct permissions as the other class accounts. Turns out the problem was the permissions set on my own home directory. Passwordless authentication did not work when the permissions on my HOME directory were set to 770 (regardless of the permissions set for .ssh/), but it worked with permissions set to 755 or 700. Anyone know why SSH does this? Is it because the home directory permissions are too permissive? Why does SSH refuse to authenticate with the public/private keys when the home directory is set more permissive than 700?


Unable to use -o allow_other with sshfs (option enabled in fuse.conf)

I have the following on my `/etc/fuse.conf` file:               # Set the maximum number of FUSE mounts allowed to non-root users.                            # The default is 1000.                                                                        #                                                                                #mount_max = 1000                                                                                # Allow non-root users to specify the 'allow_other' or 'allow_root'                           # mount options.                                                                              #                                                                                user_allow_other          But when I try to mount a remote path with the option `allow_other`:               > sshfs name@server:/remote/path /local/path -o allow_other      I get:               fusermount: failed to open /etc/fuse.conf: Permission denied     fusermount: option allow_other only allowed if 'user_allow_other' is set in /etc/fuse.conf      I have triple checked and the option `user_allow_other` is uncommented in my `fuse.conf`,as I copied above. I have also executed `sudo adduser my_user_name fuse` (not sure if this is needed though), but I still get the same problem. Why is it not parsing the `/etc/fuse.conf` file correctly?


Changing DD-WRT's default IP address

I have Buffalo WZR-HP-G300NH wireless router and I updated the firmware to DD- WRT (the newest build). The rest of my home network is in IP scope of 192.168.0.100-200 and this router has it's own. The default IP of the router is 192.168.1.1. On the setup tab (Basic setup) there is a place where I can change the IP, gateway etc. If I set the correct configuration, press save and apply, nothing happens, or actually something happens... I have to remove the WAN cable and reset the modem to access it again. So it won't change the IP. Solutions?


How should I rsync files in /var/www if I want them to be owned by www-data?

I have set up a new ec2 ubuntu box and installed apache and php5. By default you log onto the box with the `ubuntu` user who has `sudo` privileges. I believe apache runs as `root` and php5 runs as `www-data`. I think that I want all of the files in `/var/www` to be chown'ed to `www- data:www-data`, and folders set as 755 and files as 644 - unless there is an issue with that. Things run fine like this, but my issue is that when I `rsync` files from my laptop to the server it changes the ownership on them (and adds new files) as `ubuntu:admin` I have been through the `rsync` manual and searched Google, and I've seen a syntax like:               rsync -avzcO (source) (destination) --owner=www-data --group=www-data      However it appears that `\--owner` and `\--group` don't not take an argument but instead are meant to be used to force the remote files to have the same owner as on the local file system if rsync is being done as a super user. So, I haven't found a solution with rsync to set the remote user and group of files during rsync. **What am I doing wrong?** Thoughts:   * Maybe my files in /var/www should just be owned by `ubuntu:admin` ?   * Maybe I have the rsync syntax wrong   * I guess I could rsync as the `www-data` user but that doesn't seem like a good idea   * I could use suPHP like I would do on a shared host, but that seems like quite a bit of trouble


Bridging ethernet interface

I have a server with 4 public IP's. I have it with this configuration and I want to bridge the interface eth0 for using it with KVM: So, I have 3 IP's (A.B.C.144, A.B.C.145, A.B.C.146) and another interface with the main IP that I want to bridge (188.165.X.Y) **/etc/network/interfaces** :               # The loopback network interface     auto lo     iface lo inet loopback          auto eth0     iface eth0 inet static         address 188.165.X.Y         netmask 255.255.255.0         network 188.165.255.0         broadcast 188.165.255.255         gateway 188.165.255.254          # KVM Bridge     auto br0     iface br0 inet static         address 188.165.X.Y         netmask 255.255.255.0         network 188.165.255.0         broadcast 188.165.255.255         gateway 188.165.255.254             bridge_ports eth0             bridge_fd 9             bridge_hello 2             bridge_maxage 12             bridge_stp off          auto eth0:0     iface eth0:0 inet static         address A.B.C.145         netmask 255.255.255.255          auto eth0:1     iface eth0:1 inet static         address A.B.C.146         netmask 255.255.255.255          auto eth0:2     iface eth0:2 inet static         address A.B.C.147         netmask 255.255.255.255      Everything (eth0, eth0:0: eth0:1, eth0:2) is working fine except the bridge (br0). But, If I do:               ifup br0      I lose the connection and I have to restore configuration without br0. What should I do? With @Ulrich configuration:               device eth0 entered promiscuous mode     e1000e 0000:00:19.0: irq 43 for MSI/MSI-X     e1000e 0000:00:19.0: irq 43 for MSI/MSI-X     ADDRCONF(NETDEV_UP): eth0: link is not ready     ADDRCONF(NETDEV_UP): br0: link is not ready     e1000e: eth0 NIC Link is Up 100 Mbps Full Duplex, Flow Control: None     e1000e 0000:00:19.0: eth0: 10/100 speed: disabling TSO     ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready     br0: port 1(eth0) entering forwarding state     br0: port 1(eth0) entering forwarding state     ADDRCONF(NETDEV_CHANGE): br0: link becomes ready


exit out of all SSH connections in one command and close PuTTY

Is there a way to back out of all SSH connections and close PuTTY in "one shot"? I work in Windows 7 and use PuTTY to SSH to various Linux hosts. An example of the way I find myself working:               SSH to host1 with PuTTY...     banjer@host1:~> #...doin some work...ooh! need to go check something on host8...     banjer@host1:~> ssh host8     banjer@host8:~> #...doin some work...OK time for lunch. lets close putty...     banjer@host8:~> exit     banjer@host1:~> exit     Putty closes.      Per above, any way to get from host8 to closing PuTTY in one shot? Sometimes I find myself up to 5 or 10 hosts deep. I realize I can click the X to close the PuTTY window, but I like to make sure my SSH connections get closed properly by using the exit command. I also realize I'm asking for tips on how to increase laziness. I'll just write it off as "how can I be more efficient".


Set up nvidia drivers on mobile sli configuration

I have been trying to get xfce running on my slackware install for a while now, but no matter which graphics driver I use it always fails with the no screens found error. I can run it at a significantly reduced resolution using the stock options, but that isn't acceptable for most purposes. Has anyone had success setting up a mobile sli configuration in linux? I am able run Ubuntu with correct resolution settings, but that was working by default.


Intrusion system suggestion specifically for Centos 6.4

We are trying to evaluate a good possible intrusion detection package specifically for centos 6.4. So far Ossec looks promising. Any other based on others experience.


eclipse luna UI rendering in linux

I installed eclipse luna in Fedora 19 and facing the following problems.               Tab headers seems to be big compared to windows installations. I googled and edited .gtkrc-2.0 file in home directory which made tabs smaller. But I'm using High Contrast appearance instead of GTK, to get the dark background. But again the tabs appears big. What is the script I have use or edit to solve this problem.          I'm using Dark theme the selection of item in tree is not highlighting. How to solve this ?          Tool bar icons seems to be big how to reduce their size?


Is there a way to select by several conditions in `ps`?

It seems I am missing something blindingly obvious, but still:               ps -f -u myuser --ppid 1      Seems to only take a look at parent pid of the process, and returns all the processes that have parent pid of 1 - even when the user is not `myuser`. The `-u` alone works correctly (selecting only processes of `myuser`):               ps -f -u myuser      What am I missing? Is there some built-in way to filter by several conditions in `ps`? **EDIT:** My current workaround:               ps -f -p $(join <(ps h --ppid 1 -o pid | sort) <(ps h -u myuser -o pid | sort))


Why CTRL+L in Terminal won't clear screen like cls in Powershell

I compared the `CTRL`+`L` in the Linux Debian terminal and the `cls` in Powershell. When I pressed `CTRL`+`L`, it doesn't really clear the screen, it just prints newlines a few times. But when I type `cls` in Powershell, it cleared the screen. Why isn't the terminal clearing the screen like in Powershell?


tcpdump don't show src and dst address

I'm having a problem with a tcpdump. The output is:               21:53:53.877873 MPLS (label 266837, exp 0, [S], ttl 255), IP, length: 193     21:53:53.878037 MPLS (label 326819, exp 0, [S], ttl 255), IP, length: 1332     21:53:53.878037 MPLS (label 326819, exp 0, [S], ttl 255), IP, length: 1332     21:53:53.878050 MPLS (label 326819, exp 0, [S], ttl 255), IP, length: 1332     21:53:53.878070 MPLS (label 326819, exp 0, [S], ttl 255), IP, length: 1332     21:53:53.878149 MPLS (label 326819, exp 0, [S], ttl 255), IP, length: 1332     21:53:53.878430 MPLS (label 279951, exp 0, [S], ttl 255), IP, length: 50      And not the expected:               22:08:12.029608 IP 10.57.169.224.49612 > 68.171.231.64.51620: Flags [.], ack 2761, win 65535, length 0     22:08:12.029620 IP 10.57.169.224.49612 > 68.171.231.64.51620: Flags [.], ack 4141, win 65535, length 0     22:08:12.029631 IP 10.57.169.224.49612 > 68.171.231.64.51620: Flags [.], ack 5521, win 65535, length 0     22:08:12.029657 IP 206.51.26.193.19063 > 10.45.14.157.19060: UDP, length 386     22:08:12.029694 IP 206.51.26.193.19064 > 10.56.143.63.19060: UDP, length 1300      So, with this output, the host filter don't work. When i put the -v option or -vv option, i get the IP's (src and dest):               21:54:04.727826 MPLS (label 299984, exp 0, [S], ttl 255)             IP (tos 0x0, ttl 55, id 26147, offset 0, flags [DF], proto TCP (6), length 1500)         72.21.91.19.http > 186.165.14.97.42408: Flags [.], seq 702450604:702452064, ack 2572860166, win 245, length 1460     21:54:04.727867 MPLS (label 262205, exp 0, [S], ttl 255)             IP (tos 0x48, ttl 252, id 357, offset 0, flags [none], proto UDP (17), length 1328)         10.101.12.105.19060 > 206.51.26.193.19061: UDP, length 1300     21:54:04.727880 MPLS (label 279961, exp 0, [S], ttl 255)             IP (tos 0x0, ttl 49, id 50980, offset 0, flags [DF], proto TCP (6), length 109)         69.167.149.108.9933 > 181.185.41.153.53120: Flags [P.], seq 3203122401:3203122470, ack 2844602734, win 63504, length 69     21:54:04.727891 MPLS (label 264603, exp 0, [S], ttl 255)             IP (tos 0x0, ttl 81, id 59423, offset 0, flags [DF], proto TCP (6), length 200)         69.171.247.29.https > 186.25.255.129.50605: Flags [P.], seq 2597755680:2597755840, ack 2375027064, win 35, length 160      But -v and -vv option don't work with -w option, so the filter don't work and the file generated is empty. Anyone know how to make the tcpdump print the IP's and host filter works? I'm using SVOS 9.20.0200 (FreeBSD 8.2 based), tcpdump version 4.0.0 and libpcap version 1.0.0


How to know if a process is attached to a tap interface?

I sometimes come upon machine with tap interfaces (eg, when KVM is running). How can i know which process is attached to the tap interface ?


Find out that driver is installed properly

I have got a pci sata controller on my machine. I am not sure that the driver is installed properly. The `lspci -v` output of the card is:               00:09.0 RAID bus controller: VIA Technologies, Inc. VT6421 IDE RAID Controller (rev 50)     Subsystem: VIA Technologies, Inc. VT6421 IDE RAID Controller     Flags: bus master, medium devsel, latency 32, IRQ 18     I/O ports at cc00 [size=16]     I/O ports at d000 [size=16]     I/O ports at d400 [size=16]     I/O ports at d800 [size=16]     I/O ports at dc00 [size=32]     I/O ports at e000 [size=256]     [virtual] Expansion ROM at 40000000 [disabled] [size=64K]     Capabilities: <access denied>     Kernel driver in use: sata_via     Kernel modules: sata_via      Could you please help me to examine that this driver is installed properly?


E763 with vim and spell checker

I want to add germand spell checking to vim. So I set               :set spl=de_de spell      then there is a dialogue, where I can create a directory called `.vim/spell`. And then there is another question where I can download a `.spl` file. And again for a `.sug` file. But when I download both files I get an error               Fehler beim Ausführen von "~/.vim/spell/de.utf-8.spl":     E763: 'Word Characters' unterscheiden sich zwischen Rechtschreibwörterbüchern      But despite the error I can use the spell checking and even the suggestion works. Also I could not `:mksp` my own `.spl`-file from myspell, cause it wouldn't read the `.dic`-file. And I deleted the `spell`directory and retried it. Nothing worked.


Grub2 without arrow keys

My laptop keyboard recently had a losing encounter with a beer, and the arrow keys don't work anymore. No big deal, I figured -- I remapped CAPS+hjkl to the arrows in xkb, and after a little getting used to it's an improvement. The one problem is that I can't navigate the menu in GRUB anymore. Is there any alternative way to choose which option to boot in GRUB, besides scrolling up and down? PgUp and PgDn will get me the first and last options, so I can put the two most common choices there and get the rest as needed with a USB keyboard. Obviously this isn't ideal. I vaguely remember that in the old GRUB the options could be selected by number -- is it possible to enable this somehow?


How to delete old packages installed by pacman in Arch Linux?

I have recently installed Arch Linux and found that I am eating away at a lot of memory relatively quickly. For whatever reason I have already used 17GB in just about 2 weeks. I do not have a great deal of software installed so I am led to believe that all of the old packages are maintained somewhere. To support this, I have noticed that if I installed a package, remove that package, and then re-install it that pacman merely unpacks and re-installs the software without having to re-download it. After I installed my base system, before extra software, I used about 2GB or so maybe. I have since only installed Matlab, Skype, Wine, and a few other small programs. Of course I have also installed missing libraries and the like, but not nearly 15GB worth. Am I completely wrong here or does Arch never delete old packages when downloading/upgrading to new versions? If so, how do I delete these un-used packages? Also, when I remove installed packages I use `pacman -R ...`


Trying to send HTML mail on mac OSX Mountain Lion

I'm trying to send email with an html file as the body (it's actually a cucumber results report if that matters) or an attachment (if sending it as the body does not work) via the command line I've tried the following based on the mutt example in this answer to another question, but it is resulting in an error.               cat <<'EOF' Audit_Results.html | mutt -H -     To: cvanderlinden@xxxxxx.com     Subject: "test sending html mail"     Content-Type: text/html          EOF      when I do this I get the following error               No recipients were specified.      Mutt was installed using `brew install mutt` and it looks like that installed version 1.5.21. I am able to send mail via the 'interactive' interface but just tested that with simple text mail, nothing html or with an attachment. My objective is to send the cucumber results file "Audit_Results.html" file out as an email. Although the file includes some screenshots that are created using webdriver's `.screenshot_as(:base64)` method, and embedded using cucumber's `embed("data:image/png;base64,#{encoded_img}",'image/png')` function which seems to pose a bit of a problem. So far the one time I've managed to create a html mail from the report (using sendmail) it did not display properly in gmail. (although if sent as an attachment, it will format properly when downloaded and opened with a browser) Seems like gmail at least does not like html email with images embedded in that format. So it may be that I will end up needing to send the html report as an attachment.