Text file output of directory contents

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP








up vote
0
down vote

favorite












My apologies if this has been asked before. I am using Ubuntu 16.04.3 desktop and would like to be able to output the contents (file names) of a directory into a single text file via terminal/cli.



I think when I used to use DOS, years back, went something like this: dir /w/p > file.txt
..think that was it, but simple and damn handy



Thank you for your time and help with my question










share|improve this question

























    up vote
    0
    down vote

    favorite












    My apologies if this has been asked before. I am using Ubuntu 16.04.3 desktop and would like to be able to output the contents (file names) of a directory into a single text file via terminal/cli.



    I think when I used to use DOS, years back, went something like this: dir /w/p > file.txt
    ..think that was it, but simple and damn handy



    Thank you for your time and help with my question










    share|improve this question























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      My apologies if this has been asked before. I am using Ubuntu 16.04.3 desktop and would like to be able to output the contents (file names) of a directory into a single text file via terminal/cli.



      I think when I used to use DOS, years back, went something like this: dir /w/p > file.txt
      ..think that was it, but simple and damn handy



      Thank you for your time and help with my question










      share|improve this question













      My apologies if this has been asked before. I am using Ubuntu 16.04.3 desktop and would like to be able to output the contents (file names) of a directory into a single text file via terminal/cli.



      I think when I used to use DOS, years back, went something like this: dir /w/p > file.txt
      ..think that was it, but simple and damn handy



      Thank you for your time and help with my question







      files text






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Feb 18 at 1:46









      Sean S

      11




      11




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote













          The general command for listing directory contents in Linux is ls



          LS(1) User Commands LS(1)

          NAME
          ls - list directory contents

          SYNOPSIS
          ls [OPTION]... [FILE]...

          DESCRIPTION
          List information about the FILEs (the current directory by default).
          Sort entries alphabetically if none of -cftuvSUX nor --sort is speci‐
          fied.


          Probably the nearest equivalent to dir /w will be ls -C (the /p option - pause - doesn't really make sense when writing to a file). So



          ls -C > file.txt


          In fact, there's a dir command in Linux as well - so you could just do dir > file.txt



          See Difference between 'dir' and 'ls' terminal commands?






          share|improve this answer




















          • Thank you for your help steeldriver, appreciate it. Very true about the /p option, just so use to using it to pause dir output. Take care and thank you again ;)
            – Sean S
            Feb 28 at 2:10











          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',
          convertImagesToLinks: true,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1007251%2ftext-file-output-of-directory-contents%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          1
          down vote













          The general command for listing directory contents in Linux is ls



          LS(1) User Commands LS(1)

          NAME
          ls - list directory contents

          SYNOPSIS
          ls [OPTION]... [FILE]...

          DESCRIPTION
          List information about the FILEs (the current directory by default).
          Sort entries alphabetically if none of -cftuvSUX nor --sort is speci‐
          fied.


          Probably the nearest equivalent to dir /w will be ls -C (the /p option - pause - doesn't really make sense when writing to a file). So



          ls -C > file.txt


          In fact, there's a dir command in Linux as well - so you could just do dir > file.txt



          See Difference between 'dir' and 'ls' terminal commands?






          share|improve this answer




















          • Thank you for your help steeldriver, appreciate it. Very true about the /p option, just so use to using it to pause dir output. Take care and thank you again ;)
            – Sean S
            Feb 28 at 2:10















          up vote
          1
          down vote













          The general command for listing directory contents in Linux is ls



          LS(1) User Commands LS(1)

          NAME
          ls - list directory contents

          SYNOPSIS
          ls [OPTION]... [FILE]...

          DESCRIPTION
          List information about the FILEs (the current directory by default).
          Sort entries alphabetically if none of -cftuvSUX nor --sort is speci‐
          fied.


          Probably the nearest equivalent to dir /w will be ls -C (the /p option - pause - doesn't really make sense when writing to a file). So



          ls -C > file.txt


          In fact, there's a dir command in Linux as well - so you could just do dir > file.txt



          See Difference between 'dir' and 'ls' terminal commands?






          share|improve this answer




















          • Thank you for your help steeldriver, appreciate it. Very true about the /p option, just so use to using it to pause dir output. Take care and thank you again ;)
            – Sean S
            Feb 28 at 2:10













          up vote
          1
          down vote










          up vote
          1
          down vote









          The general command for listing directory contents in Linux is ls



          LS(1) User Commands LS(1)

          NAME
          ls - list directory contents

          SYNOPSIS
          ls [OPTION]... [FILE]...

          DESCRIPTION
          List information about the FILEs (the current directory by default).
          Sort entries alphabetically if none of -cftuvSUX nor --sort is speci‐
          fied.


          Probably the nearest equivalent to dir /w will be ls -C (the /p option - pause - doesn't really make sense when writing to a file). So



          ls -C > file.txt


          In fact, there's a dir command in Linux as well - so you could just do dir > file.txt



          See Difference between 'dir' and 'ls' terminal commands?






          share|improve this answer












          The general command for listing directory contents in Linux is ls



          LS(1) User Commands LS(1)

          NAME
          ls - list directory contents

          SYNOPSIS
          ls [OPTION]... [FILE]...

          DESCRIPTION
          List information about the FILEs (the current directory by default).
          Sort entries alphabetically if none of -cftuvSUX nor --sort is speci‐
          fied.


          Probably the nearest equivalent to dir /w will be ls -C (the /p option - pause - doesn't really make sense when writing to a file). So



          ls -C > file.txt


          In fact, there's a dir command in Linux as well - so you could just do dir > file.txt



          See Difference between 'dir' and 'ls' terminal commands?







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Feb 18 at 2:01









          steeldriver

          63.4k1199167




          63.4k1199167











          • Thank you for your help steeldriver, appreciate it. Very true about the /p option, just so use to using it to pause dir output. Take care and thank you again ;)
            – Sean S
            Feb 28 at 2:10

















          • Thank you for your help steeldriver, appreciate it. Very true about the /p option, just so use to using it to pause dir output. Take care and thank you again ;)
            – Sean S
            Feb 28 at 2:10
















          Thank you for your help steeldriver, appreciate it. Very true about the /p option, just so use to using it to pause dir output. Take care and thank you again ;)
          – Sean S
          Feb 28 at 2:10





          Thank you for your help steeldriver, appreciate it. Very true about the /p option, just so use to using it to pause dir output. Take care and thank you again ;)
          – Sean S
          Feb 28 at 2:10


















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1007251%2ftext-file-output-of-directory-contents%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

          Which professions warranted travel in Medieval times?

          How do so many people here on Academia.SE, and in general, afford lavish higher education programs?

          Trouble downloading packages list due to a “Hash sum mismatch” error