How to open a port in linux machine

You can use netcat (nc) to open a port in linux machines.

# nc -k -l 1000  -------- port number 1000 is open in local machine

it can manipulate, create or read/ write TCP/IP connections.

 File transfer

Copy a large folder over a raw tcp connection. The transfer is very quick (no protocol overhead) and you don't need to mess up with NFS or SMB or FTP or so, simply make the file available on the server, and get it from the client. Here 192.168.0.5 is the server IP address.

server#  tar -cf - -C VIDEO_TS . | nc -l -p 4444  
# Serve tar folder on port 4444
client#  nc 192.168.0.5 4444 | tar xpf - -C VIDEO_TS 
# Pull the file on port 4444

server#  cat largefile | nc -l 5678                # Server a single file
client#  nc 192.168.0.5 5678 > largefile      # Pull the single file

server#  dd if=/dev/da0 | nc -l 4444   # Server partition image
client#  nc 192.168.0.5 4444 |dd of=/dev/da0
# Pull partition to clone
client#  nc 192.168.0.5 4444 |dd of=da0.img   # Pull partition to file

Chat feature using nc

google and yahoo can chat over a simple TCP socket. The text is transferred with the enter key.

google# nc -lp 4444
yahoo # nc 192.168.1.1 4444





Terima kasih telah membaca artikel tentang How to open a port in linux machine di blog Tutorial Opensource and Linux jika anda ingin menyebar luaskan artikel ini di mohon untuk mencantumkan link sebagai Sumbernya, dan bila artikel ini bermanfaat silakan bookmark halaman ini di web browser anda, dengan cara menekan Ctrl + D pada tombol keyboard anda.

Artikel terbaru :

  • How To Install Cinnamon In Ubuntu 14.04
  • How To Install Mate Desktop In Ubuntu 14.04
  • Creating the first Windows Server 2003 Domain Controller in a domain
  • How To Install Ubuntu 13.10 Server
  • How to Install Nuvola Player in Ubuntu
  • How to establish Emerald in Ubuntu 13.10 & Linux Mint 16
  • How to Restoring iptables Automatically On Boot on Debian and Ubuntu
  • How to Compile FFMPEG with H.264 and LAME in Ubuntu And Debian
  • How to Install Linux on a Playstation 2
  • apt-fast: Improve apt-get Download Speed
  • Artikel terkait :