Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9156095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:42:35+00:00 2026-06-17T12:42:35+00:00

I am using a linux command prompt and I have noticed a difference when

  • 0

I am using a linux command prompt and I have noticed a difference when using the command ‘cd’ in the command prompt and using the command as an argument of the system call in a C program.

When I use the command prompt, the directory changes to the directory in the $home environment variable, but if I call it using the system call, then the directory doesn’t change?

Why is this happening?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T12:42:36+00:00Added an answer on June 17, 2026 at 12:42 pm

    The cd command is a shell builtin — when it is executed by a shell script or on the command prompt, it is interpreted by that shell directly, and changes the working directory of the shell process.

    When you run a cd command from within a system() call, the command is passed to a shell subprocess, and changes the working directory of that process, which promptly exits. The working directory of the parent process is left unchanged.

    If you need to change the working directory of the current process, call chdir() directly. Note that you can’t change the working directory of other processes (the child process is independent of its parent).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have compiled my application on Linux (Intel) machine using this command gcc –g
My system is Arch linux. I try to install passenger-nginx by using the command
I am using a interactive command line program in a Linux terminal running the
I am using the Linux command line, I have created a Private Key using
I want to use a linux command line tool from my Java program. I
I am trying to simulate linux command ls using linux api from c. Looking
Specifically, I'm using the Linux command: $ find . -regextype posix-extended -regex '<some regex>'
I'm using the split linux command to split huge xml files into node-sized ones.
I built wxWidgets on Linux using this command: ../configure --enable-shared --disable-debug It see results
I start Firefox (Linux) via command line using a cron-job. When there is no

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.