Back to the learning path

nc

nc = netcat (cat for the network) Command details
Step 1/2: Talk to a service

nc HOST PORT (netcat) opens a TCP connection: every line you type is sent and the answers are shown, handy for line-based services (SMTP, Redis, db01 here). Content can come from a pipe: echo PING | nc -w 2 db01 5432; -w 2 hangs up after 2 idle seconds.

$ nc db01 5432
Fundamentalsncnetwork
Talk to a network service directly
Port 5432 on db01 runs a line-based service. Connect with nc, send PING and read the answer. (Interactively: type the line once connected, and press Ctrl+C after the answer.)

This exercise needs real Linux

The commands it uses (processes, networking and more) are not in the simulator. Switch to real Linux and the exercise runs in a real Linux system inside your browser.

wgetNext lesson:ssh