linux find command for filenames without extension for unknown extensions












3















I like using the following command to print file names but it prints them with extensions.



find . -type f -printf '%fn'


In my directory, there are many files with different extensions. I tried adding --ignore='*.*' both before and after -printf, but it didn't work.
example; I have files myfile1.txt, myfile2.mp3, etc. I need it prints myfile1, myfile2, etc.
How would I do this?










share|improve this question

























  • Since you specifically ask about find I’ll provide this aside in a comment. You can do this fluently with modern native bash: shopt -s globstar; files=(**/*); printf '%sn' "${files[@]%.*}" — this could have odd behavior if a directory in the path has a . in it and the files in that path have no ., but I assume that combination is unlikely.

    – kojiro
    Jan 23 at 23:58
















3















I like using the following command to print file names but it prints them with extensions.



find . -type f -printf '%fn'


In my directory, there are many files with different extensions. I tried adding --ignore='*.*' both before and after -printf, but it didn't work.
example; I have files myfile1.txt, myfile2.mp3, etc. I need it prints myfile1, myfile2, etc.
How would I do this?










share|improve this question

























  • Since you specifically ask about find I’ll provide this aside in a comment. You can do this fluently with modern native bash: shopt -s globstar; files=(**/*); printf '%sn' "${files[@]%.*}" — this could have odd behavior if a directory in the path has a . in it and the files in that path have no ., but I assume that combination is unlikely.

    – kojiro
    Jan 23 at 23:58














3












3








3








I like using the following command to print file names but it prints them with extensions.



find . -type f -printf '%fn'


In my directory, there are many files with different extensions. I tried adding --ignore='*.*' both before and after -printf, but it didn't work.
example; I have files myfile1.txt, myfile2.mp3, etc. I need it prints myfile1, myfile2, etc.
How would I do this?










share|improve this question
















I like using the following command to print file names but it prints them with extensions.



find . -type f -printf '%fn'


In my directory, there are many files with different extensions. I tried adding --ignore='*.*' both before and after -printf, but it didn't work.
example; I have files myfile1.txt, myfile2.mp3, etc. I need it prints myfile1, myfile2, etc.
How would I do this?







find filenames






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 23 at 20:02







kutlus

















asked Jan 23 at 19:21









kutluskutlus

707




707













  • Since you specifically ask about find I’ll provide this aside in a comment. You can do this fluently with modern native bash: shopt -s globstar; files=(**/*); printf '%sn' "${files[@]%.*}" — this could have odd behavior if a directory in the path has a . in it and the files in that path have no ., but I assume that combination is unlikely.

    – kojiro
    Jan 23 at 23:58



















  • Since you specifically ask about find I’ll provide this aside in a comment. You can do this fluently with modern native bash: shopt -s globstar; files=(**/*); printf '%sn' "${files[@]%.*}" — this could have odd behavior if a directory in the path has a . in it and the files in that path have no ., but I assume that combination is unlikely.

    – kojiro
    Jan 23 at 23:58

















Since you specifically ask about find I’ll provide this aside in a comment. You can do this fluently with modern native bash: shopt -s globstar; files=(**/*); printf '%sn' "${files[@]%.*}" — this could have odd behavior if a directory in the path has a . in it and the files in that path have no ., but I assume that combination is unlikely.

– kojiro
Jan 23 at 23:58





Since you specifically ask about find I’ll provide this aside in a comment. You can do this fluently with modern native bash: shopt -s globstar; files=(**/*); printf '%sn' "${files[@]%.*}" — this could have odd behavior if a directory in the path has a . in it and the files in that path have no ., but I assume that combination is unlikely.

– kojiro
Jan 23 at 23:58










4 Answers
4






active

oldest

votes


















3














