0

Is there a way to check Used Ports on Linux without commands, I mean checking files or so on ?

user212051
  • 45
  • 1
  • 9
  • 1
    What is your goal here? Why aren't you able to use standard tools to do this? The below answer is correct, you can look in /proc, but even for that, you'll need to run *some* command, even if its cat or ls. – EEAA May 14 '17 at 16:29
  • I meant to get used ports without traditional commands like netstat and lsof and so on .. why ? Because I am preparing Script to do this job on different Linux distributions and MAC .. as you know some Linux distributions don't have netstat or lsof , same on MAC .. and Business doesn't want to Bundle netstat with the original application package, the below answer is correct for Linux. – user212051 May 15 '17 at 12:55

1 Answers1

3

You can get this information in /proc/net/tcp , /proc/net/udp or /proc/net/raw.

More details and syntax here: http://www.onlamp.com/pub/a/linux/2000/11/16/LinuxAdmin.html

Depending of what you want to do with port numbers, you may have to translate the port number in decimal, as it's stored in hexadecimal in these files.