Is it possible to list file names starting with X or containing X?












2















As the title asks, is it possible to list files starting with X or containing X?



ls is used to list files. Are there any options I can use so I can list the files beginning with or containing a specific letter?










share|improve this question





























    2















    As the title asks, is it possible to list files starting with X or containing X?



    ls is used to list files. Are there any options I can use so I can list the files beginning with or containing a specific letter?










    share|improve this question



























      2












      2








      2


      2






      As the title asks, is it possible to list files starting with X or containing X?



      ls is used to list files. Are there any options I can use so I can list the files beginning with or containing a specific letter?










      share|improve this question
















      As the title asks, is it possible to list files starting with X or containing X?



      ls is used to list files. Are there any options I can use so I can list the files beginning with or containing a specific letter?







      command-line bash terminal






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Apr 6 '16 at 9:27









      tripleee

      1,83432130




      1,83432130










      asked Nov 21 '10 at 3:42









      irl_irlirl_irl

      118117




      118117






















          5 Answers
          5






          active

          oldest

          votes


















          3














          "Starting with" is just a specialization of "containing", so you can use the same for both.



          ls *X*





          share|improve this answer



















          • 1





            This has the checkmark, but I don't think it answers the question. This shows the contents of each subdirectory of the current folder whose names contain X. It does NOT show a list of all the current folder's contents that contain X.

            – 75th Trombone
            Aug 4 '14 at 16:41






          • 1





            @75thTrombone Not sure I understand what you are saying. The wildcard matches file names with X anywhere in them; the listing of the contents of matching subdirectories is a (mis-?)feature of ls, which can be disabled with the -d option.

            – tripleee
            Apr 6 '16 at 7:37













          • To make this safe and work in all intended cases, one should form a habit of using ls -- *X*.

            – Moreaki
            Feb 3 at 20:09



















          6














          To do the "containing X" part, you would do:



          ls | grep "X"


          ls - Lists all the files in the current directory



          | - Pipe, sends all output of the command before it as input to the command after it.



          grep "X" - Searches for text in the input given (here, through the pipe).



          ls -1 | grep "^X"


          ls - Lists files in the current directory, one on each line, essential for the regular expression we will use with grep.



          | - Pipe



          grep "^X" - This basically translates into: "The beginning of the line, and then X" so it will show files beginning with "X".



          Hope this helps!






          share|improve this answer



















          • 2





            mywiki.wooledge.org/ParsingLs

            – Ignacio Vazquez-Abrams
            Nov 21 '10 at 4:08











          • And you don't need to pass -1 option when piping ls output, it only outputs compact listing to ttys.

            – whitequark
            Nov 21 '10 at 7:52











          • not only this is a lot slower, it's also a bad idea. see Why not parse ls (and what do to instead)?

            – phuclv
            Feb 3 at 11:44



















          0














          Why use ls *X*? When you type this command, bash already interprets the stars and expands them, so echo *X* will do exactly the same.



          But it won't list files of which the name begins with a dot. If you really want files, my best suggestion is:



          find .  -maxdepth 0 -type f -iname '*X*'


          (the -maxdepth 0 prevents scanning subdirectories).






          share|improve this answer
























          • -maxdepth 0 can be done with ls -d. And dot files can be expanded with shopt -s dotglob

            – phuclv
            Feb 3 at 11:47



















          0














          Using the wildcard character:



          ls *X*


          Will list all files containing "X"



          ls X*


          Will list all files starting with "X"



          ls *X


          Will list all files ending with "X"






          share|improve this answer
























          • While your contribution is much apprieciated, it is unfortunately only partly correct. Try this: touch -- '-X' && ls *X. Under MacOS, you'll get an error and under most Linux distributions you'll get a subset of the actual list of all files. A more complete solution would be to use ls -- *X.

            – Moreaki
            Feb 3 at 19:34



















          -4














          Those are great suggestions - IF YOU ARE USING LINUX! Using the "ls" command is almost the same as MS-DOS's DIR command. However, the ls command only lives in certain command line interpreters like C-shell and NOT in MS-DOS and certainly NOT MS-Windows.



          So if you are asking about a Windows solution I might assume you haven't fully explored the Windows explorer (NOT to be confused with "Internet Explorer" either). For example, to view files alphabetically in Windows Explorer just open it up (click on My Computer, for example), make sure you can view by detail, navigate to the folder you want to sort and then click on the column called 'Name' to see all files starting with A followed by files starting with B and so on. Click on it again and you can see all files listed in reverse order where you first see all files starting with Z - click on it a third time and it's back to listing the A's first. But it doesn't stop there. You can then click on the date column (assuming you didn't deselect from the default menu settings and hide it or something) to show an alphabetized list with the most recently dated files listed first. You can even add more columns (through right-clicking) where you can add or delete display options in which you could even specify a heading that could display files according to a search formula or even with check boxes - and that's just for starts!



          Then again, if you're old school, you could just use the DOS command line in a DOS box. For example, open up a DOS box (run "cmd.exe"), go to your directory/folder and type in "dir [star]x[star]" (without the quotes) to show all files with x in the name. Of course you can also redirect the output to another file too. The example there would be 'dir [star]x[star]>filename.txt' which would create a text file called 'filename.txt' and contain a list of all files with x in the name. Of course, typing in "dir x[star]" would show only files starting with the letter x. (Notice the subtle difference where x is placed in the command and the asterisk [star] wild card symbol?). And if you really wanted to go nuts, you could even write a batch file! Just don't forget the pause line or redirecting the output as it would be rather pointless otherwise. (Anyone remember DOS batch "programming"?! lol)



          Hope it helps.



          P.S. I had to substitute the asterisk character using [star] since this blog will not print them - sorry.



          P.S.S. I know. I know! I probably can add the asterisk [star] character but I already posted. So please don't get hung up on it. I'll try to remember (how I'm posting) next time.






          share|improve this answer





















          • 2





            "ls" is more than likely available if bash already is. "ls" has nothing to do with the C-shell. "bash" is absolutely not limited to Linux. I run both of them it on many flavors of Unix, Windows and several more exotic OSes.

            – jlliagre
            Nov 21 '10 at 8:33













          • This is not a "blog". You get a literal asterisk by escaping it with a backslash. See the formatting help which is displayed in the sidebar while you are editing.

            – tripleee
            Apr 6 '16 at 7:41











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "3"
          };
          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
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f213300%2fis-it-possible-to-list-file-names-starting-with-x-or-containing-x%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          5 Answers
          5






          active

          oldest

          votes








          5 Answers
          5






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          3














          "Starting with" is just a specialization of "containing", so you can use the same for both.



          ls *X*





          share|improve this answer



















          • 1





            This has the checkmark, but I don't think it answers the question. This shows the contents of each subdirectory of the current folder whose names contain X. It does NOT show a list of all the current folder's contents that contain X.

            – 75th Trombone
            Aug 4 '14 at 16:41






          • 1





            @75thTrombone Not sure I understand what you are saying. The wildcard matches file names with X anywhere in them; the listing of the contents of matching subdirectories is a (mis-?)feature of ls, which can be disabled with the -d option.

            – tripleee
            Apr 6 '16 at 7:37













          • To make this safe and work in all intended cases, one should form a habit of using ls -- *X*.

            – Moreaki
            Feb 3 at 20:09
















          3














          "Starting with" is just a specialization of "containing", so you can use the same for both.



          ls *X*





          share|improve this answer



















          • 1





            This has the checkmark, but I don't think it answers the question. This shows the contents of each subdirectory of the current folder whose names contain X. It does NOT show a list of all the current folder's contents that contain X.

            – 75th Trombone
            Aug 4 '14 at 16:41






          • 1





            @75thTrombone Not sure I understand what you are saying. The wildcard matches file names with X anywhere in them; the listing of the contents of matching subdirectories is a (mis-?)feature of ls, which can be disabled with the -d option.

            – tripleee
            Apr 6 '16 at 7:37













          • To make this safe and work in all intended cases, one should form a habit of using ls -- *X*.

            – Moreaki
            Feb 3 at 20:09














          3












          3








          3







          "Starting with" is just a specialization of "containing", so you can use the same for both.



          ls *X*





          share|improve this answer













          "Starting with" is just a specialization of "containing", so you can use the same for both.



          ls *X*






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 21 '10 at 3:53









          Ignacio Vazquez-AbramsIgnacio Vazquez-Abrams

          96.3k6155211




          96.3k6155211








          • 1





            This has the checkmark, but I don't think it answers the question. This shows the contents of each subdirectory of the current folder whose names contain X. It does NOT show a list of all the current folder's contents that contain X.

            – 75th Trombone
            Aug 4 '14 at 16:41






          • 1





            @75thTrombone Not sure I understand what you are saying. The wildcard matches file names with X anywhere in them; the listing of the contents of matching subdirectories is a (mis-?)feature of ls, which can be disabled with the -d option.

            – tripleee
            Apr 6 '16 at 7:37













          • To make this safe and work in all intended cases, one should form a habit of using ls -- *X*.

            – Moreaki
            Feb 3 at 20:09














          • 1





            This has the checkmark, but I don't think it answers the question. This shows the contents of each subdirectory of the current folder whose names contain X. It does NOT show a list of all the current folder's contents that contain X.

            – 75th Trombone
            Aug 4 '14 at 16:41






          • 1





            @75thTrombone Not sure I understand what you are saying. The wildcard matches file names with X anywhere in them; the listing of the contents of matching subdirectories is a (mis-?)feature of ls, which can be disabled with the -d option.

            – tripleee
            Apr 6 '16 at 7:37













          • To make this safe and work in all intended cases, one should form a habit of using ls -- *X*.

            – Moreaki
            Feb 3 at 20:09








          1




          1





          This has the checkmark, but I don't think it answers the question. This shows the contents of each subdirectory of the current folder whose names contain X. It does NOT show a list of all the current folder's contents that contain X.

          – 75th Trombone
          Aug 4 '14 at 16:41





          This has the checkmark, but I don't think it answers the question. This shows the contents of each subdirectory of the current folder whose names contain X. It does NOT show a list of all the current folder's contents that contain X.

          – 75th Trombone
          Aug 4 '14 at 16:41




          1




          1





          @75thTrombone Not sure I understand what you are saying. The wildcard matches file names with X anywhere in them; the listing of the contents of matching subdirectories is a (mis-?)feature of ls, which can be disabled with the -d option.

          – tripleee
          Apr 6 '16 at 7:37







          @75thTrombone Not sure I understand what you are saying. The wildcard matches file names with X anywhere in them; the listing of the contents of matching subdirectories is a (mis-?)feature of ls, which can be disabled with the -d option.

          – tripleee
          Apr 6 '16 at 7:37















          To make this safe and work in all intended cases, one should form a habit of using ls -- *X*.

          – Moreaki
          Feb 3 at 20:09





          To make this safe and work in all intended cases, one should form a habit of using ls -- *X*.

          – Moreaki
          Feb 3 at 20:09













          6














          To do the "containing X" part, you would do:



          ls | grep "X"


          ls - Lists all the files in the current directory



          | - Pipe, sends all output of the command before it as input to the command after it.



          grep "X" - Searches for text in the input given (here, through the pipe).



          ls -1 | grep "^X"


          ls - Lists files in the current directory, one on each line, essential for the regular expression we will use with grep.



          | - Pipe



          grep "^X" - This basically translates into: "The beginning of the line, and then X" so it will show files beginning with "X".



          Hope this helps!






          share|improve this answer



















          • 2





            mywiki.wooledge.org/ParsingLs

            – Ignacio Vazquez-Abrams
            Nov 21 '10 at 4:08











          • And you don't need to pass -1 option when piping ls output, it only outputs compact listing to ttys.

            – whitequark
            Nov 21 '10 at 7:52











          • not only this is a lot slower, it's also a bad idea. see Why not parse ls (and what do to instead)?

            – phuclv
            Feb 3 at 11:44
















          6














          To do the "containing X" part, you would do:



          ls | grep "X"


          ls - Lists all the files in the current directory



          | - Pipe, sends all output of the command before it as input to the command after it.



          grep "X" - Searches for text in the input given (here, through the pipe).



          ls -1 | grep "^X"


          ls - Lists files in the current directory, one on each line, essential for the regular expression we will use with grep.



          | - Pipe



          grep "^X" - This basically translates into: "The beginning of the line, and then X" so it will show files beginning with "X".



          Hope this helps!






          share|improve this answer



















          • 2





            mywiki.wooledge.org/ParsingLs

            – Ignacio Vazquez-Abrams
            Nov 21 '10 at 4:08











          • And you don't need to pass -1 option when piping ls output, it only outputs compact listing to ttys.

            – whitequark
            Nov 21 '10 at 7:52











          • not only this is a lot slower, it's also a bad idea. see Why not parse ls (and what do to instead)?

            – phuclv
            Feb 3 at 11:44














          6












          6








          6







          To do the "containing X" part, you would do:



          ls | grep "X"


          ls - Lists all the files in the current directory



          | - Pipe, sends all output of the command before it as input to the command after it.



          grep "X" - Searches for text in the input given (here, through the pipe).



          ls -1 | grep "^X"


          ls - Lists files in the current directory, one on each line, essential for the regular expression we will use with grep.



          | - Pipe



          grep "^X" - This basically translates into: "The beginning of the line, and then X" so it will show files beginning with "X".



          Hope this helps!






          share|improve this answer













          To do the "containing X" part, you would do:



          ls | grep "X"


          ls - Lists all the files in the current directory



          | - Pipe, sends all output of the command before it as input to the command after it.



          grep "X" - Searches for text in the input given (here, through the pipe).



          ls -1 | grep "^X"


          ls - Lists files in the current directory, one on each line, essential for the regular expression we will use with grep.



          | - Pipe



          grep "^X" - This basically translates into: "The beginning of the line, and then X" so it will show files beginning with "X".



          Hope this helps!







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 21 '10 at 4:04









          WuffersWuffers

          13.6k1279117




          13.6k1279117








          • 2





            mywiki.wooledge.org/ParsingLs

            – Ignacio Vazquez-Abrams
            Nov 21 '10 at 4:08











          • And you don't need to pass -1 option when piping ls output, it only outputs compact listing to ttys.

            – whitequark
            Nov 21 '10 at 7:52











          • not only this is a lot slower, it's also a bad idea. see Why not parse ls (and what do to instead)?

            – phuclv
            Feb 3 at 11:44














          • 2





            mywiki.wooledge.org/ParsingLs

            – Ignacio Vazquez-Abrams
            Nov 21 '10 at 4:08











          • And you don't need to pass -1 option when piping ls output, it only outputs compact listing to ttys.

            – whitequark
            Nov 21 '10 at 7:52











          • not only this is a lot slower, it's also a bad idea. see Why not parse ls (and what do to instead)?

            – phuclv
            Feb 3 at 11:44








          2




          2





          mywiki.wooledge.org/ParsingLs

          – Ignacio Vazquez-Abrams
          Nov 21 '10 at 4:08





          mywiki.wooledge.org/ParsingLs

          – Ignacio Vazquez-Abrams
          Nov 21 '10 at 4:08













          And you don't need to pass -1 option when piping ls output, it only outputs compact listing to ttys.

          – whitequark
          Nov 21 '10 at 7:52





          And you don't need to pass -1 option when piping ls output, it only outputs compact listing to ttys.

          – whitequark
          Nov 21 '10 at 7:52













          not only this is a lot slower, it's also a bad idea. see Why not parse ls (and what do to instead)?

          – phuclv
          Feb 3 at 11:44





          not only this is a lot slower, it's also a bad idea. see Why not parse ls (and what do to instead)?

          – phuclv
          Feb 3 at 11:44











          0














          Why use ls *X*? When you type this command, bash already interprets the stars and expands them, so echo *X* will do exactly the same.



          But it won't list files of which the name begins with a dot. If you really want files, my best suggestion is:



          find .  -maxdepth 0 -type f -iname '*X*'


          (the -maxdepth 0 prevents scanning subdirectories).






          share|improve this answer
























          • -maxdepth 0 can be done with ls -d. And dot files can be expanded with shopt -s dotglob

            – phuclv
            Feb 3 at 11:47
















          0














          Why use ls *X*? When you type this command, bash already interprets the stars and expands them, so echo *X* will do exactly the same.



          But it won't list files of which the name begins with a dot. If you really want files, my best suggestion is:



          find .  -maxdepth 0 -type f -iname '*X*'


          (the -maxdepth 0 prevents scanning subdirectories).






          share|improve this answer
























          • -maxdepth 0 can be done with ls -d. And dot files can be expanded with shopt -s dotglob

            – phuclv
            Feb 3 at 11:47














          0












          0








          0







          Why use ls *X*? When you type this command, bash already interprets the stars and expands them, so echo *X* will do exactly the same.



          But it won't list files of which the name begins with a dot. If you really want files, my best suggestion is:



          find .  -maxdepth 0 -type f -iname '*X*'


          (the -maxdepth 0 prevents scanning subdirectories).






          share|improve this answer













          Why use ls *X*? When you type this command, bash already interprets the stars and expands them, so echo *X* will do exactly the same.



          But it won't list files of which the name begins with a dot. If you really want files, my best suggestion is:



          find .  -maxdepth 0 -type f -iname '*X*'


          (the -maxdepth 0 prevents scanning subdirectories).







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 21 '10 at 9:34









          BenoitBenoit

          6,03631627




          6,03631627













          • -maxdepth 0 can be done with ls -d. And dot files can be expanded with shopt -s dotglob

            – phuclv
            Feb 3 at 11:47



















          • -maxdepth 0 can be done with ls -d. And dot files can be expanded with shopt -s dotglob

            – phuclv
            Feb 3 at 11:47

















          -maxdepth 0 can be done with ls -d. And dot files can be expanded with shopt -s dotglob

          – phuclv
          Feb 3 at 11:47





          -maxdepth 0 can be done with ls -d. And dot files can be expanded with shopt -s dotglob

          – phuclv
          Feb 3 at 11:47











          0














          Using the wildcard character:



          ls *X*


          Will list all files containing "X"



          ls X*


          Will list all files starting with "X"



          ls *X


          Will list all files ending with "X"






          share|improve this answer
























          • While your contribution is much apprieciated, it is unfortunately only partly correct. Try this: touch -- '-X' && ls *X. Under MacOS, you'll get an error and under most Linux distributions you'll get a subset of the actual list of all files. A more complete solution would be to use ls -- *X.

            – Moreaki
            Feb 3 at 19:34
















          0














          Using the wildcard character:



          ls *X*


          Will list all files containing "X"



          ls X*


          Will list all files starting with "X"



          ls *X


          Will list all files ending with "X"






          share|improve this answer
























          • While your contribution is much apprieciated, it is unfortunately only partly correct. Try this: touch -- '-X' && ls *X. Under MacOS, you'll get an error and under most Linux distributions you'll get a subset of the actual list of all files. A more complete solution would be to use ls -- *X.

            – Moreaki
            Feb 3 at 19:34














          0












          0








          0







          Using the wildcard character:



          ls *X*


          Will list all files containing "X"



          ls X*


          Will list all files starting with "X"



          ls *X


          Will list all files ending with "X"






          share|improve this answer













          Using the wildcard character:



          ls *X*


          Will list all files containing "X"



          ls X*


          Will list all files starting with "X"



          ls *X


          Will list all files ending with "X"







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Feb 3 at 11:36









          TheoTheo

          1




          1













          • While your contribution is much apprieciated, it is unfortunately only partly correct. Try this: touch -- '-X' && ls *X. Under MacOS, you'll get an error and under most Linux distributions you'll get a subset of the actual list of all files. A more complete solution would be to use ls -- *X.

            – Moreaki
            Feb 3 at 19:34



















          • While your contribution is much apprieciated, it is unfortunately only partly correct. Try this: touch -- '-X' && ls *X. Under MacOS, you'll get an error and under most Linux distributions you'll get a subset of the actual list of all files. A more complete solution would be to use ls -- *X.

            – Moreaki
            Feb 3 at 19:34

















          While your contribution is much apprieciated, it is unfortunately only partly correct. Try this: touch -- '-X' && ls *X. Under MacOS, you'll get an error and under most Linux distributions you'll get a subset of the actual list of all files. A more complete solution would be to use ls -- *X.

          – Moreaki
          Feb 3 at 19:34





          While your contribution is much apprieciated, it is unfortunately only partly correct. Try this: touch -- '-X' && ls *X. Under MacOS, you'll get an error and under most Linux distributions you'll get a subset of the actual list of all files. A more complete solution would be to use ls -- *X.

          – Moreaki
          Feb 3 at 19:34











          -4














          Those are great suggestions - IF YOU ARE USING LINUX! Using the "ls" command is almost the same as MS-DOS's DIR command. However, the ls command only lives in certain command line interpreters like C-shell and NOT in MS-DOS and certainly NOT MS-Windows.



          So if you are asking about a Windows solution I might assume you haven't fully explored the Windows explorer (NOT to be confused with "Internet Explorer" either). For example, to view files alphabetically in Windows Explorer just open it up (click on My Computer, for example), make sure you can view by detail, navigate to the folder you want to sort and then click on the column called 'Name' to see all files starting with A followed by files starting with B and so on. Click on it again and you can see all files listed in reverse order where you first see all files starting with Z - click on it a third time and it's back to listing the A's first. But it doesn't stop there. You can then click on the date column (assuming you didn't deselect from the default menu settings and hide it or something) to show an alphabetized list with the most recently dated files listed first. You can even add more columns (through right-clicking) where you can add or delete display options in which you could even specify a heading that could display files according to a search formula or even with check boxes - and that's just for starts!



          Then again, if you're old school, you could just use the DOS command line in a DOS box. For example, open up a DOS box (run "cmd.exe"), go to your directory/folder and type in "dir [star]x[star]" (without the quotes) to show all files with x in the name. Of course you can also redirect the output to another file too. The example there would be 'dir [star]x[star]>filename.txt' which would create a text file called 'filename.txt' and contain a list of all files with x in the name. Of course, typing in "dir x[star]" would show only files starting with the letter x. (Notice the subtle difference where x is placed in the command and the asterisk [star] wild card symbol?). And if you really wanted to go nuts, you could even write a batch file! Just don't forget the pause line or redirecting the output as it would be rather pointless otherwise. (Anyone remember DOS batch "programming"?! lol)



          Hope it helps.



          P.S. I had to substitute the asterisk character using [star] since this blog will not print them - sorry.



          P.S.S. I know. I know! I probably can add the asterisk [star] character but I already posted. So please don't get hung up on it. I'll try to remember (how I'm posting) next time.






          share|improve this answer





















          • 2





            "ls" is more than likely available if bash already is. "ls" has nothing to do with the C-shell. "bash" is absolutely not limited to Linux. I run both of them it on many flavors of Unix, Windows and several more exotic OSes.

            – jlliagre
            Nov 21 '10 at 8:33













          • This is not a "blog". You get a literal asterisk by escaping it with a backslash. See the formatting help which is displayed in the sidebar while you are editing.

            – tripleee
            Apr 6 '16 at 7:41
















          -4














          Those are great suggestions - IF YOU ARE USING LINUX! Using the "ls" command is almost the same as MS-DOS's DIR command. However, the ls command only lives in certain command line interpreters like C-shell and NOT in MS-DOS and certainly NOT MS-Windows.



          So if you are asking about a Windows solution I might assume you haven't fully explored the Windows explorer (NOT to be confused with "Internet Explorer" either). For example, to view files alphabetically in Windows Explorer just open it up (click on My Computer, for example), make sure you can view by detail, navigate to the folder you want to sort and then click on the column called 'Name' to see all files starting with A followed by files starting with B and so on. Click on it again and you can see all files listed in reverse order where you first see all files starting with Z - click on it a third time and it's back to listing the A's first. But it doesn't stop there. You can then click on the date column (assuming you didn't deselect from the default menu settings and hide it or something) to show an alphabetized list with the most recently dated files listed first. You can even add more columns (through right-clicking) where you can add or delete display options in which you could even specify a heading that could display files according to a search formula or even with check boxes - and that's just for starts!



          Then again, if you're old school, you could just use the DOS command line in a DOS box. For example, open up a DOS box (run "cmd.exe"), go to your directory/folder and type in "dir [star]x[star]" (without the quotes) to show all files with x in the name. Of course you can also redirect the output to another file too. The example there would be 'dir [star]x[star]>filename.txt' which would create a text file called 'filename.txt' and contain a list of all files with x in the name. Of course, typing in "dir x[star]" would show only files starting with the letter x. (Notice the subtle difference where x is placed in the command and the asterisk [star] wild card symbol?). And if you really wanted to go nuts, you could even write a batch file! Just don't forget the pause line or redirecting the output as it would be rather pointless otherwise. (Anyone remember DOS batch "programming"?! lol)



          Hope it helps.



          P.S. I had to substitute the asterisk character using [star] since this blog will not print them - sorry.



          P.S.S. I know. I know! I probably can add the asterisk [star] character but I already posted. So please don't get hung up on it. I'll try to remember (how I'm posting) next time.






          share|improve this answer





















          • 2





            "ls" is more than likely available if bash already is. "ls" has nothing to do with the C-shell. "bash" is absolutely not limited to Linux. I run both of them it on many flavors of Unix, Windows and several more exotic OSes.

            – jlliagre
            Nov 21 '10 at 8:33













          • This is not a "blog". You get a literal asterisk by escaping it with a backslash. See the formatting help which is displayed in the sidebar while you are editing.

            – tripleee
            Apr 6 '16 at 7:41














          -4












          -4








          -4







          Those are great suggestions - IF YOU ARE USING LINUX! Using the "ls" command is almost the same as MS-DOS's DIR command. However, the ls command only lives in certain command line interpreters like C-shell and NOT in MS-DOS and certainly NOT MS-Windows.



          So if you are asking about a Windows solution I might assume you haven't fully explored the Windows explorer (NOT to be confused with "Internet Explorer" either). For example, to view files alphabetically in Windows Explorer just open it up (click on My Computer, for example), make sure you can view by detail, navigate to the folder you want to sort and then click on the column called 'Name' to see all files starting with A followed by files starting with B and so on. Click on it again and you can see all files listed in reverse order where you first see all files starting with Z - click on it a third time and it's back to listing the A's first. But it doesn't stop there. You can then click on the date column (assuming you didn't deselect from the default menu settings and hide it or something) to show an alphabetized list with the most recently dated files listed first. You can even add more columns (through right-clicking) where you can add or delete display options in which you could even specify a heading that could display files according to a search formula or even with check boxes - and that's just for starts!



          Then again, if you're old school, you could just use the DOS command line in a DOS box. For example, open up a DOS box (run "cmd.exe"), go to your directory/folder and type in "dir [star]x[star]" (without the quotes) to show all files with x in the name. Of course you can also redirect the output to another file too. The example there would be 'dir [star]x[star]>filename.txt' which would create a text file called 'filename.txt' and contain a list of all files with x in the name. Of course, typing in "dir x[star]" would show only files starting with the letter x. (Notice the subtle difference where x is placed in the command and the asterisk [star] wild card symbol?). And if you really wanted to go nuts, you could even write a batch file! Just don't forget the pause line or redirecting the output as it would be rather pointless otherwise. (Anyone remember DOS batch "programming"?! lol)



          Hope it helps.



          P.S. I had to substitute the asterisk character using [star] since this blog will not print them - sorry.



          P.S.S. I know. I know! I probably can add the asterisk [star] character but I already posted. So please don't get hung up on it. I'll try to remember (how I'm posting) next time.






          share|improve this answer















          Those are great suggestions - IF YOU ARE USING LINUX! Using the "ls" command is almost the same as MS-DOS's DIR command. However, the ls command only lives in certain command line interpreters like C-shell and NOT in MS-DOS and certainly NOT MS-Windows.



          So if you are asking about a Windows solution I might assume you haven't fully explored the Windows explorer (NOT to be confused with "Internet Explorer" either). For example, to view files alphabetically in Windows Explorer just open it up (click on My Computer, for example), make sure you can view by detail, navigate to the folder you want to sort and then click on the column called 'Name' to see all files starting with A followed by files starting with B and so on. Click on it again and you can see all files listed in reverse order where you first see all files starting with Z - click on it a third time and it's back to listing the A's first. But it doesn't stop there. You can then click on the date column (assuming you didn't deselect from the default menu settings and hide it or something) to show an alphabetized list with the most recently dated files listed first. You can even add more columns (through right-clicking) where you can add or delete display options in which you could even specify a heading that could display files according to a search formula or even with check boxes - and that's just for starts!



          Then again, if you're old school, you could just use the DOS command line in a DOS box. For example, open up a DOS box (run "cmd.exe"), go to your directory/folder and type in "dir [star]x[star]" (without the quotes) to show all files with x in the name. Of course you can also redirect the output to another file too. The example there would be 'dir [star]x[star]>filename.txt' which would create a text file called 'filename.txt' and contain a list of all files with x in the name. Of course, typing in "dir x[star]" would show only files starting with the letter x. (Notice the subtle difference where x is placed in the command and the asterisk [star] wild card symbol?). And if you really wanted to go nuts, you could even write a batch file! Just don't forget the pause line or redirecting the output as it would be rather pointless otherwise. (Anyone remember DOS batch "programming"?! lol)



          Hope it helps.



          P.S. I had to substitute the asterisk character using [star] since this blog will not print them - sorry.



          P.S.S. I know. I know! I probably can add the asterisk [star] character but I already posted. So please don't get hung up on it. I'll try to remember (how I'm posting) next time.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 21 '10 at 8:08

























          answered Nov 21 '10 at 7:58









          AnonymousAnonymous

          442




          442








          • 2





            "ls" is more than likely available if bash already is. "ls" has nothing to do with the C-shell. "bash" is absolutely not limited to Linux. I run both of them it on many flavors of Unix, Windows and several more exotic OSes.

            – jlliagre
            Nov 21 '10 at 8:33













          • This is not a "blog". You get a literal asterisk by escaping it with a backslash. See the formatting help which is displayed in the sidebar while you are editing.

            – tripleee
            Apr 6 '16 at 7:41














          • 2





            "ls" is more than likely available if bash already is. "ls" has nothing to do with the C-shell. "bash" is absolutely not limited to Linux. I run both of them it on many flavors of Unix, Windows and several more exotic OSes.

            – jlliagre
            Nov 21 '10 at 8:33













          • This is not a "blog". You get a literal asterisk by escaping it with a backslash. See the formatting help which is displayed in the sidebar while you are editing.

            – tripleee
            Apr 6 '16 at 7:41








          2




          2





          "ls" is more than likely available if bash already is. "ls" has nothing to do with the C-shell. "bash" is absolutely not limited to Linux. I run both of them it on many flavors of Unix, Windows and several more exotic OSes.

          – jlliagre
          Nov 21 '10 at 8:33







          "ls" is more than likely available if bash already is. "ls" has nothing to do with the C-shell. "bash" is absolutely not limited to Linux. I run both of them it on many flavors of Unix, Windows and several more exotic OSes.

          – jlliagre
          Nov 21 '10 at 8:33















          This is not a "blog". You get a literal asterisk by escaping it with a backslash. See the formatting help which is displayed in the sidebar while you are editing.

          – tripleee
          Apr 6 '16 at 7:41





          This is not a "blog". You get a literal asterisk by escaping it with a backslash. See the formatting help which is displayed in the sidebar while you are editing.

          – tripleee
          Apr 6 '16 at 7:41


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Super User!


          • 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%2fsuperuser.com%2fquestions%2f213300%2fis-it-possible-to-list-file-names-starting-with-x-or-containing-x%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

          flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

          Mangá

           ⁒  ․,‪⁊‑⁙ ⁖, ⁇‒※‌, †,⁖‗‌⁝    ‾‸⁘,‖⁔⁣,⁂‾
”‑,‥–,‬ ,⁀‹⁋‴⁑ ‒ ,‴⁋”‼ ⁨,‷⁔„ ‰′,‐‚ ‥‡‎“‷⁃⁨⁅⁣,⁔
⁇‘⁔⁡⁏⁌⁡‿‶‏⁨ ⁣⁕⁖⁨⁩⁥‽⁀  ‴‬⁜‟ ⁃‣‧⁕‮ …‍⁨‴ ⁩,⁚⁖‫ ,‵ ⁀,‮⁝‣‣ ⁑  ⁂– ․, ‾‽ ‏⁁“⁗‸ ‾… ‹‡⁌⁎‸‘ ‡⁏⁌‪ ‵⁛ ‎⁨ ―⁦⁤⁄⁕