Hi there,
I have a little problem with commands. I know this is about shell scripting but i couldn't find a thread for commandlines. So i have this assignment to "display all the lines for tcp- services and udp- services and count the lines" and i honestly don't have an idea how to do that, i know how to count the lines tho XD...if someone could help me i would be grateful. :)
Elandir
0
Newbie Poster
Recommended Answers
Jump to Postif it is on linux system and you are referring to the active connections to the server use the following:
netstat -a
to list a count of all of the UDP entries use:
netstat -a | grep udp | wc
Jump to PostWell both of those methods are imperfect for counting connections, but you're probably getting a more accurate result with grep in this case, because it won't count the first two lines (if your output is like mine)
Active Internet connections (servers and established) Proto Recv-Q Send-Q Local …
All 6 Replies
rch1231
169
Posting Shark
Elandir
0
Newbie Poster
JeoSaurus
32
Posting Whiz in Training
Elandir
0
Newbie Poster
JeoSaurus
32
Posting Whiz in Training
rch1231
commented:
The awk and grep examples were great and I had never used the output to a variable like that. Well written.
+2
Elandir
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.