Hi,
I was just wondering whther we can find out working directory of users logged in the system.
Any suggestions ?
-Anshul
On Jun 8, 2001 at 22:41, Anshul Gupta wrote:
I was just wondering whther we can find out working directory of users logged in the system.
finger them.
Hi satya,
That would give me home directory, what I am looking for is present working directory for a particular user.
-Anshul
----- Original Message ----- From: "Satya" satyap@satya.virtualave.net To: linuxers@mm.ilug-bom.org.in Sent: Saturday, June 09, 2001 12:04 AM Subject: Re: [ILUG-BOM] wd of user
Mail from ILUG-BOM List!
On Jun 8, 2001 at 22:41, Anshul Gupta wrote:
I was just wondering whther we can find out working directory of users logged in the system.
finger them.
-- Satya. URL:http://satya.virtualave.net/ US-bound grad students! For pre-apps, see URL:http://quickapps.cjb.net/ Computer lie #1: you'll never use all that disk space.
Linuxers mailing list Linuxers@mm.ilug-bom.org.in http://mm.ilug-bom.org.in/mailman/listinfo/linuxers
Sometime today, Anshul Gupta wrote:
That would give me home directory, what I am looking for is present working directory for a particular user.
I think every instance of the shell has its own current working directory. Can you tell what's the purpose of finding the wd of every user? Perhaps we can find other (better) ways of solving your problem.
Manish
Hi,
w shows the commands users are executing but sometimes they only make sense when you know in which directory they are been executed.
If the user executes some backgroud job such as "tail -f somefile" and then changes his directory. And then lists of background process thru "jobs" he will get the wd in which the job was intiated.
I am also looking for something similar but instead of looking my own jobs, I want to see the wd of other users.
I hope somebody else is also feeling the need of knowing wd of others now.
TIA,
-Anshul
----- Original Message ----- From: "Manish Jethani" cruisecoder@yahoo.com To: linuxers@mm.ilug-bom.org.in Sent: Saturday, June 09, 2001 11:32 AM Subject: Re: [ILUG-BOM] wd of user
Mail from ILUG-BOM List!
Sometime today, Anshul Gupta wrote:
That would give me home directory, what I am looking for is present working directory for a particular user.
I think every instance of the shell has its own current working directory. Can you tell what's the purpose of finding the wd of every user? Perhaps we can find other (better) ways of solving your problem.
Manish
-- Tact is the ability to tell a man he has an open mind when he has a hole in his head.
Linuxers mailing list Linuxers@mm.ilug-bom.org.in http://mm.ilug-bom.org.in/mailman/listinfo/linuxers
On Sat, 9 Jun 2001, Anshul Gupta wrote:
I hope somebody else is also feeling the need of knowing wd of others now.
I think you got your answer. Use the script that Ambarish has written, or try to write one on your own. You need to get the PID of the shell and peep inside /proc/<PID>/cwd for the wd of the shell.
Manish
Anshul Gupta wrote:
I am also looking for something similar but instead of looking my own jobs, I want to see the wd of other users.
btw, the script i had sent will work only if root is using it. the processes which $USER fires are represented in /proc as directories with the PID as the directory-name, *and* with read/execute perms only for the $USER. thus, only if $USER is root, the script will be able to show the working-directories of other user(s).
the above comment just to remove any doubts. ;)
Sometime today, Anshul Gupta wrote:
That would give me home directory, what I am looking for is present working directory for a particular user.
Okay, got it. Figure out the PID of the shell the user is using (use ps). Then (assuming the PID of the user's login shell is 2547),
(cd /proc/2547/cwd; pwd)
That should give you the wd of the user. Look at the ps manpage to see how you can extract the users' login shell PID.
Manish