commandlinefu.com is the place to record those command-line gems that you return to again and again.
Delete that bloated snippets file you've been using and share your personal repository with the world. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.
If you have a new feature suggestion or find a bug, please get in touch via http://commandlinefu.uservoice.com/
You can sign-in using OpenID credentials, or register a traditional username and password.
First-time OpenID users will be automatically assigned a username which can be changed after signing in.
Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.
Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):
Subscribe to the feed for:
Lists all opened sockets (not only listeners), no DNS resolution (so it's fast), the process id and the user holding the socket.
Previous samples were limiting to TCP too, this also lists UDP listeners.
Check open TCP and UDP ports
While `lsof` will work, why not use the tool designed explicitly for this job?
(If not run as root, you will only see the names of PID you own)
shell loop to scan netstat output avoiding loolback aliases (local/remote swap for local connections)
We use the "convert" command (ImageMagick package) : see man convert (http://www.ma.utexas.edu/cgi-bin/man-cgi?convert+1)
Count and Find all IP connected to my host through TCP connection.
find all computer connected to my host through TCP connection
find all computer connected to my host through TCP connection.
count connections, group by IP and port
netstat has two lines of headers:
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
Added a filter in the awk command to remove them
Useful for checking the number and state of TCP connections.
I cannot run Tomcat from Eclipse. It says that there?s other process that is running on port 8080, but I don?t know what is the process, and how to stop it from the Services manger in Windows. So here?s how you can kill and find out what is that process:
To find out what PID 8080 was (hopefully not a trojan)
I typed tasklist /FI ?PID eq 8080″
taskkill /F /PID 2600
shows opened ports on machine in continuous mode (refreshing every 10 sec)