I have used exec 3<>/dev/tcp/192.168.0.101/6435 to establish a TCP connection with 192.168.0.101:6435. And I have received as well as sent a few messages with the pipe command.Now, I want to terminate the TCP connection. But, with ss -anpet I can see that bash itself holds this connection, without forking a child process.I tried to send signal 9 and 15 to the bash process, but as you know, bash cannot kill itself.So, can I terminate the TCP connection I have established without terminating the pts I am using (neither killing it by root nor sending Ctrl+D)?
How to terminate a TCP connection established by bash itself?
bash;pipe;tcp;file descriptors
That command opened the connection on file descriptor 3. So to close the connection, you need to close file descriptor 3.To do so:exec 3<&-