USA Linux Users Group Forum Index
Log in Register FAQ Memberlist Search USA Linux Users Group Forum Index Album

Running ps ax In Terminal....

 
Post new topic   Reply to topic   printer-friendly view    USA Linux Users Group Forum Index » Servers and Server Administration
View previous topic :: View next topic  
Author Message
SteveWilliams
BANNED


Joined: 02 Dec 2024
Posts: 412
Location: Wilmer, Texas

PostPosted: Tue Mar 25, 2024 1:03 pm    Post subject: Running ps ax In Terminal.... Reply with quote

Hi I ran ps ax in terminal an I got lots of info. I am trying to point my browser to the correct port #. First issue is that it has more than 3 numbers second is I have no domain set up on this yet {Just htp://steve:<Port#>}, third: Dunno what one to look at.

I high lighted the citadel in red:

steve@root:~$ ps ax
PID TTY STAT TIME COMMAND
1 ? Ss 0:01 init [2]
2 ? S 0:00 [migration/0]
3 ? SN 0:00 [ksoftirqd/0]
truncated for length....---------------

1219 ? S< 0:00 [scsi_eh_8]
1220 ? S< 0:00 [usb-storage]

truncated for length....---------------

1219 ? S< 0:00 [scsi_eh_8]
4371 ? S 0:00 /usr/sbin/smbd -D
4557 ? Ss 0:00 /usr/sbin/gdm
4564 ? S 0:00 /usr/sbin/gdm
4582 tty7 Ss+ 0:55 /usr/bin/X :0 -dpi 96 -audit 0 -auth /var/lib/gdm/:0. 4610 ? Ss 0:00 /sbin/rpc.statd
4660 ? Ss 0:00 /usr/sbin/ntpd -p /var/run/ntpd.pid -u 105:113 -g
4708 ? Ss 0:00 /usr/local/citadel/citserver -d -h/usr/local/citadel
4709 ? Sl 0:00 /usr/local/citadel/citserver -d -h/usr/local/citadel
4755 ? Ss 0:00 /usr/local/webcit/webserver -D/var/run/webcit-ssl.pid 4756 ? Sl 0:00 /usr/local/webcit/webserver -D/var/run/webcit-ssl.pid 4799 ? Ss 0:00 /usr/sbin/cron

5003 ? Ss 0:00 /usr/sbin/munin-node
5229 tty1 Ss+ 0:00 /sbin/getty 38400 tty1
5230 tty2 Ss+ 0:00 /sbin/getty 38400 tty2
5231 tty3 Ss+
6735 pts/0 Ss 0:00 bash
6746 pts/0 R+ 0:00 ps ax
steve@root:~$

EDIT:

Point your browser to http://localhost:443 and mash Enter.



_________________
DreamLinux 2.2 MME, 2.2 MMGL, UBUNTU 7.04, UBUNTU 7.10, Debian 4.0, 3.0 Desktop Edition, Mint Linux


Last edited by SteveWilliams on Fri Mar 28, 2024 11:26 am; edited 3 times in total
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
jbsnake
Moderator


Joined: 02 Dec 2024
Posts: 1726
Location: Georgia

PostPosted: Tue Mar 25, 2024 3:15 pm    Post subject: Reply with quote

i'm a little lost as to what you are trying to accomplish



_________________
laptop: Arch Linux - Kernel 2.6.24-ARCH
server: Arch Linux - Kernel 2.6.33-ARCH
Back to top
View user's profile Send private message
platinummonkey
Advanced Member


Joined: 01 Mar 2024
Posts: 732
Location: Texas

PostPosted: Tue Mar 25, 2024 4:02 pm    Post subject: Reply with quote

Im assuming he wants this line and wants the "4799" oiut of it, or the "4756"...
Code:
 4755 ? Ss 0:00 /usr/local/webcit/webserver -D/var/run/webcit-ssl.pid 4756 ? Sl 0:00 /usr/local/webcit/webserver -D/var/run/webcit-ssl.pid 4799 ? Ss 0:00 /usr/sbin/cron


