ehowton (ehowton) wrote,
ehowton
ehowton

vi[m] shortcut conquors /etc/services assininity


SUSE Linux Enterprise Server (SLES) and OpenSUSE have recently been including, free-of-charge, the entire IANA registered port list in /etc/services! Long gone are the days of old when we either had to commit ports to memory, or look up the IANA registered ports, and manually add them to the /etc/services file. Because really, who wants to do all that time-consuming labor? In short, me! Why?

Because its more work to comment out the 999,999 services I don't need, than to add the couple hundred I do need. Especially when the couple hundred conflict with the entire IANA registered port list pre-populated into the /etc/services file. Now what I could see as being awesome is including the entire IANA registered port list already commented out because that would allow a quick-and-easy lookup, and a quick-and-easy port entry with a single keystroke. But that's not what is happening here.

So I have a list of 57 non-production hosts (not even going to count the production numbers yet), with 57 discrete /etc/services files, all requiring 397 blocks of conflicting ports disabled. Some suggested awk, some suggested sed, but each file being unique made attempting this arduous.

Until one enterprising young man introduced us to vi substitution using absolute line numbers.

:set number

:6015,6030s/^/#

This essentially replaces (s) the first of the line (^) with a comment (#) for all ports listed between lines numbers 6015 and 6030.


6000  global-cd-port          3229/udp          # Global CD Port  [Vitaly_Revsin_2]
6001  sftdst-port             3230/tcp          # Software Distributor Port  [Andrea_Lanza]
6002  sftdst-port             3230/udp          # Software Distributor Port  [Andrea_Lanza]
6003  vidigo                  3231/tcp          # VidiGo communication (previous was: Delta Solutions Direct)  [Peter_Ijkhout]
6004  vidigo                  3231/udp          # VidiGo communication (previous was: Delta Solutions Direct)  [Peter_Ijkhout]
6005  mdtp                    3232/tcp          # MDT port  [RFC-ietf-l3vpn-2547bis-mcast-10]
6006  mdtp                    3232/udp          # MDT port  [RFC-ietf-l3vpn-2547bis-mcast-10]
6007  whisker                 3233/tcp          # WhiskerControl main port  [Rudolf_Cardinal]
6008  whisker                 3233/udp          # WhiskerControl main port  [Rudolf_Cardinal]
6009  alchemy                 3234/tcp          # Alchemy Server  [Mikhail_Belov]
6010  alchemy                 3234/udp          # Alchemy Server  [Mikhail_Belov]
6011  mdap-port               3235/tcp          # MDAP port  [Johan_Deleu]
6012  mdap-port               3235/udp          # MDAP Port  [Johan_Deleu]
6013  apparenet-ts            3236/tcp          # appareNet Test Server 
6014  apparenet-ts            3236/udp          # appareNet Test Server 
6015  #apparenet-tps           3237/tcp          # appareNet Test Packet Sequencer 
6016  #apparenet-tps           3237/udp          # appareNet Test Packet Sequencer 
6017  #apparenet-as            3238/tcp          # appareNet Analysis Server 
6018  #apparenet-as            3238/udp          # appareNet Analysis Server 
6019  #apparenet-ui            3239/tcp          # appareNet User Interface  [Fred_Klassen]
6020  #apparenet-ui            3239/udp          # appareNet User Interface  [Fred_Klassen]
6021  #triomotion              3240/tcp          # Trio Motion Control Port  [Tony_Matthews]
6022  #triomotion              3240/udp          # Trio Motion Control Port  [Tony_Matthews]
6023  #sysorb                  3241/tcp          # SysOrb Monitoring Server  [Jakob_Oestergaard]
6024  #sysorb                  3241/udp          # SysOrb Monitoring Server  [Jakob_Oestergaard]
6025  #sdp-id-port             3242/tcp          # Session Description ID  [Greg_Rose_2]
6026  #sdp-id-port             3242/udp          # Session Description ID  [Greg_Rose_2]
6027  #timelot                 3243/tcp          # Timelot Port  [David_Ferguson]
6028  #timelot                 3243/udp          # Timelot Port  [David_Ferguson]
6029  #onesaf                  3244/tcp          # OneSAF  [Gene_McCulley]
6030  #onesaf                  3244/udp          # OneSAF  [Gene_McCulley]
6031  vieo-fe                 3245/tcp          # VIEO Fabric Executive  [James_Cox]
6032  vieo-fe                 3245/udp          # VIEO Fabric Executive  [James_Cox]
6033  dvt-system              3246/tcp          # DVT SYSTEM PORT
6034  dvt-system              3246/udp          # DVT SYSTEM PORT 
6035  dvt-data                3247/tcp          # DVT DATA LINK  [Phillip_Heil]
6036  dvt-data                3247/udp          # DVT DATA LINK  [Phillip_Heil]
6037  procos-lm               3248/tcp          # PROCOS LM  [Torsten_Rendelmann]
6038  procos-lm               3248/udp          # PROCOS LM  [Torsten_Rendelmann]
6039  ssp                     3249/tcp          # State Sync Protocol  [Stephane_Beaulieu]
6040  ssp                     3249/udp          # State Sync Protocol  [Stephane_Beaulieu]

Tags: hpux, linux, unix
Subscribe

Recent Posts from This Journal

  • rmt

    for x in `rmt-cli repos list --all | grep 15 | grep SP2 | grep -v Not | grep SAP | awk ' {print $2} '` ; do rmt-cli repos enable $x ; done rmt-cli…

  • neofetch

    Only because I keep looking for it here, and haven't (apparently) posted it yet, here's how to get neofetch to display at boot on various operating…

  • COVID-19 Modeling

    SARS-Cov-2 (COVID-19) protein-modeling update - Folding@home DAILY Points accumulated per SYSTEM: 4,000 GeFORCE GTX 1070 (Win10 metal) 5,000 Intel…

  • Post a new comment

    Error

    default userpic

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 0 comments