12-15-2004
How a program can know where it is located by itself?
Hello, I'm a begginer of programming in UNIX platform.
Now I'm trying to make a C program on Hp-UX11i
and the program needs to know its absolute path
when it is executed.
the current directory of the program is not enough,
because the program may change the current directory...
I need to know where it is located.
If you know how to get such information or good tutorial site,
please tell me.
regards.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
From doing some research it should be /dev/sda (SCSI drive) but mine doesn't display that. How can I find out where it is located? (1 Reply)
Discussion started by: shorty
1 Replies
2. Solaris
Hi all,
I have an intriguing question....
Consider these options..(obtained the first installations of solaris)
1.solaris installation -console mode
2.single user login
3.update drivers
I wanted to know which script handles this and where it is located?
Does anyone know the absolute... (0 Replies)
Discussion started by: wrapster
0 Replies
3. Shell Programming and Scripting
Hi,
I have successfully copied a file from one server to another using following command.
user1@server1# scp test.jsp user2@server2:/home/
Now i want to delete that copied file(test.jsp) from "server2" by running some command from server1.
Please help... (2 Replies)
Discussion started by: SanketJOSHI
2 Replies
4. UNIX for Dummies Questions & Answers
Hi,
i want to know on which device a file is located
is there any command or anyway to know it
thanks
santosh (5 Replies)
Discussion started by: santosh149
5 Replies
5. Shell Programming and Scripting
Hi,
I have to determine which VALID users made a failed loggon attempts on our server.To make a long story short, I have isolated the list of all the usernames and number of attempts in one file, and have isolated the valid users who have made failed loggon attempts in another file. I now have... (2 Replies)
Discussion started by: mojoman
2 Replies
6. Hardware
Hi friends,
I hope you are doing well. Can you please tell me which part of the motherboard contains the BIOS software, name that exact location. And could please give me the names of the firmwares for atleast 5 archetictures, like sun sparc, ibm power, hp alpha etc.
Looking forward to your... (0 Replies)
Discussion started by: gabam
0 Replies
7. Programming
Hi friends,
I hope everyone is doing fine. I have this confusion, hope you can help me out with it. The header files contain only function prototypes. Where are the function definitions located. For example, if I would like to see how printf works, where can I see its definition, stdio.h only... (2 Replies)
Discussion started by: gabam
2 Replies
8. UNIX for Dummies Questions & Answers
Been through all my /sys /sbin /bin directories and can't seem to find it. (2 Replies)
Discussion started by: jcnewton13
2 Replies
9. IP Networking
Hi,
I have a rather strange IP question...
Here's my problem:
I have a Linux box (call it "turing") with 2 NICs.
One network interface (eth0) has an IP assigned, say 192.168.42.50.
The other interface (eth1) is up, but has no IP yet.
My question: is it possible to determine from... (3 Replies)
Discussion started by: NH2
3 Replies
10. Linux
Hello, please where are located DNS files on various linux distributions?
Mainly im interested in CentOS (RedHat) and Ubuntu (Debian).
I mean i will be changing IPs and i have registered nameservers on my domain registar and it points to OLD IP, so i need to know in which files to edit on... (3 Replies)
Discussion started by: postcd
3 Replies
PIDOF(8) Linux System Administrator's Manual PIDOF(8)
NAME
pidof -- find the process ID of a running program.
SYNOPSIS
pidof [-s] [-c] [-n] [-x] [-o omitpid[,omitpid..]] [-o omitpid[,omitpid..]..] program [program..]
DESCRIPTION
Pidof finds the process id's (pids) of the named programs. It prints those id's on the standard output. This program is on some systems
used in run-level change scripts, especially when the system has a System-V like rc structure. In that case these scripts are located in
/etc/rc?.d, where ? is the runlevel. If the system has a start-stop-daemon (8) program that should be used instead.
OPTIONS
-s Single shot - this instructs the program to only return one pid.
-c Only return process ids that are running with the same root directory. This option is ignored for non-root users, as they will be
unable to check the current root directory of processes they do not own.
-n Avoid stat(2) system function call on all binaries which are located on network based file systems like NFS. Instead of using this
option the the variable PIDOF_NETFS may be set and exported.
-x Scripts too - this causes the program to also return process id's of shells running the named scripts.
-o omitpid
Tells pidof to omit processes with that process id. The special pid %PPID can be used to name the parent process of the pidof pro-
gram, in other words the calling shell or shell script.
EXIT STATUS
0 At least one program was found with the requested name.
1 No program was found with the requested name.
NOTES
pidof is actually the same program as killall5; the program behaves according to the name under which it is called.
When pidof is invoked with a full pathname to the program it should find the pid of, it is reasonably safe. Otherwise it is possible that
it returns pids of running programs that happen to have the same name as the program you're after but are actually other programs. Note
that that the executable name of running processes is calculated with readlink(2), so symbolic links to executables will also match.
SEE ALSO
shutdown(8), init(8), halt(8), reboot(8), killall5(8)
AUTHOR
Miquel van Smoorenburg, miquels@cistron.nl
01 Sep 1998 PIDOF(8)