Quick Unix Question

The geek forum. PHP, Perl, HTML, hardware questions etc.. it's all in here. Got a techie question? We'll sort you out. Ask your questions or post a link to your own site here!

Quick Unix Question

Postby Slater » Thu Feb 23, 2006 1:02 am

I heard today from my professor about a student who got in trouble for running the command "find \ -mdate +0" on libra (campus server for students to work on, holding tens of thousands of accounts). They say that the computer processed it for weeks before the system admins found it and made it stop. I'm just wondering... cause I can see myself doing something stupid like that in the future, how do you terminate such a process once it gets going?
Image
User avatar
Slater
 
Posts: 2671
Joined: Sat May 22, 2004 10:00 am
Location: Pacifica, Caliphornia

Postby blkmage » Thu Feb 23, 2006 4:26 am

"killall" or "kill".
"killall" for killing the process by name.
"kill" for killing the process by process ID.
You can find the processes by using "ps aux".
User avatar
blkmage
 
Posts: 4529
Joined: Mon May 03, 2004 5:40 pm

Postby shooraijin » Thu Feb 23, 2006 6:29 am

... or ps -ef on older, stupider -- er, non-BSD-aware ;) -- systems (not sure which Unix this is).

btw, he probably meant 'find / ...' since most Unices don't use \ as a path delimiter.
"you're a doctor.... and 27 years.... so...doctor + 27 years = HATORI SOHMA" - RoyalWing, when I was 27
"Al hail the forum editting Shooby! His vibes are law!" - Osaka-chan

I could still be champ, but I'd feel bad taking it away from one of the younger guys. - George Foreman
User avatar
shooraijin
 
Posts: 9927
Joined: Thu Jun 26, 2003 12:00 pm
Location: Southern California

Postby Slater » Thu Feb 23, 2006 9:41 am

I always get forward and backwards slashes mixed, heh.

Thanx for the commands!
Image
User avatar
Slater
 
Posts: 2671
Joined: Sat May 22, 2004 10:00 am
Location: Pacifica, Caliphornia

Postby Mithrandir » Thu Feb 23, 2006 8:31 pm

Yup. "ps -ax | grep find" will tell you what the ID of the process ID is, and you can use kill on that ID. If you have a newer system, you can probably use "killall -TERM find" and get your process killed off quickly. That's more a linux style than, say, HPUX.
User avatar
Mithrandir
 
Posts: 11071
Joined: Fri Jun 27, 2003 12:00 pm
Location: You will be baked. And then there will be cake.

Postby Slater » Fri Mar 10, 2006 12:33 pm

uhm... I just typed in 'fgrep "new"' and ran it and apparently this started a search through /. I tried all of the above things to try to kill it and the OS tells me that I don't have security clearance to run those commands (since I am logged in remotely). Any other suggestions before the campus police come knocking on my door?
Image
User avatar
Slater
 
Posts: 2671
Joined: Sat May 22, 2004 10:00 am
Location: Pacifica, Caliphornia

Postby Kaligraphic » Fri Mar 10, 2006 1:05 pm

Perhaps you could call whoever's in charge of the server, and ask their help. Calling in after a process has been running for, say, an hour, and identifying what needs to be killed is nowhere near as bad as just letting a job run and tie things up for the admins to find later while investigating user complaints.
The cake used to be a lie like you, but then it took a portal to the deception core.
User avatar
Kaligraphic
 
Posts: 2002
Joined: Wed Jul 21, 2004 12:00 pm
Location: The catbox of DOOM!

Postby shooraijin » Fri Mar 10, 2006 5:55 pm

Slater wrote:uhm... I just typed in 'fgrep "new"' and ran it and apparently this started a search through /. I tried all of the above things to try to kill it and the OS tells me that I don't have security clearance to run those commands (since I am logged in remotely). Any other suggestions before the campus police come knocking on my door?


I don't follow. How would

fgrep "new"

go through /? You haven't specified anything to search. It'll just sit there and expect data on standard input.
"you're a doctor.... and 27 years.... so...doctor + 27 years = HATORI SOHMA" - RoyalWing, when I was 27
"Al hail the forum editting Shooby! His vibes are law!" - Osaka-chan

I could still be champ, but I'd feel bad taking it away from one of the younger guys. - George Foreman
User avatar
shooraijin
 
Posts: 9927
Joined: Thu Jun 26, 2003 12:00 pm
Location: Southern California

Postby Mithrandir » Fri Mar 10, 2006 11:41 pm

Well, if you have a process that's going nuts, I'd use ctrl-c to cancel it. You'll have to wait for the video buffer to catch up to the actual program, though, which took some time on some old dumb terminals, as I recall.

Shooby's right, though. I don't think that program would do anything at all (as far as I can tell) if you ran it that way. Maybe with an asterisk after it you'd get those errors... If you did it like this:

