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 9040363
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T09:57:57+00:00 2026-06-16T09:57:57+00:00

Similar question to Linux equivalent of GetCommandLine and CommandLineToArgv Is it possible to get

  • 0

Similar question to Linux equivalent of GetCommandLine and CommandLineToArgv

Is it possible to get the raw command line in linux? The file /proc/self/cmdline is destroyd.

./a.out files="file 1","file 2" param="2"

prints

./a.outfiles=file 1,file 2param=2

which is junk

Escaping command line does work for all arguments but the first.

./a.out files=\"fil 1\",\"fil 2\"\ param=\"2\"

prints

./a.outfiles="fil1","fil2" param="2"
  • 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-16T09:57:58+00:00Added an answer on June 16, 2026 at 9:57 am

    You can’t do that. The command line arguments are actually passed to the new process as individual strings. See the linux kernel source:
    kernel_execve

    Note that kernel_execve(...) takes a const char *argv[] – so there is no such thing as a long string commandline in Linux – it’s the layer above that needs to split the arguments into separate components.

    Edit: actually, the system call is here:

    excve system call

    But the statement above still applies. The parameter for argv is already split by the time the kernel gets it from the C-library call to exec.

    It is the responsibility of the “starter of the program” (typically a shell, but doesn’t have to be) to produce the argv[] array. It will do the “globbing” (expansion of wildcard filenames to the actual files that it matches) and stripping of quotations, variable replacement and so on.

    I would also point out that although there are several variants of “exec” in the C library, there is only one way into the kernel. All variants end up in the execve system call that I linked to above. The other variants are simply because the caller may not fancy splitting arguments into invdividual elements, so the C library “helps out” by doing that for the programmer. Similarly for passing an environment array to the new program – if the programmer don’t need specific environment, he/she can just call the variant that automatically take the parent process env.

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

Sidebar

Related Questions

Liu Chang asked a very similar question to this one here, Linux equivalent of
I have asked similar question for Linux RPM ( Adding License Agreement in RPM
I have asked a similar question but I didn't get much from that one.
Similar question: How to mimic UITableView's UITableViewStylePlain section header style No complete answers. BarrettJ's
Similar question , but for Oracle. Why would I not always want to choose
Similar question: Best Resources for Learning AS3 I am interested in learning AS3 and
A similar question was asked here: PHP variable like $myvar-test is not valid? And
A similar question Long in Float, why? here does not answer what I am
A similar question was asked here Serving images from outside of document root The
A similar question was asked here but without a satisfying answer. I'm trying to

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.