LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-20-2021, 02:23 PM   #1
brrixx
LQ Newbie
 
Registered: Jul 2021
Posts: 1

Rep: Reputation: Disabled
Angry Linux how to find running process


Hey,

i am new to Linux and might need some help.

I ran a shell script which copys data to a directory.
Since there is a mistake in the shell script I want to stop the process.

I tried ctrl + c, ctrl + z, restarting linux.

screen -ls does not list any screen, job does not give any output either...
 
Old 07-20-2021, 04:19 PM   #2
Soadyheid
Senior Member
 
Registered: Aug 2010
Location: Near Edinburgh, Scotland
Distribution: Cinnamon Mint 20.1 (Laptop) and 20.2 (Desktop)
Posts: 1,672

Rep: Reputation: 486Reputation: 486Reputation: 486Reputation: 486Reputation: 486
Hi brrixx, Welcome to LinuxQuestions!

Check out the command ps:
Code:
$ man ps
It'll give you more info than you need!

Code:
$ ps -A
will give you a list of all running processes and their PIDs.

Code:
$ top
will give you a dynamically updated list of processes which may also be useful to you.

My

Play Bonny!"

 
Old 07-20-2021, 07:24 PM   #3
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by brrixx View Post
I ran a shell script which copys data to a directory.
Since there is a mistake in the shell script I want to stop the process.
Does the shell script run in the foreground? I.e., do you get a shell prompt after you launch the script? If so, control-C should normally interrupt it. There may be situations, when the system is very busy, that the key combination control-C is not processed immediately, or not at all.

If you can launch another shell, for example in a different window, list your processes and find which process corresponds to the script. You can also use commands like top to identify processes that use the CPU a lot. Most likely, the process(es) that you want to terminate are among those.
Quote:
I tried ctrl + c, ctrl + z, restarting linux.
What happened when you did this? Are you saying that restarting Linux did not kill the process?
Quote:
screen -ls does not list any screen, job does not give any output either...
I am not aware of a command named job. There is a command named jobs, which lists the running and stopped jobs of the shell that calls it.

I don't understand what screen has to do with your question.

Last edited by berndbausch; 07-20-2021 at 07:28 PM.
 
Old 07-20-2021, 07:35 PM   #4
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,326
Blog Entries: 28

Rep: Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142
To build on what Soadyheid's excellent suggestion, also see man kill and man killall.
 
Old 07-20-2021, 08:07 PM   #5
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,662
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
The bash shell also contains these built-in commands: jobs, fg, bg. Also nice, renice.

You can launch any command "in the background" by adding a "!" at the end of the command-line.

All of these are considered children of your shell process, and therefore will be terminated if you log out.
 
Old 07-21-2021, 02:19 AM   #6
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
Quote:
Originally Posted by sundialsvcs View Post
The bash shell also contains these built-in commands: jobs, fg, bg. Also nice, renice.

You can launch any command "in the background" by adding a "!" at the end of the command-line.

All of these are considered children of your shell process, and therefore will be terminated if you log out.
Actually that is an ampersand at the end of the line ("&").
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
API for current running process details like process name, process id, amount of memory used anki123 Linux - General 1 01-20-2019 02:06 AM
Need Help to find the process running by particular user and kill process one by one LittleMaster Linux - Newbie 1 02-09-2013 02:03 PM
Finding the Process ID of a Process While Initiating the Process senthilmuthiah Linux - Newbie 7 04-02-2009 10:37 AM
Get Process size and Thread count for a particular running process haseit Linux - Newbie 2 01-22-2009 11:09 PM
Shell Script : Kill a running process when another process starts ashmew2 Linux - General 3 08-20-2008 03:47 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:49 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration