![]() |
working between 2-shells
i have opened a file using vi in 1st shell ,
now i want to kill it , using my another shell ..... How can i kill it . |
Code:
wim@aa0:/boot/grub$ ps -ef |grep vi |
Do you mean shell or VT (virtual terminal)?
In any case, if you're logged in as the same user in the second VT, kill vi running in the first VT with: Code:
kill $(pgrep vi) # or, |
see i have 2-accounts ! daa & daa_1
now i have created a file f_1 and use vi to view it , with the help of daa's command prompt , so vi process is un run state ! now i want to kill this process using daa_1's command prompt . how can i do this ! |
You can kill any process by doing 'ps ax' to find the ID number of the process you want to kill. Once you know that number, just do 'kill #' (where # = PID). If the process doesn't wanna die, do "kill -9 #"
|
in my first_account
Code:
daa@daa-Aspire-5740:~/only_for_unix$ vi f_1 & Code:
daa_1@daa-Aspire-5740: kill -9 5778 |
From account daa_1 issue 'sudo -u daa kill -9 5778'. If that doesn't work then you need to configure Sudo to allow it, but more importantly please don't consider 'kill -9' as the convenient, default way to exit applications as it may leave temporary files when an editor is in edit mode or may deny an application to close its file descriptors properly.
|
Of course you can't do it as another user; that would be a nice mess if anybody in a multi user system can kill the processes of other users. Totally defeats the security model.
The only user that can do this is root, so you need to be root (seeing that you're using ubuntu, sudo will do the trick). In your case, as you know daa's password Code:
daa_1@daa-Aspire-5740: su - daa |
sorry , for wrong post !
|
Nothing to be sorry about. You (and others) can learn from your question and the replies.
If it's solved, please mark it as such using the thread tools above the first post. |
but i find , something from your post
Code:
that would be a nice mess if anybody in a multi user system can kill the processes of other users. Totally defeats the security model. Code:
chmod 777 file_name Code:
sudo kill -9 file_name |
In that case you (as daa) give explicit permission to other users (e.g. daa1) to do anything with the file.
Also be aware that by using sudo, you basically elevate your privileges to those of a root user. I've never never used kill to delete a file; will one day test it. |
Quote:
|
That's not the way it was used by OP and that's what I was referring to.
|
All times are GMT -5. The time now is 10:34 PM. |