Eliminating multiple-extension file names from find output

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











up vote
0
down vote

favorite












I need to find the size of all files in /etc with the .conf extension. I tried to do this with find /etc -type f -name "*.conf" -exec du -chB1 +, but find gave me .conf files that have two or three extensions. The question is how can I filter find output in order to get just the files with one extension, that being .conf ? Can this be achieved through find or do I need another command ?










share|improve this question









New contributor




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



















  • What do you mean by two or three extensions, can you clarify on that
    – sla3k
    2 days ago










  • How do you define an extension? What if the file name is a.b.conf. Where a.b is file name and .conf is an extension?
    – Debian_yadav
    2 days ago










  • Well, for example I wanted to find file names like this one /etc/pam.conf, but instead the command above would give me something like this too /etc.dbus-1/system.d/org.freedesktop.bolt.conf
    – george
    2 days ago










  • What about a hidden .ltrace.conf file for instance?
    – Stéphane Chazelas
    2 days ago














up vote
0
down vote

favorite












I need to find the size of all files in /etc with the .conf extension. I tried to do this with find /etc -type f -name "*.conf" -exec du -chB1 +, but find gave me .conf files that have two or three extensions. The question is how can I filter find output in order to get just the files with one extension, that being .conf ? Can this be achieved through find or do I need another command ?










share|improve this question









New contributor




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



















  • What do you mean by two or three extensions, can you clarify on that
    – sla3k
    2 days ago










  • How do you define an extension? What if the file name is a.b.conf. Where a.b is file name and .conf is an extension?
    – Debian_yadav
    2 days ago










  • Well, for example I wanted to find file names like this one /etc/pam.conf, but instead the command above would give me something like this too /etc.dbus-1/system.d/org.freedesktop.bolt.conf
    – george
    2 days ago










  • What about a hidden .ltrace.conf file for instance?
    – Stéphane Chazelas
    2 days ago












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I need to find the size of all files in /etc with the .conf extension. I tried to do this with find /etc -type f -name "*.conf" -exec du -chB1 +, but find gave me .conf files that have two or three extensions. The question is how can I filter find output in order to get just the files with one extension, that being .conf ? Can this be achieved through find or do I need another command ?










share|improve this question









New contributor




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











I need to find the size of all files in /etc with the .conf extension. I tried to do this with find /etc -type f -name "*.conf" -exec du -chB1 +, but find gave me .conf files that have two or three extensions. The question is how can I filter find output in order to get just the files with one extension, that being .conf ? Can this be achieved through find or do I need another command ?







find filenames






share|improve this question









New contributor




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











share|improve this question









New contributor




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









share|improve this question




share|improve this question








edited 2 days ago









don_crissti

48.6k15129156




48.6k15129156






New contributor




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









asked 2 days ago









george

1




1




New contributor




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





New contributor





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






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











  • What do you mean by two or three extensions, can you clarify on that
    – sla3k
    2 days ago










  • How do you define an extension? What if the file name is a.b.conf. Where a.b is file name and .conf is an extension?
    – Debian_yadav
    2 days ago










  • Well, for example I wanted to find file names like this one /etc/pam.conf, but instead the command above would give me something like this too /etc.dbus-1/system.d/org.freedesktop.bolt.conf
    – george
    2 days ago










  • What about a hidden .ltrace.conf file for instance?
    – Stéphane Chazelas
    2 days ago
















  • What do you mean by two or three extensions, can you clarify on that
    – sla3k
    2 days ago










  • How do you define an extension? What if the file name is a.b.conf. Where a.b is file name and .conf is an extension?
    – Debian_yadav
    2 days ago










  • Well, for example I wanted to find file names like this one /etc/pam.conf, but instead the command above would give me something like this too /etc.dbus-1/system.d/org.freedesktop.bolt.conf
    – george
    2 days ago










  • What about a hidden .ltrace.conf file for instance?
    – Stéphane Chazelas
    2 days ago















What do you mean by two or three extensions, can you clarify on that
– sla3k
2 days ago




What do you mean by two or three extensions, can you clarify on that
– sla3k
2 days ago












How do you define an extension? What if the file name is a.b.conf. Where a.b is file name and .conf is an extension?
– Debian_yadav
2 days ago




How do you define an extension? What if the file name is a.b.conf. Where a.b is file name and .conf is an extension?
– Debian_yadav
2 days ago












Well, for example I wanted to find file names like this one /etc/pam.conf, but instead the command above would give me something like this too /etc.dbus-1/system.d/org.freedesktop.bolt.conf
– george
2 days ago




Well, for example I wanted to find file names like this one /etc/pam.conf, but instead the command above would give me something like this too /etc.dbus-1/system.d/org.freedesktop.bolt.conf
– george
2 days ago












What about a hidden .ltrace.conf file for instance?
– Stéphane Chazelas
2 days ago




What about a hidden .ltrace.conf file for instance?
– Stéphane Chazelas
2 days ago










1 Answer
1






active

oldest

votes

















up vote
0
down vote













You could exclude the file names that contain more than one dot:



find /etc -type f ! -name '*.*.*' -name '*.conf'


If you still want to print hidden .conf file names (if any, à la /etc/.pwd.lock) then



find /etc -type f ! -name '?*.*.*' -name '*.conf'





