LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 09-15-2012, 12:34 PM   #1
travix
LQ Newbie
 
Registered: Jul 2012
Posts: 11

Rep: Reputation: Disabled
exec command


Why is it that when I type exec ls at the command line my terminal session ends?
 
Old 09-15-2012, 12:58 PM   #2
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 9,658

Rep: Reputation: 2852Reputation: 2852Reputation: 2852Reputation: 2852Reputation: 2852Reputation: 2852Reputation: 2852Reputation: 2852Reputation: 2852Reputation: 2852Reputation: 2852
exec will start a new process, but the new process will be started in place of the parent (so the current process will not exist any more). When ls completed and the process finished your current terminal will also ended because the child process terminated (it was initially your shell, but you replaced it by exec)
 
Old 09-15-2012, 12:59 PM   #3
SecretCode
Member
 
Registered: Apr 2011
Location: UK
Distribution: Kubuntu 11.10
Posts: 562

Rep: Reputation: 102Reputation: 102
By design.

In bash, I presume?

Code:
help exec
Quote:
Replace the shell with the given command.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
perl using exec command ab52 Programming 3 08-15-2012 02:15 AM
Linux exec command grob115 Programming 4 05-02-2011 06:15 AM
find command with exec cola Linux - Newbie 5 06-01-2010 01:25 PM
exec command in Launcher? annehoog Linux - Newbie 4 11-23-2006 11:08 AM
exec bash command bendeco13 Linux - General 6 10-31-2004 03:50 PM

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

All times are GMT -5. The time now is 05:31 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration