How does cp -a work Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)How does one open a .RTA file?How do I find and copy an arbitrary list of files in terminal?how to copy a file to the desktopHow to copy files from a dead Ubuntu 12.04How to copy only files (.wrk) from multiple directories and subfolders16.04 - Copy Dialog disappears and nothing seems to workcopy does not work in gnome-shelldoes linux docker work better on particular file type?Nature of Permissions - Copy Fails on my Own FilesHow do I copy only files that overwrite others in a directory

How to bypass password on Windows XP account?

What happens to sewage if there is no river near by?

How can players work together to take actions that are otherwise impossible?

Does the Giant Rocktopus have a Swim Speed?

Why was the term "discrete" used in discrete logarithm?

Is a manifold-with-boundary with given interior and non-empty boundary essentially unique?

What's the purpose of writing one's academic bio in 3rd person?

How to recreate this effect in Photoshop?

When is phishing education going too far?

Should I use Javascript Classes or Apex Classes in Lightning Web Components?

Stars Make Stars

Does polymorph use a PC’s CR or its level?

List *all* the tuples!

What are the motives behind Cersei's orders given to Bronn?

What does '1 unit of lemon juice' mean in a grandma's drink recipe?

Single word antonym of "flightless"

Does accepting a pardon have any bearing on trying that person for the same crime in a sovereign jurisdiction?

Is there a documented rationale why the House Ways and Means chairman can demand tax info?

Should gear shift center itself while in neutral?

Should I call the interviewer directly, if HR aren't responding?

What is the longest distance a 13th-level monk can jump while attacking on the same turn?

ListPlot join points by nearest neighbor rather than order

Did Kevin spill real chili?

Letter Boxed validator



How does cp -a work



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)How does one open a .RTA file?How do I find and copy an arbitrary list of files in terminal?how to copy a file to the desktopHow to copy files from a dead Ubuntu 12.04How to copy only files (.wrk) from multiple directories and subfolders16.04 - Copy Dialog disappears and nothing seems to workcopy does not work in gnome-shelldoes linux docker work better on particular file type?Nature of Permissions - Copy Fails on my Own FilesHow do I copy only files that overwrite others in a directory



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








2















I am trying to understand linux and working through some tutorials. One states that I can copy files to the current directory by using a cp -a command with a relative pathname such as



cp -a ../somedir/. 


It fails each time I run it. Is the syntax incorrect?

I tried the man page, but it didn't seem to find anything that answers my question.










share|improve this question









New contributor




NodeNewb is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.















  • 1





    you are missing a blank space between somedir and the last dot. See vidarlo 's answer, it is correct. Upvote it! Accept it!

    – Henrique
    2 hours ago











  • Also something I wish I had known a whole lot earlier when learning Linux & bash is that you can press tab to get autocomplete; press it twice for suggestions.

    – rm-vanda
    2 hours ago

















2















I am trying to understand linux and working through some tutorials. One states that I can copy files to the current directory by using a cp -a command with a relative pathname such as



cp -a ../somedir/. 


It fails each time I run it. Is the syntax incorrect?

I tried the man page, but it didn't seem to find anything that answers my question.










share|improve this question









New contributor




NodeNewb is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.















  • 1





    you are missing a blank space between somedir and the last dot. See vidarlo 's answer, it is correct. Upvote it! Accept it!

    – Henrique
    2 hours ago











  • Also something I wish I had known a whole lot earlier when learning Linux & bash is that you can press tab to get autocomplete; press it twice for suggestions.

    – rm-vanda
    2 hours ago













2












2








2








I am trying to understand linux and working through some tutorials. One states that I can copy files to the current directory by using a cp -a command with a relative pathname such as



cp -a ../somedir/. 


It fails each time I run it. Is the syntax incorrect?

I tried the man page, but it didn't seem to find anything that answers my question.










share|improve this question









New contributor




NodeNewb is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












I am trying to understand linux and working through some tutorials. One states that I can copy files to the current directory by using a cp -a command with a relative pathname such as



cp -a ../somedir/. 


It fails each time I run it. Is the syntax incorrect?