Either way, this is a reallly simple script since more than likely the output format will stay consistent throughout port changes Wink

Code:
#!/bin/bash

search="`(ps ax | grep -v grep | grep /usr/local/webcit/webserver)`" #this finds "/usr/local/webcit/webserver" in your ps ax output and removes the grep instance
if [[ ${search} != "" ]]; then # checks to see if its running, if its not running, nothing happens
   webserverport="`${search} | cut -d" " -f7`" # if you need the 2nd numeric value, replace "-f7" with "-f13" ## This just cuts out the numberers in the long string search. It's still a string, so dont try to do any math with it ;)
   echo ${webserverport} #this just prints out the port onto the terminal :)
fi


Thats just something i whipped up. Should work. enjoy Very Happy



_________________
desktop - FreeBSD 7.2
laptop & server - Archlinux i686 kernel26 2.6.32.10-1
- TAMULinux-2.0.2-ALPHA
USB Boot - Archlinux i686 kernel26 2.6.32.10-1 USB boot
Back to top
View user's profile Send private message Visit poster's website AIM Address
masinick
Linux Guru


Joined: 03 Apr 2024
Posts: 8615
Location: Concord, NH

PostPosted: Tue Mar 25, 2024 7:44 pm    Post subject: Some explanations and some questions you need to answer Reply with quote

In other words, in the previous list, we think the port number is either 4756 or 4799. I think that is an invalid assumption. Based on what I can tell from the output, those are the process IDs associated with two of the websit ssl processes. You cannot see or tell port numbers from this output, or at least I would not count on it. Having a port number that equals the PID is a bad way to design something. A port number should be a fixed number. Often there are two or more of them, usually one for the input side and another for the output side, or one for a TCP connection, another for a IP connection, and similarly for what the application does.

For a standard Web browser, port 80 is the one that is used for standard HTTP, but there is an entirely different port for secure HTTP (known as HTTPS). I don't have that port number memorized.

In general, for each application, there is one or more ports used for each specific function of the application. You need to find that out from the documentation, not from looking at process output. What you get there are called process Identifications or PID. That is what the two numbers that platinummonkey's script nicely finds for you.

So which is it? Do you need to find the PIDs or the Port Numbers? Big difference: Ports are a TCP/IP thing. PIDs are unique to what is running on any given system at any given time.

Hope this helps.



_________________
Brian Masinick
Distros: SimplyMEPIS
sidux - no CAPS!, antiX, Debian
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
tlmiller
Ultimate Member


Joined: 01 May 2024
Posts: 2434
Location: MD, USA

PostPosted: Tue Mar 25, 2024 8:49 pm    Post subject: Reply with quote

443 for https

Thanks to RH300 for that little tidbit. Very Happy



_________________
Debian Squeeze, Arch, Kubuntu mostly. Some Mandriva. Some Windows.
Desktops: shadowdragon, medusa
Laptops: bluedrake, banelord, sandwyrm, aardvark.
Back to top
View user's profile Send private message AIM Address MSN Messenger
masinick
Linux Guru


Joined: 03 Apr 2024
Posts: 8615
Location: Concord, NH

PostPosted: Tue Mar 25, 2024 10:27 pm    Post subject: Nothing to ports, here is where to find them Reply with quote

tlmiller wrote:
443 for https

Thanks to RH300 for that little tidbit. Very Happy


That's right! Had I thought about it a few minute, I could have come up with that one. Port 80 is the standard HTTP port, but I have seen ports 8080 and 8000 frequently used for private HTTP networks, particularly in companies with Firewalls, proprietary information, etc.

You do not have to remember all these port numbers. All you have to remember is one measly file: /etc/services, which defines ALL network services, including their port name and type.

So, for example, ftp-data uses port 20 and the usual ftp uses port 21, ssh uses port 22, the smtp (outbound non secure mail) uses port 25, the time server uses port 37, the pop3 inbound mail uses 110, imap4 uses 143, and on and on.