share|improve this answer






















  • Suppose I am having a file with name a.b.conf. Where a.b is the name of the file and .conf is extension.
    – Debian_yadav
    2 days ago










  • @Debian_yadav - according to you, according to the next guy the file name is a and b is another extension... you know, like tar in tar.gz...
    – don_crissti
    2 days ago










  • One might prefer ! -name '?*.*.*' to allow files named like .socks.conf for instance, where .socks can't possibly be considered as an extension (it's rare to find such files in /etc except maybe in /etc/skel though).
    – Stéphane Chazelas
    2 days ago











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',
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
);



);






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









 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f482023%2feliminating-multiple-extension-file-names-from-find-output%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













You could exclude the file names that contain more than one dot:



find /etc -type f ! -name '*.*.*' -name '*.conf'


If you still want to print hidden .conf file names (if any, à la /etc/.pwd.lock) then



find /etc -type f ! -name '?*.*.*' -name '*.conf'





share|improve this answer






















  • Suppose I am having a file with name a.b.conf. Where a.b is the name of the file and .conf is extension.
    – Debian_yadav
    2 days ago










  • @Debian_yadav - according to you, according to the next guy the file name is a and b is another extension... you know, like tar in tar.gz...
    – don_crissti
    2 days ago










  • One might prefer ! -name '?*.*.*' to allow files named like .socks.conf for instance, where .socks can't possibly be considered as an extension (it's rare to find such files in /etc except maybe in /etc/skel though).
    – Stéphane Chazelas
    2 days ago















up vote
0
down vote













You could exclude the file names that contain more than one dot:



find /etc -type f ! -name '*.*.*' -name '*.conf'


If you still want to print hidden .conf file names (if any, à la /etc/.pwd.lock) then



find /etc -type f ! -name '?*.*.*' -name '*.conf'





share|improve this answer






















  • Suppose I am having a file with name a.b.conf. Where a.b is the name of the file and .conf is extension.
    – Debian_yadav
    2 days ago










  • @Debian_yadav - according to you, according to the next guy the file name is a and b is another extension... you know, like tar in tar.gz...
    – don_crissti
    2 days ago










  • One might prefer ! -name '?*.*.*' to allow files named like .socks.conf for instance, where .socks can't possibly be considered as an extension (it's rare to find such files in /etc except maybe in /etc/skel though).
    – Stéphane Chazelas
    2 days ago













up vote
0
down vote










up vote
0
down vote









You could exclude the file names that contain more than one dot:



find /etc -type f ! -name '*.*.*' -name '*.conf'


If you still want to print hidden .conf file names (if any, à la /etc/.pwd.lock) then



find /etc -type f ! -name '?*.*.*' -name '*.conf'





share|improve this answer














You could exclude the file names that contain more than one dot:



find /etc -type f ! -name '*.*.*' -name '*.conf'


If you still want to print hidden .conf file names (if any, à la /etc/.pwd.lock) then



find /etc -type f ! -name '?*.*.*' -name '*.conf'






share|improve this answer














share|improve this answer



share|improve this answer








edited 2 days ago


























community wiki





2 revs
don_crissti












  • Suppose I am having a file with name a.b.conf. Where a.b is the name of the file and .conf is extension.
    – Debian_yadav
    2 days ago










  • @Debian_yadav - according to you, according to the next guy the file name is a and b is another extension... you know, like tar in tar.gz...
    – don_crissti
    2 days ago










  • One might prefer ! -name '?*.*.*' to allow files named like .socks.conf for instance, where .socks can't possibly be considered as an extension (it's rare to find such files in /etc except maybe in /etc/skel though).
    – Stéphane Chazelas
    2 days ago

















  • Suppose I am having a file with name a.b.conf. Where a.b is the name of the file and .conf is extension.
    – Debian_yadav
    2 days ago










  • @Debian_yadav - according to you, according to the next guy the file name is a and b is another extension... you know, like tar in tar.gz...
    – don_crissti
    2 days ago










  • One might prefer ! -name '?*.*.*' to allow files named like .socks.conf for instance, where .socks can't possibly be considered as an extension (it's rare to find such files in /etc except maybe in /etc/skel though).
    – Stéphane Chazelas
    2 days ago
















Suppose I am having a file with name a.b.conf. Where a.b is the name of the file and .conf is extension.
– Debian_yadav
2 days ago




Suppose I am having a file with name a.b.conf. Where a.b is the name of the file and .conf is extension.
– Debian_yadav
2 days ago












@Debian_yadav - according to you, according to the next guy the file name is a and b is another extension... you know, like tar in tar.gz...
– don_crissti
2 days ago




@Debian_yadav - according to you, according to the next guy the file name is a and b is another extension... you know, like tar in tar.gz...
– don_crissti
2 days ago












One might prefer ! -name '?*.*.*' to allow files named like .socks.conf for instance, where .socks can't possibly be considered as an extension (it's rare to find such files in /etc except maybe in /etc/skel though).
– Stéphane Chazelas
2 days ago





One might prefer ! -name '?*.*.*' to allow files named like .socks.conf for instance, where .socks can't possibly be considered as an extension (it's rare to find such files in /etc except maybe in /etc/skel though).
– Stéphane Chazelas
2 days ago











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









 

draft saved


draft discarded


















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












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











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













 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f482023%2feliminating-multiple-extension-file-names-from-find-output%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

How to check contact read email or not when send email to Individual?

Displaying single band from multi-band raster using QGIS

How many registers does an x86_64 CPU actually have?