I tried the man page, but it didn't seem to find anything that answers my question.







files copy






share|improve this question









New contributor




NodeNewb is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




NodeNewb is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 2 hours ago









zx485

1,47131315




1,47131315






New contributor




NodeNewb is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 3 hours ago









NodeNewbNodeNewb

111




111




New contributor




NodeNewb is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





NodeNewb is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






NodeNewb is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







  • 1





    you are missing a blank space between somedir and the last dot. See vidarlo 's answer, it is correct. Upvote it! Accept it!

    – Henrique
    2 hours ago











  • Also something I wish I had known a whole lot earlier when learning Linux & bash is that you can press tab to get autocomplete; press it twice for suggestions.

    – rm-vanda
    2 hours ago












  • 1





    you are missing a blank space between somedir and the last dot. See vidarlo 's answer, it is correct. Upvote it! Accept it!

    – Henrique
    2 hours ago











  • Also something I wish I had known a whole lot earlier when learning Linux & bash is that you can press tab to get autocomplete; press it twice for suggestions.

    – rm-vanda
    2 hours ago







1




1





you are missing a blank space between somedir and the last dot. See vidarlo 's answer, it is correct. Upvote it! Accept it!

– Henrique
2 hours ago





you are missing a blank space between somedir and the last dot. See vidarlo 's answer, it is correct. Upvote it! Accept it!

– Henrique
2 hours ago













Also something I wish I had known a whole lot earlier when learning Linux & bash is that you can press tab to get autocomplete; press it twice for suggestions.

– rm-vanda
2 hours ago





Also something I wish I had known a whole lot earlier when learning Linux & bash is that you can press tab to get autocomplete; press it twice for suggestions.

– rm-vanda
2 hours ago










2 Answers
2






active

oldest

votes


















5














cp -a ../somedir/. is wrong. The general syntax is



cp source target


You only specified one argument. To copy something to current directory, you can run



cp ../somedir .


Note the space before the dot. . is shorthand for current directory. .. is shorthand for parent directory.






share|improve this answer























  • +1 but I would have added how -a maintains last access stamps or something like that :)

    – WinEunuuchs2Unix
    9 mins ago


















0














You can say:



cp -a ../somedir .
if you want to copy the folder it self with its content



Or you can say