I didn't even remember the name at first, but I figured I would find it in under five minutes - it took about three. So all it really takes is knowing where to look. Configuration information is in the /etc directory and its subdirectories. Many config files are named .conf. After reviewing inet and a few others, I found it. That is all there is to learning about port names. Now learning how those ports actually WORK is a bit deeper, but for programmers that is not as hard as you may think.

Basically the kernel has implemented the idea of sockets. Various programs utilize those sockets, and both TCP and UDP implement them in special ways. The communication programs themselves at the low level are not all that big, either, though the cruft that has been placed on top of them over the years is probably huge by now. I first took a device driver course in around 1986 and have forgotten all of the deep, inner details, but its just a bunch of code and it makes sense.



_________________
Brian Masinick
Distros: SimplyMEPIS
sidux - no CAPS!, antiX, Debian
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
tlmiller
Ultimate Member


Joined: 01 May 2024
Posts: 2434
Location: MD, USA

PostPosted: Tue Mar 25, 2024 11:59 pm    Post subject: Reply with quote

Yeah, I was hitting /etc/services QUITE heavily during the RHCE test!!! still borked my config on the firewall...but realized I had done that 5 minutes after walking out. Accidentally forgot to open ports for a LOT of the stuff we had to enable!! Very Happy Oh well, would have failed anyway, and at least I know what I did there!!



_________________
Debian Squeeze, Arch, Kubuntu mostly. Some Mandriva. Some Windows.
Desktops: shadowdragon, medusa
Laptops: bluedrake, banelord, sandwyrm, aardvark.
Back to top
View user's profile Send private message AIM Address MSN Messenger
crouse
Site Admin


Joined: 17 Apr 2024
Posts: 11833
Location: Iowa

PostPosted: Wed Mar 26, 2024 3:49 am    Post subject: Reply with quote

Those are PID numbers......... "Process Identification Numbers" ......... NOT port number.
To find port numbers, try running lsof.

Example:
Code:


[root@VistaCrusher5 ~]# lsof -Pnl +M -i4
COMMAND    PID     USER   FD   TYPE DEVICE SIZE NODE NAME
ntpd      3583       87    3u  IPv4  12618       UDP 192.168.1.100:53225->208.113.193.9:123
ntpd      3583       87    5u  IPv4  15715       UDP 192.168.1.100:54782->64.85.165.96:123
ntpd      3583       87    6u  IPv4  11820       UDP 192.168.1.100:44600->208.68.160.23:123
ntpd      3583       87    7u  IPv4  14657       UDP 192.168.1.100:38772->217.160.254.116:123
ntpd      3583       87    8u  IPv4  11822       UDP 192.168.1.100:56189->205.134.191.194:123
sshd      3610        0    3u  IPv4   6778       TCP *:XXXXX (LISTEN)
cupsd     3617        0    3u  IPv4   7005       TCP 127.0.0.1:631 (LISTEN)
cupsd     3617        0    4u  IPv4   7006       UDP *:631





_________________
Veronica - Arch Linux 64-bit -- Kernel 2.6.33.4-1
Archie/Jughead - Arch Linux 32-bit -- Kernel 2.6.33.4-1
Betty/Reggie - Arch Linux (VBox) 32-bit -- Kernel 2.6.33.4-1
BumbleBee - OpenSolaris-SunOS 5.11
Back to top
View user's profile Send private message Visit poster's website AIM Address
SteveWilliams
BANNED


Joined: 02 Dec 2024
Posts: 412
Location: Wilmer, Texas

PostPosted: Wed Mar 26, 2024 7:17 pm    Post subject: ps ax In Terminal. Try this code ?..... Reply with quote

Brian

Dave is right. I need to find the port # cuz the gui won't fire up with out it {Runs in Terminal ok though} and I got some type of screwy thing going on now cuz the gui worked great the very first time.

Dave ~ dunno how to run that code you mentioned. I'll try to research it first before I ask you to print the entire thing out. Hopefully it is fairly commonly used.