cd /
fgrep "new" *

That would do it.
User avatar
Mithrandir
 
Posts: 11071
Joined: Fri Jun 27, 2003 12:00 pm
Location: You will be baked. And then there will be cake.

Postby Slater » Sat Mar 11, 2006 12:57 am

yeah, I did a ctrl-d and it died. I need to study my unix a little more before running arbitrary commands...
Image
User avatar
Slater
 
Posts: 2671
Joined: Sat May 22, 2004 10:00 am
Location: Pacifica, Caliphornia

Postby Kaligraphic » Sat Mar 11, 2006 10:31 pm

Note to self: read post thoroughly before responding. :)

When I started learning the Unixey way of doing things, I used to pull up the manpage of every command I'd run - yes, even grep.
The cake used to be a lie like you, but then it took a portal to the deception core.
User avatar
Kaligraphic
 
Posts: 2002
Joined: Wed Jul 21, 2004 12:00 pm
Location: The catbox of DOOM!

Postby Slater » Sat Mar 11, 2006 10:33 pm

I don't like man. I don't like reading 500 pages of stuff for every command x.x
Image
User avatar
Slater
 
Posts: 2671
Joined: Sat May 22, 2004 10:00 am
Location: Pacifica, Caliphornia

Postby LorentzForce » Sat Mar 11, 2006 10:58 pm

Well, you'll have to get used to it. There's no way around it.
Image
User avatar
LorentzForce
 
Posts: 1263
Joined: Sun Jun 01, 2003 3:18 am
Location: Between B and E

Postby Mithrandir » Sun Mar 12, 2006 7:42 am

LF is right. If you want to learn how things work, man is the way to go. Try using it on a command you are fairly fluent in and see how much more the command can do you never knew about.
User avatar
Mithrandir
 
Posts: 11071
Joined: Fri Jun 27, 2003 12:00 pm
Location: You will be baked. And then there will be cake.

Postby Slater » Sun Mar 12, 2006 10:25 am

hmm... well, my professor said that it would either be using man or getting the book "Unix in a Nutshell," which is like a dictionary of every command in unix. Perhaps the book isn't such a bad idea...
Image
User avatar
Slater
 
Posts: 2671
Joined: Sat May 22, 2004 10:00 am
Location: Pacifica, Caliphornia

Postby Kaligraphic » Sun Mar 12, 2006 2:16 pm

I think you may find man more to your liking when you start seeing the cool things that you can do. I learned so much just by typing man bash that it's not even funny.

But most commands only have a couple of pages, really. bash has a long manpage because it teaches you how to use the shell - all the little tricks, so to speak.
The cake used to be a lie like you, but then it took a portal to the deception core.
User avatar
Kaligraphic
 
Posts: 2002
Joined: Wed Jul 21, 2004 12:00 pm
Location: The catbox of DOOM!

Postby Mithrandir » Sun Mar 12, 2006 3:49 pm

There are, however, somethings man can't tell you:


Code: Select all
lum:~ mithrandir$ man "getting girls to like you."
No manual entry for getting girls to like you.


Of course, the computer's power is limited:

Code: Select all
lum:~ mithrandir$ find "my purpose in life"
find: my purpose in life: No such file or directory



(Note: these are the actual responses from the programs.)
User avatar
Mithrandir
 
Posts: 11071
Joined: Fri Jun 27, 2003 12:00 pm
Location: You will be baked. And then there will be cake.

Postby shooraijin » Sun Mar 12, 2006 6:40 pm

I always liked

% ping elvis
elvis is alive

but that doesn't work on many systems anymore.

Oh, and

% how is my studliness'
Unmatched '.
"you're a doctor.... and 27 years.... so...doctor + 27 years = HATORI SOHMA" - RoyalWing, when I was 27
"Al hail the forum editting Shooby! His vibes are law!" - Osaka-chan

I could still be champ, but I'd feel bad taking it away from one of the younger guys. - George Foreman
User avatar
shooraijin
 
Posts: 9927
Joined: Thu Jun 26, 2003 12:00 pm
Location: Southern California

Postby shooraijin » Sun Mar 12, 2006 6:41 pm

Also, what is it with you people and shells? tcsh is God's Chosen Shell. It is Salvation.
"you're a doctor.... and 27 years.... so...doctor + 27 years = HATORI SOHMA" - RoyalWing, when I was 27
"Al hail the forum editting Shooby! His vibes are law!" - Osaka-chan

I could still be champ, but I'd feel bad taking it away from one of the younger guys. - George Foreman
User avatar
shooraijin
 
Posts: 9927
Joined: Thu Jun 26, 2003 12:00 pm
Location: Southern California


Return to Computing and Links

Who is online

Users browsing this forum: No registered users and 210 guests