Useful Linux commands for viewing information about your network connection and other things.

Posted: July 18, 2012. At: 8:20 PM. This was 6 years ago. Post ID: 4272
Page permalink.
WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters. These cookies expire two weeks after they are set.

Viewing information about network connections and devices is easy with the netstat -a command. The -i parameter allows you to view the information about your network adapters, the transmitted and received packets and the number of transmitted and dropped packets.

[email protected]:~$ netstat -i
Kernel Interface table
Iface   MTU Met   RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0       1500 0    160634      0      0 0         96978      0      0      0 BMRU
lo        16436 0        32      0      0 0            32      0      0      0 LRU

The exiv2 command for Linux will allow you to examine a jpeg file from the Internet and see if the EXIF data is intact. This can be useful when you want more information that is embedded in the image.

C:\HOME\FLYNN\DESKTOP> exiv2 IMG-20120704-00013.jpg 
File name       : IMG-20120704-00013.jpg
File size       : 639751 Bytes
MIME type       : image/jpeg
Image size      : 2048 x 1536
Camera make     : Research In Motion
Camera model    : BlackBerry 9700
Image timestamp : 2012:07:04 09:37:48
Image number    : 
Exposure time   : 0 s
Aperture        : 
Exposure bias   : 
Flash           : No flash function
Flash bias      : 
Focal length    : 
Subject distance: Unknown
ISO speed       : 
Exposure mode   : 
Metering mode   : 
Macro mode      : 
Image quality   : 
Exif Resolution : 2048 x 1536
White balance   : 
Thumbnail       : None
Copyright       : 
Exif comment    :

The sudo tcpdump command will allow you to monitor a network interface and see the network packets travelling to and fro. I had a Firefox instance open when I ran this and therefore that activity is visible in the output.

