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.
» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10
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:
If you need to ssh into a computer on the local network but you're unsure of the ip to use, then ping them and see if you get a response. If you do, print out the address you got it from. Adjust the range to suit your network.
There is 1 alternative - vote for the best!
If you can do better, submit your command here.
You must be signed in to comment.
Check out nmap:
nmap -sT -p 22 192.168.1.*Also if the host that is running ssh has a host name, you can just use the host name in the LAN. i.e.
ssh user@hostnameThanks zeroconf. :-)
@ AlecSchueler:
uneccessary test (aka [):
for i in 192.168.1.{61..71}; if ping -c 1 $i &> /dev/null; then echo $i;fi;doneIf you don't have nmap, you can try if the ssh port is open with nc:
nc -w1 -z ciptux.physik.uni-bonn.de 22@Abiden:
To replicate what AlecSchueler did, your command should be:
nmap -sT -p 22 192.168.1.61-71@0x89
You missed a 'do'
for i in 192.168.1.{61..71}; do if ping -c 1 $i &> /dev/null; then echo $i;fi;doneOr
for i in 192.168.1.{61..71}; do ping -c 1 "$i" &> /dev/null && then echo "$i" ;doneRather
for i in 192.168.1.{61..71}; do ping -c 1 "$i" &> /dev/null && echo "$i" ;done@0x89
" Echo the local IP addresses of the machines on your local network
If you need to ssh into a computer on the local network but you're unsure of the ip to use"
The user is not sure what host is running ssh on it. So why not scan the whole range?
I guess AlecSchueler may have to be a bit more specific.
Maybe I put too much focus into, "you're unsure of the ip to use "
Also "192.168.1.{61..71}", does not even work.
Here's a solution if you do not have nmap but you have nc at hand.
for i in $(seq 61 71); do nc -vv -z -w1 192.168.1.${i} 22; doneAlso:
@0x89
For netcat to produce any output, you must specify at least one '-v'.
@Abiden
Yes, this was intended for use when you didn't know the IP at all. 192.168.1.{61..71} works fine for me in bash 4.0.28 though.
@0x89
What if you have neither nmap or nc installed?
@0x89
Yeah, I don't know how I forgot about &&. Silly mistake.
@Alec
I was mistaken, about '192.168.1.{61..67}'. When I had tested it, I had used an additional '.', so that's why it didn't work for me. lol
Also Alec, it seems that most distros are including netcat as of recently from my experience.