Thanks for all the replies. BTW: This will eventually help me log into Citadels GUI again. I really don't care for checking my mail in Terminal. At least not yet anyway.



_________________
DreamLinux 2.2 MME, 2.2 MMGL, UBUNTU 7.04, UBUNTU 7.10, Debian 4.0, 3.0 Desktop Edition, Mint Linux
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
SteveWilliams
BANNED


Joined: 02 Dec 2024
Posts: 412
Location: Wilmer, Texas

PostPosted: Wed Mar 26, 2024 7:21 pm    Post subject: Reply with quote

Hi Dave !

Sorry for thong post. Please delete what is not necessary.

lsof> Enter got:

libnss_nis-2.3.6.so
bonobo-ac 5464 steve mem REG 8,2 30428 3260426 /lib/tls/libnss_compat-2.3.6.so
bonobo-ac 5464 steve mem REG 8,2 9436 3687554
lsof 9270 steve mem REG 8,2 88164 2640168 /lib/ld-2.3.6.so
lsof 9270 steve 4r FIFO 0,5 32240 pipe
lsof 9270 steve 7w FIFO 0,5 32241 pipe
steve@root:~$

Please advise



_________________
DreamLinux 2.2 MME, 2.2 MMGL, UBUNTU 7.04, UBUNTU 7.10, Debian 4.0, 3.0 Desktop Edition, Mint Linux


Last edited by SteveWilliams on Fri Mar 28, 2024 11:19 am; edited 2 times in total
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
jbsnake
Moderator


Joined: 02 Dec 2024
Posts: 1726
Location: Georgia

PostPosted: Wed Mar 26, 2024 10:14 pm    Post subject: Reply with quote

instead of just lsof... why not run it the same way you see Dave running it? with the same flags (lsof -Pnl +M -i4)... you still havn't mentioned what you are trying to do... you said you needed a port... but not in relation to anything other than citadel... can you give some specifics...

here... perhaps you can fill in the blanks:

"I am looking for a port number that is opened when I use the command ___________." or "The way I run the command is ___________________. " or "Here are the detailed steps I perform just before things go wrong: __________________________________________________________________________________________".



_________________
laptop: Arch Linux - Kernel 2.6.24-ARCH
server: Arch Linux - Kernel 2.6.33-ARCH
Back to top
View user's profile Send private message
SteveWilliams
BANNED


Joined: 02 Dec 2024
Posts: 412
Location: Wilmer, Texas

PostPosted: Fri Mar 28, 2024 11:18 am    Post subject: Reply with quote

jbsnake wrote:
instead of just lsof... why not run it the same way you see Dave running it? with the same flags (lsof -Pnl +M -i4)... you still havn't mentioned what you are trying to do... you said you needed a port... but not in relation to anything other than citadel... can you give some specifics...

here... perhaps you can fill in the blanks:

"I am looking for a port number that is opened when I use the command ___________." or "The way I run the command is ___________________. " or "Here are the detailed steps I perform just before things go wrong: __________________________________________________________________________________________".


JBSnake

I'm sorry jbsnake, I was trying to figure that out so I could answer you.

Basically the browser should open up Citadel if it is still on port 443 and I hoped I could find out if that port was still being used after a few installs and then if it was track down the reason why the GUI won't start.

As it turns out, it has to do with the word root not with port. Using the word local host is the issue not the port.

Again I apologise for the error.

Right now I just need to add the domain and make sure I do stuff in the right order so I can be sure to not mess it up and CREATE an issue

Thank you thank you thank you !


steve@root:~$ lsof -Pnl +M -i4
steve@root:~$



_________________
DreamLinux 2.2 MME, 2.2 MMGL, UBUNTU 7.04, UBUNTU 7.10, Debian 4.0, 3.0 Desktop Edition, Mint Linux
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    USA Linux Users Group Forum Index » Servers and Server Administration All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All content © 2024-2009 - Usa Linux Users Group
This forum is powered by phpBB. © 2024-2009 phpBB Group
Theme created by phpBBStyles.com and modified by Crouse