NETSTAT Command: Netstat - A 1912077 - Myfile4

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Q. Generate a text file with the name 1912077_myfile4 .

Explain in short with example the following


commands and save it in the text file you have created. The commands are: { netstat, telnet, tcpdump,
ssh, ping, dmesg, ps, kill, sleep, xargs }.

Solution:
NETSTAT Command
Netstat command displays various network related information such as network connections, routing tables,
interface statistics, masquerade connections, multicast memberships etc.,Active Internet connections (servers
and established)
netstat -a >> 1912077_myfile4.txt
command save the below information in this file

Proto Recv-Q Send-Q Local Address Foreign Address State


Active UNIX domain sockets (servers and established)
Proto RefCnt Flags Type State I-Node Path
unix 2 [ ACC ] SEQPACKET LISTENING 1238 /run/WSL/13_interop

TCPDUMP Command
tcpdump is a command-line utility that you can use to capture and inspect network traffic going to and from
your system. It is the most commonly used tool among network administrators for troubleshooting network
issues and security testing.

Only root or user with sudo privileges can run tcpdump.The most simple use case is to invoke tcpdump
without any options and filters:

sudo tcpdump

SSH Command
ssh stands for “Secure Shell”. It is a protocol used to securely connect to a remote server/system. ssh is secure
in the sense that it transfers the data in encrypted form between the host and the client. It transfers inputs
from the client to the host and relays back the output. ssh runs at TCP/IP port 22.

It's syntax is:


ssh user_name@host(IP/Domain_name)

PING Command
PING (Packet Internet Groper) command is used to check the network connectivity between host and
server/host. This command takes as input the IP address or the URL and sends a data packet to the specified
address with the message “PING” and gets a response from the server/host this time is recorded which is
called latency. Fast ping low latency means faster connection.

It's syntax is:


ping [URL]

DMESG Command
dmesg command, also called “driver message” or “display message” is used to examine the kernel ring buffer
and print the message buffer of the kernel. The output of this command contains the messages produced by
the device drivers.
dmesg -t
command prints the information below
Linux version 4.19.128-microsoft-standard (oe-user@oe-host) (gcc version 8.2.0 (GCC)) #1 SMP
Tue Jun 23 12:58:10 UTC 2020
Command line: initrd=\initrd.img panic=-1 pty.legacy_count=0 nr_cpus=8
KERNEL supported cpus:
Intel GenuineIntel
AMD AuthenticAMD
Centaur CentaurHauls
x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers'
x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers'
x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers'
x86/fpu: xstate_offset[2]: 576, xstate_sizes[2]: 256
x86/fpu: Enabled xstate features 0x7, context size is 832 bytes, using 'compacted' format.
BIOS-provided physical RAM map:
BIOS-e820: [mem 0x0000000000000000-0x000000000009ffff] usable
BIOS-e820: [mem 0x00000000000e0000-0x00000000000e0fff] reserved
BIOS-e820: [mem 0x0000000000100000-0x00000000001fffff] ACPI data
BIOS-e820: [mem 0x0000000000200000-0x00000000f7ffffff] usable
BIOS-e820: [mem 0x0000000100000000-0x00000003335fffff] usable
NX (Execute Disable) protection: active
DMI not present or invalid.
Hypervisor detected: Microsoft Hyper-V
Hyper-V: features 0x2e7f, hints 0x20c2c, misc 0x20bed7b2
Hyper-V Host Build:19041-10.0-1-0.1165
Hyper-V: LAPIC Timer Frequency: 0x1e8480
tsc: Marking TSC unstable due to running on Hyper-V
Hyper-V: Using hypercall for remote TLB flush
tsc: Detected 2400.009 MHz processor
e820: update [mem 0x00000000-0x00000fff] usable ==> reserved
e820: remove [mem 0x000a0000-0x000fffff] usable
last_pfn = 0x333600 max_arch_pfn = 0x400000000
...........more
PS Command
Linux provides us a utility called ps for viewing information related with the processes on a system which
stands as abbreviation for “Process Status”. ps command is used to list the currently running processes and
their PIDs along with some other information depends on different options
ps
command prints the below information
PID TTY TIME CMD
14 pts/0 00:00:00 bash
272 pts/0 00:00:00 ps

KILL Command
kill command in Linux (located in /bin/kill), is a built-in command which is used to terminate processes
manually.

Its syntax is:


kill [PID]
This command kills a process with ID = PID

SLEEP Command
sleep command is used to create a dummy job. A dummy job helps in delaying the execution.
Its syntax is:
sleep NUMBER[SUFFIX]

You might also like