10-05-2006
Quote:
Originally Posted by sanchopansa
Thanks for your suggestion but I think that it lists all processes on all ports without listing the port numbers and I would like to have them as well.
P.S.I'm also using Linux- Slackware.
It does lists the port numbers, but they get converted to service names from /etc/services. Try this:
lsof -i -P
Please check the man page for options that would be suitable for you.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi, I have the following script running in my cron.
--------------------------------------------------------------------
#!/bin/csh
bnstat -p GPD_VSLinux | grep pg | grep varcon | awk '{print $1, $2, $3, $4, $5, $6, $7, $8, $9, $10}' > /tmp/LX_xbatch.log
bnstat -p GPD_VSLinux_test | grep pg... (2 Replies)
Discussion started by: killerserv
2 Replies
2. Shell Programming and Scripting
I would like some advice on how to logically put together a script to handle a daily task of data gathering for the following problem.
I have two files, file1 has 125,000 records that I cut and remove unwanted fields through scripts and cron. In file2, I have 25000 records that has the same... (4 Replies)
Discussion started by: greengrass
4 Replies
3. Shell Programming and Scripting
Ok. I want to parse a log file and search only for denied traffic for the previous hour. The log looks like this:
Jun 18 17:47:56 routername 36806: Jun 18 17:53:01.088: %SEC-6-IPACCESSLOG: list ingress-filter denied tcp 1.2.3.4(1234) -> 6.7.8.9(53), 4 packets
I only really care about the... (12 Replies)
Discussion started by: earnstaf
12 Replies
4. Shell Programming and Scripting
Alright, I feel like I have a pretty good basic knowledge of shell scripting, but this one is throwing me for a loop. I know I've seen something similar done with awk, but I couldn't find it with the search function.
I've grepped through my log file and get results like this:
--... (14 Replies)
Discussion started by: earnstaf
14 Replies
5. Shell Programming and Scripting
Hello,
I have this script running on cron every 20 minutes.
By 12pm daily, our system is expecting all input files to be uploaded by the script.
After this cutoff time, the script would still be running though, but i need some kind of alerts/logs to know which input files weren't received for... (1 Reply)
Discussion started by: gholdbhurg
1 Replies
6. Shell Programming and Scripting
I already have a solution to my problem, but I'm looking to see if it can be made more succinct and faster. The problem: given a list, as shown below, extract the pathname for any file in a directory named 'ample' and return it's index into the list. The index is also in the data itself. Note that... (1 Reply)
Discussion started by: prigo
1 Replies
7. Shell Programming and Scripting
Hi folks,
I use following script:-
#!/bin/sh
# cd Linbread
TODAY=`date +"%m%d"`
DATA=`grep $TODAY linbread.dat`
HOUR=`date +"%H"`
if
then TOD="Morning"
elif
then TOD="Afternoon"
else
TOD="Evening"
fi
echo $DATA | gawk -F"|" '{printf("%s\n\n%s",$2,$3)}' > $$tmp
fold -s -w60... (0 Replies)
Discussion started by: satimis
0 Replies
8. Shell Programming and Scripting
Greetings all. I have a repository server which receives, without exhaggeration, several million files a week. The majority of these files are in .csv format, which means they're highly compressable. They are spread throughout numerous directories where there are configured monitoring utilities... (4 Replies)
Discussion started by: msarro
4 Replies
9. Shell Programming and Scripting
All
I have 2 parent directories - input and output. Each parent has multiple sub-directories...each sub-directory has multiple files. Each parent directory structure is a mirror image of itself
I need to poll the imput directory and if a new file is found, encrypt the file, move the file to... (2 Replies)
Discussion started by: davidra
2 Replies
10. UNIX for Advanced & Expert Users
Hi,
Not sure whether this is the right place to post it. I decided to post it here 'coz Advanced and Expert users will most likely have the answer to what I am looking for.
I want to backup scripts that I have access to to a tar file file and zip it. At the moment I am creating a directory... (4 Replies)
Discussion started by: newbie_01
4 Replies
LEARN ABOUT LINUX
services
SERVICES(5) Linux Programmer's Manual SERVICES(5)
NAME
services - Internet network services list
DESCRIPTION
services is a plain ASCII file providing a mapping between human-friendly textual names for internet services, and their underlying
assigned port numbers and protocol types. Every networking program should look into this file to get the port number (and protocol) for
its service. The C library routines getservent(3), getservbyname(3), getservbyport(3), setservent(3), and endservent(3) support querying
this file from programs.
Port numbers are assigned by the IANA (Internet Assigned Numbers Authority), and their current policy is to assign both TCP and UDP proto-
cols when assigning a port number. Therefore, most entries will have two entries, even for TCP-only services.
Port numbers below 1024 (so-called "low numbered" ports) can only be bound to by root (see bind(2), tcp(7), and udp(7)). This is so
clients connecting to low numbered ports can trust that the service running on the port is the standard implementation, and not a rogue
service run by a user of the machine. Well-known port numbers specified by the IANA are normally located in this root-only space.
The presence of an entry for a service in the services file does not necessarily mean that the service is currently running on the machine.
See inetd.conf(5) for the configuration of Internet services offered. Note that not all networking services are started by inetd(8), and
so won't appear in inetd.conf(5). In particular, news (NNTP) and mail (SMTP) servers are often initialized from the system boot scripts.
The location of the services file is defined by _PATH_SERVICES in <netdb.h>. This is usually set to /etc/services.
Each line describes one service, and is of the form:
service-name port/protocol [aliases ...]
where:
service-name
is the friendly name the service is known by and looked up under. It is case sensitive. Often, the client program is named
after the service-name.
port is the port number (in decimal) to use for this service.
protocol is the type of protocol to be used. This field should match an entry in the protocols(5) file. Typical values include tcp and
udp.
aliases is an optional space or tab separated list of other names for this service. Again, the names are case sensitive.
Either spaces or tabs may be used to separate the fields.
Comments are started by the hash sign (#) and continue until the end of the line. Blank lines are skipped.
The service-name should begin in the first column of the file, since leading spaces are not stripped. service-names can be any printable
characters excluding space and tab. However, a conservative choice of characters should be used to minimize compatibility problems. E.g.,
a-z, 0-9, and hyphen (-) would seem a sensible choice.
Lines not matching this format should not be present in the file. (Currently, they are silently skipped by getservent(3), getservby-
name(3), and getservbyport(3). However, this behavior should not be relied on.)
This file might be distributed over a network using a network-wide naming service like Yellow Pages/NIS or BIND/Hesiod.
A sample services file might look like this:
netstat 15/tcp
qotd 17/tcp quote
msp 18/tcp # message send protocol
msp 18/udp # message send protocol
chargen 19/tcp ttytst source
chargen 19/udp ttytst source
ftp 21/tcp
# 22 - unassigned
telnet 23/tcp
FILES
/etc/services
The Internet network services list
<netdb.h>
Definition of _PATH_SERVICES
SEE ALSO
listen(2), endservent(3), getservbyname(3), getservbyport(3), getservent(3), setservent(3), inetd.conf(5), protocols(5), inetd(8)
Assigned Numbers RFC, most recently RFC 1700, (AKA STD0002)
COLOPHON
This page is part of release 3.27 of the Linux man-pages project. A description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
Linux 2010-05-22 SERVICES(5)