help with linux command

maxwell_tr

Member
May 4, 2022
59
11
8
Hello,

There are several folders under the home directory in the Linux server. I want to delete files with .jpg extension in these folders.

What command can I use? Deleting .jpg files only.
 

haksxsx

Well-known member
Trusted Seller
Trusted Uploader
Dec 21, 2018
901
889
93
Internet
cd to the directory and run find . -name "*.jpg" find . -name "*.jpg" | xargs rm

xargs outputs the founded files to rm command and rm deletes them.
 
  • Like
Reactions: maxwell_tr

maxwell_tr

Member
May 4, 2022
59
11
8
Thanks for your reply guys.
For example I want to delete all .jpg files under home/xavier/ file. Is it possible that I can do it without using the find command?
 

About us

  • Our community has been around for many years and pride ourselves on offering unbiased, critical discussion among people of all different backgrounds. We are working every day to make sure our community is one of the best.

Quick Navigation

User Menu