C:\HOME\FLYNN> sudo tcpdump -i eth0
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
19:28:27.038597 IP 192.168.1.2.58325 > 192.168.1.1.domain: 8614+ A? www.securitronlinux.com. (41)
19:28:27.039384 IP 192.168.1.1.domain > 192.168.1.2.58325: 8614- 1/0/0 A 199.27.135.56 (57)
19:28:27.039465 IP 192.168.1.2.48756 > 192.168.1.1.domain: 1867+ PTR? 1.1.168.192.in-addr.arpa. (42)
19:28:27.039579 IP 192.168.1.2.50792 > cf-199-27-135-56.cloudflare.com.http: Flags [S], seq 1882545439, win 14600, options [mss 1460,sackOK,TS val 10369150 ecr 0,nop,wscale 7], length 0
19:28:27.103922 IP 192.168.1.1.domain > 192.168.1.2.48756: 1867 NXDomain* 0/1/0 (92)
19:28:27.104435 IP 192.168.1.2.54073 > 192.168.1.1.domain: 13432+ PTR? 2.1.168.192.in-addr.arpa. (42)
19:28:27.151064 IP 192.168.1.1.domain > 192.168.1.2.54073: 13432 NXDomain* 0/1/0 (92)
19:28:27.151465 IP 192.168.1.2.59936 > 192.168.1.1.domain: 16556+ PTR? 56.135.27.199.in-addr.arpa. (44)
19:28:27.289753 IP 192.168.1.2.41114 > 192.168.1.1.domain: 52365+ A? www.securitronlinux.com. (41)
19:28:27.310924 IP cf-199-27-135-56.cloudflare.com.http > 192.168.1.2.50792: Flags [S.], seq 128165367, ack 1882545440, win 4344, options [mss 1452,sackOK,TS val 55290998 ecr 10369150,nop,wscale 10], length 0
19:28:27.310967 IP 192.168.1.2.50792 > cf-199-27-135-56.cloudflare.com.http: Flags [.], ack 1, win 115, options [nop,nop,TS val 10369218 ecr 55290998], length 0
19:28:27.311100 IP 192.168.1.2.50792 > cf-199-27-135-56.cloudflare.com.http: Flags [.], seq 1:1441, ack 1, win 115, options [nop,nop,TS val 10369218 ecr 55290998], length 1440
19:28:27.311110 IP 192.168.1.2.50792 > cf-199-27-135-56.cloudflare.com.http: Flags [P.], seq 1441:2881, ack 1, win 115, options [nop,nop,TS val 10369218 ecr 55290998], length 1440
19:28:27.311116 IP 192.168.1.2.50792 > cf-199-27-135-56.cloudflare.com.http: Flags [P.], seq 2881:3442, ack 1, win 115, options [nop,nop,TS val 10369218 ecr 55290998], length 561
19:28:27.602359 IP cf-199-27-135-56.cloudflare.com.http > 192.168.1.2.50792: Flags [.], ack 1441, win 8, options [nop,nop,TS val 55291027 ecr 10369218], length 0
19:28:27.622609 IP cf-199-27-135-56.cloudflare.com.http > 192.168.1.2.50792: Flags [.], ack 2881, win 10, options [nop,nop,TS val 55291029 ecr 10369218], length 0
19:28:27.640085 IP cf-199-27-135-56.cloudflare.com.http > 192.168.1.2.50792: Flags [.], ack 3442, win 13, options [nop,nop,TS val 55291030 ecr 10369218], length 0
19:28:27.665380 IP 192.168.1.1.domain > 192.168.1.2.59936: 16556 1/2/0 PTR cf-199-27-135-56.cloudflare.com. (125)
19:28:27.863628 IP 192.168.1.1.domain > 192.168.1.2.41114: 52365 4/2/0 CNAME www.securitronlinux.com.cdn.cloudflare.net., CNAME cf-protected-www.securitronlinux.com.cdn.cloudflare.net., A 173.245.61.146, A 199.27.135.56 (212)
19:28:27.863896 IP 192.168.1.2.33402 > 192.168.1.1.domain: 32490+ A? www.securitronlinux.com. (41)
19:28:27.864606 IP 192.168.1.1.domain > 192.168.1.2.33402: 32490- 1/0/0 A 173.245.61.146 (57)
19:28:27.864819 IP 192.168.1.2.33633 > www.securitronlinux.com.http: Flags [S], seq 684488925, win 14600, options [mss 1460,sackOK,TS val 10369357 ecr 0,nop,wscale 7], length 0
19:28:27.864945 IP 192.168.1.2.54147 > 192.168.1.1.domain: 17006+ PTR? 146.61.245.173.in-addr.arpa. (45)
19:28:27.883139 IP 192.168.1.1.domain > 192.168.1.2.54147: 17006- 1/0/0 PTR www.securitronlinux.com. (82)
19:28:28.134104 IP www.securitronlinux.com.http > 192.168.1.2.33633: Flags [S.], seq 147856110, ack 684488926, win 4344, options [mss 1452,sackOK,TS val 55310751 ecr 10369357,nop,wscale 10], length 0
19:28:28.134153 IP 192.168.1.2.33633 > www.securitronlinux.com.http: Flags [.], ack 1, win 115, options [nop,nop,TS val 10369424 ecr 55310751], length 0
19:28:29.007771 IP cf-199-27-135-56.cloudflare.com.http > 192.168.1.2.50792: Flags [P.], seq 1:574, ack 3442, win 13, options [nop,nop,TS val 55291168 ecr 10369218], length 573
19:28:29.007817 IP 192.168.1.2.50792 > cf-199-27-135-56.cloudflare.com.http: Flags [.], ack 574, win 124, options [nop,nop,TS val 10369642 ecr 55291168], length 0
19:28:29.025272 IP cf-199-27-135-56.cloudflare.com.http > 192.168.1.2.50792: Flags [P.], seq 574:594, ack 3442, win 13, options [nop,nop,TS val 55291168 ecr 10369218], length 20
19:28:29.025303 IP 192.168.1.2.50792 > cf-199-27-135-56.cloudflare.com.http: Flags [.], ack 594, win 124, options [nop,nop,TS val 10369647 ecr 55291168], length 0
19:28:29.951684 ARP, Request who-has 192.168.1.1 (Broadcast) tell 192.168.1.3, length 46
19:28:29.951921 IP 192.168.1.2.47676 > 192.168.1.1.domain: 62316+ PTR? 3.1.168.192.in-addr.arpa. (42)
19:28:30.000463 IP 192.168.1.1.domain > 192.168.1.2.47676: 62316 NXDomain* 0/1/0 (92)
19:28:33.134561 IP 192.168.1.2.33633 > www.securitronlinux.com.http: Flags [F.], seq 1, ack 1, win 115, options [nop,nop,TS val 10370674 ecr 55310751], length 0
19:28:33.367159 IP www.securitronlinux.com.http > 192.168.1.2.33633: Flags [F.], seq 1, ack 2, win 5, options [nop,nop,TS val 55311274 ecr 10370674], length 0
19:28:33.367204 IP 192.168.1.2.33633 > www.securitronlinux.com.http: Flags [.], ack 2, win 115, options [nop,nop,TS val 10370732 ecr 55311274], length 0

A good way to view a listing of the block devices/partitions on your system is with the lsblk command. This gives a very nice tree view listing.

C:\HOME\FLYNN> lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 465.8G  0 disk 
├─sda1   8:1    0   430M  0 part /media/e01436e0-4aa5-420b-94aa-0b35bd00020e
├─sda2   8:2    0 341.8G  0 part /
├─sda3   8:3    0 121.1G  0 part /media/a6f66737-afea-48c3-9694-f6da22904d37
├─sda4   8:4    0     1K  0 part 
└─sda5   8:5    0   2.5G  0 part [SWAP]
sdb      8:16   0 465.8G  0 disk 
├─sdb1   8:17   0 214.9G  0 part /media/My Ubuntu
├─sdb2   8:18   0  32.2G  0 part /media/3fabc97d-c76a-4922-8705-5536e89cfd21
├─sdb3   8:19   0     1K  0 part 
└─sdb5   8:21   0 218.6G  0 part /media/52d826a6-7de5-45db-b693-dd7c7e82af37
sdc      8:32   0   1.8T  0 disk 
└─sdc1   8:33   0   1.8T  0 part /media/Elements
sr0     11:0    1     2K  0 rom

No comments have been made. Use this form to start the conversation :)

Leave a Reply