If I understand you correctly (I didn't, see second part of the answer), you want to avoid listing filenames that contain a dot character.



This will do that:



find . -type f ! -name '*.*'


The filename globbing pattern *.* would match any filename containing at least one dot. The preceding ! negates the sense of the match, which means that the pathnames that gets through to the end will be those of files that have no dots in their names. In really ancient shells, you may want to escape the ! as ! (or update your Unix installation). The lone ! won't invoke bash's history expansion facility.



To print only the filename component of the found pathname, with GNU find:



find . -type f ! -name '*.*' -printf '%fn'


With standard find (or GNU find for that matter):



find . -type f ! -name '*.*' -exec basename {} ;


Before using this in a command substitution in a loop, see "Why is looping over find's output bad practice?".





To list all filenames, and at the same time remove everything after the last dot in the name ("remove the extension"), you may use



find . -type f -exec sh -c '
for pathname do
pathname=$( basename "$pathname" )
printf "%sn" "${pathname%.*}"
done' sh {} +


This would send all found pathnames of all files to a short shell loop. The loop would take each pathname and call basename on it to extract the filename component of the pathname, and then print the resulting string with everything after the last dot removed.



The parameter expansion ${pathname%.*} means "remove the shortest string matching .* (a literal dot followed by arbitrary text) from the end of the value of $pathname". It would have the effect of removing a filename suffix after the last dot in the filename.



For more info about find ... -exec ... {} +, see e.g. "Understanding the -exec option of `find`".






share|improve this answer


























  • Thanks for your help, I have tried all three, but they don't print anything. Am I missing something, on the same terminal, in the same directory find . -type f -printf '%fn' works but as I asked in the question I need them without extensions.

    – kutlus
    Jan 23 at 19:53











  • @kutlus In that case, I (and the others) may have misunderstood your question. Do you want to remove everything after the last dot in the filename?

    – Kusalananda
    Jan 23 at 19:55











  • I just want the file name, example; some files are myfile1.txt, myfile2.mp3, i want it prints myfile1, myfile2. sorry if my questions wasn`t clear, thanks

    – kutlus
    Jan 23 at 19:58











  • @kutlus See updated answer.

    – Kusalananda
    Jan 23 at 20:02











  • This worked, many thanks!

    – kutlus
    Jan 23 at 20:05



















3














In Linux, there is no such thing as a file extension. A . in a file name has no significance whatsoever (notwithstanding that a . as the first character in a filename identifies it as a hidden file).



Also, checking the manual page for find on my system shows no --ignore option.



That said, if you want to ignore any files with a . in their name, you can use find's -not operator:



find -type f -not -name '*.*' -print





share|improve this answer
























  • thanks but this doesn`t print anything.

    – kutlus
    Jan 23 at 19:49











  • If this does not print anything, then all files must have a . in their names.

    – DopeGhoti
    Jan 23 at 20:43



















2














As other's have pointed out, "extensions" don't really mean anything to Unix systems. But we can remove them from a listing with a simple sed command.



e.g.



find * -type f -print | sed 's/.[^.]*$//'


If there are directories and you don't want them to be shown in the listing then



find * -type f -printf "%fn" | sed 's/.[^.]*$//'


For a single directory we can just use ls instead of find



ls | sed 's/.[^.]*$//'





share|improve this answer































    1














    try



    find . -type f ! -name '*.*' -print


    where





    • ! : not (! must be escaped)


    • name '*.*' : filename with extension






    share|improve this answer
























    • arg, not fast enough !!

      – Archemar
      Jan 23 at 19:27











    • Having to escape ! is why I usually suggest using -not.

      – DopeGhoti
      Jan 23 at 19:27











    • well it work w/o escape, I've been escaping it ever since SunOS 3.X... sight.

      – Archemar
      Jan 23 at 19:29











    • thanks but this doesn`t print anything.

      – kutlus
      Jan 23 at 19:48











    • In what shell do you need to escape it? It works without escaping in both zsh and bash. Both these shells only interpret a history expansion when the ! is accompanied by another character.

      – JoL
      Jan 23 at 23:40











    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "106"
    };
    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: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    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%2funix.stackexchange.com%2fquestions%2f496299%2flinux-find-command-for-filenames-without-extension-for-unknown-extensions%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    4 Answers
    4






    active

    oldest

    votes








    4 Answers
    4






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    3














    If I understand you correctly (I didn't, see second part of the answer), you want to avoid listing filenames that contain a dot character.



    This will do that:



    find . -type f ! -name '*.*'


    The filename globbing pattern *.* would match any filename containing at least one dot. The preceding ! negates the sense of the match, which means that the pathnames that gets through to the end will be those of files that have no dots in their names. In really ancient shells, you may want to escape the ! as ! (or update your Unix installation). The lone ! won't invoke bash's history expansion facility.



    To print only the filename component of the found pathname, with GNU find:



    find . -type f ! -name '*.*' -printf '%fn'


    With standard find (or GNU find for that matter):



    find . -type f ! -name '*.*' -exec basename {} ;


    Before using this in a command substitution in a loop, see "Why is looping over find's output bad practice?".





    To list all filenames, and at the same time remove everything after the last dot in the name ("remove the extension"), you may use



    find . -type f -exec sh -c '
    for pathname do
    pathname=$( basename "$pathname" )
    printf "%sn" "${pathname%.*}"
    done' sh {} +


    This would send all found pathnames of all files to a short shell loop. The loop would take each pathname and call basename on it to extract the filename component of the pathname, and then print the resulting string with everything after the last dot removed.



    The parameter expansion ${pathname%.*} means "remove the shortest string matching .* (a literal dot followed by arbitrary text) from the end of the value of $pathname". It would have the effect of removing a filename suffix after the last dot in the filename.



    For more info about find ... -exec ... {} +, see e.g. "Understanding the -exec option of `find`".






    share|improve this answer


























    • Thanks for your help, I have tried all three, but they don't print anything. Am I missing something, on the same terminal, in the same directory find . -type f -printf '%fn' works but as I asked in the question I need them without extensions.

      – kutlus
      Jan 23 at 19:53











    • @kutlus In that case, I (and the others) may have misunderstood your question. Do you want to remove everything after the last dot in the filename?

      – Kusalananda
      Jan 23 at 19:55











    • I just want the file name, example; some files are myfile1.txt, myfile2.mp3, i want it prints myfile1, myfile2. sorry if my questions wasn`t clear, thanks

      – kutlus
      Jan 23 at 19:58











    • @kutlus See updated answer.

      – Kusalananda
      Jan 23 at 20:02











    • This worked, many thanks!

      – kutlus
      Jan 23 at 20:05
















    3














    If I understand you correctly (I didn't, see second part of the answer), you want to avoid listing filenames that contain a dot character.



    This will do that:



    find . -type f ! -name '*.*'


    The filename globbing pattern *.* would match any filename containing at least one dot. The preceding ! negates the sense of the match, which means that the pathnames that gets through to the end will be those of files that have no dots in their names. In really ancient shells, you may want to escape the ! as ! (or update your Unix installation). The lone ! won't invoke bash's history expansion facility.



    To print only the filename component of the found pathname, with GNU find:



    find . -type f ! -name '*.*' -printf '%fn'


    With standard find (or GNU find for that matter):



    find . -type f ! -name '*.*' -exec basename {} ;


    Before using this in a command substitution in a loop, see "Why is looping over find's output bad practice?".





    To list all filenames, and at the same time remove everything after the last dot in the name ("remove the extension"), you may use



    find . -type f -exec sh -c '
    for pathname do
    pathname=$( basename "$pathname" )
    printf "%sn" "${pathname%.*}"
    done' sh {} +


    This would send all found pathnames of all files to a short shell loop. The loop would take each pathname and call basename on it to extract the filename component of the pathname, and then print the resulting string with everything after the last dot removed.



    The parameter expansion ${pathname%.*} means "remove the shortest string matching .* (a literal dot followed by arbitrary text) from the end of the value of $pathname". It would have the effect of removing a filename suffix after the last dot in the filename.



    For more info about find ... -exec ... {} +, see e.g. "Understanding the -exec option of `find`".






    share|improve this answer


























    • Thanks for your help, I have tried all three, but they don't print anything. Am I missing something, on the same terminal, in the same directory find . -type f -printf '%fn' works but as I asked in the question I need them without extensions.

      – kutlus
      Jan 23 at 19:53











    • @kutlus In that case, I (and the others) may have misunderstood your question. Do you want to remove everything after the last dot in the filename?

      – Kusalananda
      Jan 23 at 19:55











    • I just want the file name, example; some files are myfile1.txt, myfile2.mp3, i want it prints myfile1, myfile2. sorry if my questions wasn`t clear, thanks

      – kutlus
      Jan 23 at 19:58











    • @kutlus See updated answer.

      – Kusalananda
      Jan 23 at 20:02











    • This worked, many thanks!

      – kutlus
      Jan 23 at 20:05














    3












    3








    3







    If I understand you correctly (I didn't, see second part of the answer), you want to avoid listing filenames that contain a dot character.



    This will do that:



    find . -type f ! -name '*.*'


    The filename globbing pattern *.* would match any filename containing at least one dot. The preceding ! negates the sense of the match, which means that the pathnames that gets through to the end will be those of files that have no dots in their names. In really ancient shells, you may want to escape the ! as ! (or update your Unix installation). The lone ! won't invoke bash's history expansion facility.



    To print only the filename component of the found pathname, with GNU find:



    find . -type f ! -name '*.*' -printf '%fn'


    With standard find (or GNU find for that matter):



    find . -type f ! -name '*.*' -exec basename {} ;


    Before using this in a command substitution in a loop, see "Why is looping over find's output bad practice?".





    To list all filenames, and at the same time remove everything after the last dot in the name ("remove the extension"), you may use



    find . -type f -exec sh -c '
    for pathname do
    pathname=$( basename "$pathname" )
    printf "%sn" "${pathname%.*}"
    done' sh {} +


    This would send all found pathnames of all files to a short shell loop. The loop would take each pathname and call basename on it to extract the filename component of the pathname, and then print the resulting string with everything after the last dot removed.



    The parameter expansion ${pathname%.*} means "remove the shortest string matching .* (a literal dot followed by arbitrary text) from the end of the value of $pathname". It would have the effect of removing a filename suffix after the last dot in the filename.



    For more info about find ... -exec ... {} +, see e.g. "Understanding the -exec option of `find`".






    share|improve this answer















    If I understand you correctly (I didn't, see second part of the answer), you want to avoid listing filenames that contain a dot character.



    This will do that:



    find . -type f ! -name '*.*'


    The filename globbing pattern *.* would match any filename containing at least one dot. The preceding ! negates the sense of the match, which means that the pathnames that gets through to the end will be those of files that have no dots in their names. In really ancient shells, you may want to escape the ! as ! (or update your Unix installation). The lone ! won't invoke bash's history expansion facility.



    To print only the filename component of the found pathname, with GNU find:



    find . -type f ! -name '*.*' -printf '%fn'


    With standard find (or GNU find for that matter):



    find . -type f ! -name '*.*' -exec basename {} ;


    Before using this in a command substitution in a loop, see "Why is looping over find's output bad practice?".





    To list all filenames, and at the same time remove everything after the last dot in the name ("remove the extension"), you may use



    find . -type f -exec sh -c '
    for pathname do
    pathname=$( basename "$pathname" )
    printf "%sn" "${pathname%.*}"
    done' sh {} +


    This would send all found pathnames of all files to a short shell loop. The loop would take each pathname and call basename on it to extract the filename component of the pathname, and then print the resulting string with everything after the last dot removed.



    The parameter expansion ${pathname%.*} means "remove the shortest string matching .* (a literal dot followed by arbitrary text) from the end of the value of $pathname". It would have the effect of removing a filename suffix after the last dot in the filename.



    For more info about find ... -exec ... {} +, see e.g. "Understanding the -exec option of `find`".







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Jan 23 at 20:28

























    answered Jan 23 at 19:26









    KusalanandaKusalananda

    132k17252416




    132k17252416













    • Thanks for your help, I have tried all three, but they don't print anything. Am I missing something, on the same terminal, in the same directory find . -type f -printf '%fn' works but as I asked in the question I need them without extensions.

      – kutlus
      Jan 23 at 19:53











    • @kutlus In that case, I (and the others) may have misunderstood your question. Do you want to remove everything after the last dot in the filename?

      – Kusalananda
      Jan 23 at 19:55











    • I just want the file name, example; some files are myfile1.txt, myfile2.mp3, i want it prints myfile1, myfile2. sorry if my questions wasn`t clear, thanks

      – kutlus
      Jan 23 at 19:58











    • @kutlus See updated answer.

      – Kusalananda
      Jan 23 at 20:02











    • This worked, many thanks!

      – kutlus
      Jan 23 at 20:05



















    • Thanks for your help, I have tried all three, but they don't print anything. Am I missing something, on the same terminal, in the same directory find . -type f -printf '%fn' works but as I asked in the question I need them without extensions.

      – kutlus
      Jan 23 at 19:53











    • @kutlus In that case, I (and the others) may have misunderstood your question. Do you want to remove everything after the last dot in the filename?

      – Kusalananda
      Jan 23 at 19:55











    • I just want the file name, example; some files are myfile1.txt, myfile2.mp3, i want it prints myfile1, myfile2. sorry if my questions wasn`t clear, thanks

      – kutlus
      Jan 23 at 19:58











    • @kutlus See updated answer.

      – Kusalananda
      Jan 23 at 20:02











    • This worked, many thanks!

      – kutlus
      Jan 23 at 20:05

















    Thanks for your help, I have tried all three, but they don't print anything. Am I missing something, on the same terminal, in the same directory find . -type f -printf '%fn' works but as I asked in the question I need them without extensions.

    – kutlus
    Jan 23 at 19:53





    Thanks for your help, I have tried all three, but they don't print anything. Am I missing something, on the same terminal, in the same directory find . -type f -printf '%fn' works but as I asked in the question I need them without extensions.

    – kutlus
    Jan 23 at 19:53













    @kutlus In that case, I (and the others) may have misunderstood your question. Do you want to remove everything after the last dot in the filename?

    – Kusalananda
    Jan 23 at 19:55





    @kutlus In that case, I (and the others) may have misunderstood your question. Do you want to remove everything after the last dot in the filename?

    – Kusalananda
    Jan 23 at 19:55













    I just want the file name, example; some files are myfile1.txt, myfile2.mp3, i want it prints myfile1, myfile2. sorry if my questions wasn`t clear, thanks

    – kutlus
    Jan 23 at 19:58





    I just want the file name, example; some files are myfile1.txt, myfile2.mp3, i want it prints myfile1, myfile2. sorry if my questions wasn`t clear, thanks

    – kutlus
    Jan 23 at 19:58













    @kutlus See updated answer.

    – Kusalananda
    Jan 23 at 20:02





    @kutlus See updated answer.

    – Kusalananda
    Jan 23 at 20:02













    This worked, many thanks!

    – kutlus
    Jan 23 at 20:05





    This worked, many thanks!

    – kutlus
    Jan 23 at 20:05













    3














    In Linux, there is no such thing as a file extension. A . in a file name has no significance whatsoever (notwithstanding that a . as the first character in a filename identifies it as a hidden file).



    Also, checking the manual page for find on my system shows no --ignore option.



    That said, if you want to ignore any files with a . in their name, you can use find's -not operator:



    find -type f -not -name '*.*' -print





    share|improve this answer
























    • thanks but this doesn`t print anything.

      – kutlus
      Jan 23 at 19:49











    • If this does not print anything, then all files must have a . in their names.

      – DopeGhoti
      Jan 23 at 20:43
















    3














    In Linux, there is no such thing as a file extension. A . in a file name has no significance whatsoever (notwithstanding that a . as the first character in a filename identifies it as a hidden file).



    Also, checking the manual page for find on my system shows no --ignore option.



    That said, if you want to ignore any files with a . in their name, you can use find's -not operator:



    find -type f -not -name '*.*' -print





    share|improve this answer
























    • thanks but this doesn`t print anything.

      – kutlus
      Jan 23 at 19:49











    • If this does not print anything, then all files must have a . in their names.

      – DopeGhoti
      Jan 23 at 20:43














    3












    3








    3







    In Linux, there is no such thing as a file extension. A . in a file name has no significance whatsoever (notwithstanding that a . as the first character in a filename identifies it as a hidden file).



    Also, checking the manual page for find on my system shows no --ignore option.



    That said, if you want to ignore any files with a . in their name, you can use find's -not operator:



    find -type f -not -name '*.*' -print





    share|improve this answer













    In Linux, there is no such thing as a file extension. A . in a file name has no significance whatsoever (notwithstanding that a . as the first character in a filename identifies it as a hidden file).



    Also, checking the manual page for find on my system shows no --ignore option.



    That said, if you want to ignore any files with a . in their name, you can use find's -not operator:



    find -type f -not -name '*.*' -print






    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Jan 23 at 19:26









    DopeGhotiDopeGhoti

    45.8k55988




    45.8k55988













    • thanks but this doesn`t print anything.

      – kutlus
      Jan 23 at 19:49











    • If this does not print anything, then all files must have a . in their names.

      – DopeGhoti
      Jan 23 at 20:43



















    • thanks but this doesn`t print anything.

      – kutlus
      Jan 23 at 19:49











    • If this does not print anything, then all files must have a . in their names.

      – DopeGhoti
      Jan 23 at 20:43

















    thanks but this doesn`t print anything.

    – kutlus
    Jan 23 at 19:49





    thanks but this doesn`t print anything.

    – kutlus
    Jan 23 at 19:49













    If this does not print anything, then all files must have a . in their names.

    – DopeGhoti
    Jan 23 at 20:43





    If this does not print anything, then all files must have a . in their names.

    – DopeGhoti
    Jan 23 at 20:43











    2














    As other's have pointed out, "extensions" don't really mean anything to Unix systems. But we can remove them from a listing with a simple sed command.



    e.g.



    find * -type f -print | sed 's/.[^.]*$//'


    If there are directories and you don't want them to be shown in the listing then



    find * -type f -printf "%fn" | sed 's/.[^.]*$//'


    For a single directory we can just use ls instead of find



    ls | sed 's/.[^.]*$//'





    share|improve this answer




























      2














      As other's have pointed out, "extensions" don't really mean anything to Unix systems. But we can remove them from a listing with a simple sed command.



      e.g.



      find * -type f -print | sed 's/.[^.]*$//'


      If there are directories and you don't want them to be shown in the listing then



      find * -type f -printf "%fn" | sed 's/.[^.]*$//'


      For a single directory we can just use ls instead of find



      ls | sed 's/.[^.]*$//'





      share|improve this answer


























        2












        2








        2







        As other's have pointed out, "extensions" don't really mean anything to Unix systems. But we can remove them from a listing with a simple sed command.



        e.g.



        find * -type f -print | sed 's/.[^.]*$//'


        If there are directories and you don't want them to be shown in the listing then



        find * -type f -printf "%fn" | sed 's/.[^.]*$//'


        For a single directory we can just use ls instead of find



        ls | sed 's/.[^.]*$//'





        share|improve this answer













        As other's have pointed out, "extensions" don't really mean anything to Unix systems. But we can remove them from a listing with a simple sed command.



        e.g.



        find * -type f -print | sed 's/.[^.]*$//'


        If there are directories and you don't want them to be shown in the listing then



        find * -type f -printf "%fn" | sed 's/.[^.]*$//'


        For a single directory we can just use ls instead of find



        ls | sed 's/.[^.]*$//'






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 23 at 20:07









        Stephen HarrisStephen Harris

        26.3k24779




        26.3k24779























            1














            try



            find . -type f ! -name '*.*' -print


            where





            • ! : not (! must be escaped)


            • name '*.*' : filename with extension






            share|improve this answer
























            • arg, not fast enough !!

              – Archemar
              Jan 23 at 19:27











            • Having to escape ! is why I usually suggest using -not.

              – DopeGhoti
              Jan 23 at 19:27











            • well it work w/o escape, I've been escaping it ever since SunOS 3.X... sight.

              – Archemar
              Jan 23 at 19:29











            • thanks but this doesn`t print anything.

              – kutlus
              Jan 23 at 19:48











            • In what shell do you need to escape it? It works without escaping in both zsh and bash. Both these shells only interpret a history expansion when the ! is accompanied by another character.

              – JoL
              Jan 23 at 23:40
















            1














            try



            find . -type f ! -name '*.*' -print


            where





            • ! : not (! must be escaped)


            • name '*.*' : filename with extension






            share|improve this answer
























            • arg, not fast enough !!

              – Archemar
              Jan 23 at 19:27











            • Having to escape ! is why I usually suggest using -not.

              – DopeGhoti
              Jan 23 at 19:27











            • well it work w/o escape, I've been escaping it ever since SunOS 3.X... sight.

              – Archemar
              Jan 23 at 19:29











            • thanks but this doesn`t print anything.

              – kutlus
              Jan 23 at 19:48











            • In what shell do you need to escape it? It works without escaping in both zsh and bash. Both these shells only interpret a history expansion when the ! is accompanied by another character.

              – JoL
              Jan 23 at 23:40














            1












            1








            1







            try



            find . -type f ! -name '*.*' -print


            where





            • ! : not (! must be escaped)


            • name '*.*' : filename with extension






            share|improve this answer













            try



            find . -type f ! -name '*.*' -print


            where





            • ! : not (! must be escaped)


            • name '*.*' : filename with extension







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Jan 23 at 19:27









            ArchemarArchemar

            20.2k93772




            20.2k93772













            • arg, not fast enough !!

              – Archemar
              Jan 23 at 19:27











            • Having to escape ! is why I usually suggest using -not.

              – DopeGhoti
              Jan 23 at 19:27











            • well it work w/o escape, I've been escaping it ever since SunOS 3.X... sight.

              – Archemar
              Jan 23 at 19:29











            • thanks but this doesn`t print anything.

              – kutlus
              Jan 23 at 19:48











            • In what shell do you need to escape it? It works without escaping in both zsh and bash. Both these shells only interpret a history expansion when the ! is accompanied by another character.

              – JoL
              Jan 23 at 23:40



















            • arg, not fast enough !!

              – Archemar
              Jan 23 at 19:27











            • Having to escape ! is why I usually suggest using -not.

              – DopeGhoti
              Jan 23 at 19:27











            • well it work w/o escape, I've been escaping it ever since SunOS 3.X... sight.

              – Archemar
              Jan 23 at 19:29











            • thanks but this doesn`t print anything.

              – kutlus
              Jan 23 at 19:48











            • In what shell do you need to escape it? It works without escaping in both zsh and bash. Both these shells only interpret a history expansion when the ! is accompanied by another character.

              – JoL
              Jan 23 at 23:40

















            arg, not fast enough !!

            – Archemar
            Jan 23 at 19:27





            arg, not fast enough !!

            – Archemar
            Jan 23 at 19:27













            Having to escape ! is why I usually suggest using -not.

            – DopeGhoti
            Jan 23 at 19:27





            Having to escape ! is why I usually suggest using -not.

            – DopeGhoti
            Jan 23 at 19:27













            well it work w/o escape, I've been escaping it ever since SunOS 3.X... sight.

            – Archemar
            Jan 23 at 19:29





            well it work w/o escape, I've been escaping it ever since SunOS 3.X... sight.

            – Archemar
            Jan 23 at 19:29













            thanks but this doesn`t print anything.

            – kutlus
            Jan 23 at 19:48





            thanks but this doesn`t print anything.

            – kutlus
            Jan 23 at 19:48













            In what shell do you need to escape it? It works without escaping in both zsh and bash. Both these shells only interpret a history expansion when the ! is accompanied by another character.

            – JoL
            Jan 23 at 23:40





            In what shell do you need to escape it? It works without escaping in both zsh and bash. Both these shells only interpret a history expansion when the ! is accompanied by another character.

            – JoL
            Jan 23 at 23:40


















            draft saved

            draft discarded




















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • 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%2funix.stackexchange.com%2fquestions%2f496299%2flinux-find-command-for-filenames-without-extension-for-unknown-extensions%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

            Human spaceflight

            Can not write log (Is /dev/pts mounted?) - openpty in Ubuntu-on-Windows?

            張江高科駅