cp -a ../somedir/* .
If you want to copy the content of the folder.



the -a option will try to clone the same file structure with the same file tree to the new location






share|improve this answer








New contributor




sh.alawneh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "89"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );






    NodeNewb is a new contributor. Be nice, and check out our Code of Conduct.









    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1134176%2fhow-does-cp-a-work%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    5














    cp -a ../somedir/. is wrong. The general syntax is



    cp source target


    You only specified one argument. To copy something to current directory, you can run



    cp ../somedir .


    Note the space before the dot. . is shorthand for current directory. .. is shorthand for parent directory.






    share|improve this answer























    • +1 but I would have added how -a maintains last access stamps or something like that :)

      – WinEunuuchs2Unix
      9 mins ago















    5














    cp -a ../somedir/. is wrong. The general syntax is



    cp source target


    You only specified one argument. To copy something to current directory, you can run



    cp ../somedir .


    Note the space before the dot. . is shorthand for current directory. .. is shorthand for parent directory.






    share|improve this answer























    • +1 but I would have added how -a maintains last access stamps or something like that :)

      – WinEunuuchs2Unix
      9 mins ago













    5












    5








    5







    cp -a ../somedir/. is wrong. The general syntax is



    cp source target


    You only specified one argument. To copy something to current directory, you can run



    cp ../somedir .


    Note the space before the dot. . is shorthand for current directory. .. is shorthand for parent directory.






    share|improve this answer













    cp -a ../somedir/. is wrong. The general syntax is



    cp source target


    You only specified one argument. To copy something to current directory, you can run



    cp ../somedir .


    Note the space before the dot. . is shorthand for current directory. .. is shorthand for parent directory.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered 2 hours ago









    vidarlovidarlo

    10.7k52852




    10.7k52852












    • +1 but I would have added how -a maintains last access stamps or something like that :)

      – WinEunuuchs2Unix
      9 mins ago

















    • +1 but I would have added how -a maintains last access stamps or something like that :)

      – WinEunuuchs2Unix
      9 mins ago
















    +1 but I would have added how -a maintains last access stamps or something like that :)

    – WinEunuuchs2Unix
    9 mins ago





    +1 but I would have added how -a maintains last access stamps or something like that :)

    – WinEunuuchs2Unix
    9 mins ago













    0














    You can say:



    cp -a ../somedir .
    if you want to copy the folder it self with its content



    Or you can say



    cp -a ../somedir/* .
    If you want to copy the content of the folder.



    the -a option will try to clone the same file structure with the same file tree to the new location






    share|improve this answer








    New contributor




    sh.alawneh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.
























      0














      You can say:



      cp -a ../somedir .
      if you want to copy the folder it self with its content



      Or you can say



      cp -a ../somedir/* .
      If you want to copy the content of the folder.



      the -a option will try to clone the same file structure with the same file tree to the new location






      share|improve this answer








      New contributor




      sh.alawneh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















        0












        0








        0







        You can say:



        cp -a ../somedir .
        if you want to copy the folder it self with its content



        Or you can say



        cp -a ../somedir/* .
        If you want to copy the content of the folder.



        the -a option will try to clone the same file structure with the same file tree to the new location






        share|improve this answer








        New contributor




        sh.alawneh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.










        You can say:



        cp -a ../somedir .
        if you want to copy the folder it self with its content



        Or you can say



        cp -a ../somedir/* .
        If you want to copy the content of the folder.



        the -a option will try to clone the same file structure with the same file tree to the new location







        share|improve this answer








        New contributor




        sh.alawneh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        share|improve this answer



        share|improve this answer






        New contributor




        sh.alawneh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        answered 27 mins ago









        sh.alawnehsh.alawneh

        11




        11




        New contributor




        sh.alawneh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.





        New contributor





        sh.alawneh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.






        sh.alawneh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.




















            NodeNewb is a new contributor. Be nice, and check out our Code of Conduct.









            draft saved

            draft discarded


















            NodeNewb is a new contributor. Be nice, and check out our Code of Conduct.












            NodeNewb is a new contributor. Be nice, and check out our Code of Conduct.











            NodeNewb is a new contributor. Be nice, and check out our Code of Conduct.














            Thanks for contributing an answer to Ask Ubuntu!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1134176%2fhow-does-cp-a-work%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Isurus Índice Especies | Notas | Véxase tamén | Menú de navegación"A compendium of fossil marine animal genera (Chondrichthyes entry)"o orixinal"A review of the Tertiary fossil Cetacea (Mammalia) localities in wales port taf Museum Victoria"o orixinalThe Vertebrate Fauna of the Selma Formation of Alabama. Part VII. Part VIII. The Mosasaurs The Fishes50419737IDsh85068767Isurus2548834613242066569678159923NHMSYS00210535017845105743

            Is 1 ppb equal to 1 μg/kg? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)How to determine the concentration after a dilution with Beer's law?What would be SMILES notation for a compound with delocalized bonding?Amount of substance of a molecule in a solute the same as amount of substance of constituent elements?Interpreting notation format 1.64E-02 from particulate emission dataWhat was the lithium concentration in 1940's 7-Up?Why are osmoles not considered SI units?Why is Ka constant when volume is increased?Should residual sodium be considered in measuring sodium content of sweat?Concentration of mercury in bodyConversion from a PPB value to µg/m3 of Isobutylene

            What does “fit” mean in this sentence? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)How does 'jealousy' mean 'suspicion'?What does “not so say” mean?Does “somebody of my caliber” mean the speaker themselves?“accounting for high fasting blood glucose”- help about the meaningWhat does “cloaked by NDA” mean in this context?What does it mean by 'community ownership' in this context?What does “human corroborators” mean in this context?What does “everything but a fire” mean in this context?What does “run” mean here?What does “rabbited” mean/imply in this sentence?