LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Closed Thread
  Search this Thread
Old 07-24-2025, 08:03 AM   #1
Matthew Wai
Member
 
Registered: Jul 2019
Location: China
Distribution: UnionTech OS Desktop Home (64-bit)
Posts: 259

Rep: Reputation: Disabled
Windows Registry files cannot be deleted from Trash.


On a Chinese forum, a member has failed to delete the following files from Trash.

Code:
user@user-PC:~$ ls ~/.l*/s*/T*/f*/|while IFS= read -r X;do echo "${X}";done
HKEY_CURRENT_USER\Software\kingsoft\Office\6.0\plugins\kcopilotentrylite\aibrandcfg
HKEY_CURRENT_USERSoftwarekingsoftOffice6.0pluginskcopilotentryliteaibrandcfg
The files were created in the Home folder when WPS Office was opened.
He/she used the command "rm" but to no avail.

Code:
user@user-PC:~$ cd ~/.local/share/Trash/files 
user@user-PC:~/.local/share/Trash/files$ 
user@user-PC:~/.local/share/Trash/files$ file="HKEY_CURRENT_USER\Software\kingsoft\Office\6.0\plugins\kcopilotentrylite\aibrandcfg" 
user@user-PC:~/.local/share/Trash/files$ 
user@user-PC:~/.local/share/Trash/files$  rm -rf "${file}"
How can the files be deleted?

Source: https://bbs.chinauos.com/post/22783
 
Old 07-24-2025, 08:36 AM   #2
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,818
Blog Entries: 7

Rep: Reputation: 2189Reputation: 2189Reputation: 2189Reputation: 2189Reputation: 2189Reputation: 2189Reputation: 2189Reputation: 2189Reputation: 2189Reputation: 2189Reputation: 2189
Code:
file="HKEY_CURRENT_USER\Software\kingsoft\Office\6.0\plugins\kcopilotentrylite\aibrandcfg"

rm -rf "${file}"
That isn't a file. It is a partial directory path. Or do you actually have a file named that? If so \ is not allowed in file names. You'll need to escape all of them.

\ is an escape char.

Quote:
How can the files be deleted?
File or files?

You can delete everything in a directory
Code:
~/.local/share/Trash/files/
~/.local/share/Trash/
 
1 members found this post helpful.
Old 07-24-2025, 09:13 AM   #3
jayjwa
Senior Member
 
Registered: Jul 2003
Location: NY
Distribution: Slackware, Termux, illumos, Minix3
Posts: 1,524

Rep: Reputation: 603Reputation: 603Reputation: 603Reputation: 603Reputation: 603Reputation: 603
The problem comes from the while loop and the way the files are display from the while loop and not from rm itself. You can delete them by hand with rm when the one with backslashes is single quoted or remove everything prefixed with HKEY (or just delete all files in trash). I'm assuming bash as your shell.
Code:
[09:58] jayjwa@atr2:~/.local/share/Trash/files$ touch 'HKEY_CURRENT_USER\Software\kingsoft\Office\6.0\plugins\kcopilotentrylite\aibrandcfg'
[09:59] jayjwa@atr2:~/.local/share/Trash/files$ touch 'HKEY_CURRENT_USERSoftwarekingsoftOffice6.0pluginskcopilotentryliteaibrandcfg'
[09:59] jayjwa@atr2:~/.local/share/Trash/files$ ls -l
total 0
-rw------- 1 jayjwa users 0 Jul 24 09:59 'HKEY_CURRENT_USER\Software\kingsoft\Office\6.0\plugins\kcopilotentrylite\aibrandcfg'
-rw------- 1 jayjwa users 0 Jul 24 09:59  HKEY_CURRENT_USERSoftwarekingsoftOffice6.0pluginskcopilotentryliteaibrandcfg
[09:59] jayjwa@atr2:~/.local/share/Trash/files$ rm -f ~/.local/share/Trash/files/HKEY_*
[09:59] jayjwa@atr2:~/.local/share/Trash/files$ ls -l
total 0
[09:59] jayjwa@atr2:~/.local/share/Trash/files$
You can also use find.
Code:
[10:07] jayjwa@atr2:~/.local/share/Trash/files$ touch 'HKEY_CURRENT_USER\Software\kingsoft\Office\6.0\plugins\kcopilotentrylite\aibrandcfg'
[10:07] jayjwa@atr2:~/.local/share/Trash/files$ touch 'HKEY_CURRENT_USERSoftwarekingsoftOffice6.0pluginskcopilotentryliteaibrandcfg'
[10:08] jayjwa@atr2:~/.local/share/Trash/files$ ls -l
total 0
-rw------- 1 jayjwa users 0 Jul 24 10:07 'HKEY_CURRENT_USER\Software\kingsoft\Office\6.0\plugins\kcopilotentrylite\aibrandcfg'
-rw------- 1 jayjwa users 0 Jul 24 10:07  HKEY_CURRENT_USERSoftwarekingsoftOffice6.0pluginskcopilotentryliteaibrandcfg
[10:08] jayjwa@atr2:~/.local/share/Trash/files$ find ~/.local/share/Trash/files -name '*' -type f -delete 
[10:08] jayjwa@atr2:~/.local/share/Trash/files$ ls -l
total 0
 
Old 07-24-2025, 09:52 AM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 28,359

Rep: Reputation: 8379Reputation: 8379Reputation: 8379Reputation: 8379Reputation: 8379Reputation: 8379Reputation: 8379Reputation: 8379Reputation: 8379Reputation: 8379Reputation: 8379
Quote:
Originally Posted by teckk View Post
Code:
file="HKEY_CURRENT_USER\Software\kingsoft\Office\6.0\plugins\kcopilotentrylite\aibrandcfg"
rm -rf "${file}"
That isn't a file. It is a partial directory path. Or do you actually have a file named that? If so \ is not allowed in file names. You'll need to escape all of them. \ is an escape char.
Quote:
=How can the files be deleted?
File or files? You can delete everything in a directory
Code:
~/.local/share/Trash/files/
~/.local/share/Trash/
Agree with this method...why do anything more than what's needed, especially to delete files already in a 'trash' folder? "rm -fr *" should work fine within the Trash folder. Any folder beneath it will just get recreated when new files get deleted.
 
Old 07-25-2025, 02:14 AM   #5
Matthew Wai
Member
 
Registered: Jul 2019
Location: China
Distribution: UnionTech OS Desktop Home (64-bit)
Posts: 259

Original Poster
Rep: Reputation: Disabled
Thanks to all of you!
I have just asked him/her to run the following command:

Code:
rm -rf ~/.local/share/Trash/files/*
Reference: https://bbs.chinauos.com/post/22783?postId=108626
 
Old 07-25-2025, 02:24 AM   #6
Matthew Wai
Member
 
Registered: Jul 2019
Location: China
Distribution: UnionTech OS Desktop Home (64-bit)
Posts: 259

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by teckk View Post
do you actually have a file named that?
He or she posted the following screenshot:

https://lh3.googleusercontent.com/pw...2-h304-s-no-gm
 
Old 07-25-2025, 02:38 AM   #7
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 26,460

Rep: Reputation: 8608Reputation: 8608Reputation: 8608Reputation: 8608Reputation: 8608Reputation: 8608Reputation: 8608Reputation: 8608Reputation: 8608Reputation: 8608Reputation: 8608
I don't know what is that on the picture, but I guess rm HKEY_* should work.
 
Old 07-25-2025, 02:39 AM   #8
Matthew Wai
Member
 
Registered: Jul 2019
Location: China
Distribution: UnionTech OS Desktop Home (64-bit)
Posts: 259

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by TB0ne View Post
"rm -fr *" should work fine within the Trash folder.
I think "rm -fr *" will delete files from the Home folder.
 
Old 07-25-2025, 02:43 AM   #9
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 26,460

Rep: Reputation: 8608Reputation: 8608Reputation: 8608Reputation: 8608Reputation: 8608Reputation: 8608Reputation: 8608Reputation: 8608Reputation: 8608Reputation: 8608Reputation: 8608
obviously cd to that dir first
 
Old 07-25-2025, 02:48 AM   #10
Matthew Wai
Member
 
Registered: Jul 2019
Location: China
Distribution: UnionTech OS Desktop Home (64-bit)
Posts: 259

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by pan64 View Post
obviously cd to that dir first
Obviously, a beginner might run a command without thinking about "cd".
 
Old 07-25-2025, 02:50 AM   #11
Matthew Wai
Member
 
Registered: Jul 2019
Location: China
Distribution: UnionTech OS Desktop Home (64-bit)
Posts: 259

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by jayjwa View Post
rm -f ~/.local/share/Trash/files/HKEY_*
I will ask him or her to run your command in case the command in my post #5 fails.
 
Old 07-25-2025, 02:57 AM   #12
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 26,460

Rep: Reputation: 8608Reputation: 8608Reputation: 8608Reputation: 8608Reputation: 8608Reputation: 8608Reputation: 8608Reputation: 8608Reputation: 8608Reputation: 8608Reputation: 8608
Quote:
Originally Posted by Matthew Wai View Post
I will ask him or her to run your command in case the command in my post #5 fails.
That is identical. Anyway, I think you can help him/her to delete those files without LQ, but if you need further help you need to ask for and give us more info, more details.
 
1 members found this post helpful.
Old 07-25-2025, 08:31 AM   #13
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 28,359

Rep: Reputation: 8379Reputation: 8379Reputation: 8379Reputation: 8379Reputation: 8379Reputation: 8379Reputation: 8379Reputation: 8379Reputation: 8379Reputation: 8379Reputation: 8379
Quote:
Originally Posted by Matthew Wai View Post
Obviously, a beginner might run a command without thinking about "cd".
Obviously, you would tell the 'he or she' to do so before passing on that command, right??? And if you read what I posted, I said specifically to run it **WITHIN** the Trash folder. That would remove any files and directories...and as said before they will be re-created the next time a file is deleted.

And is there a reason your 'friend' can't post their own questions???

Last edited by TB0ne; 07-25-2025 at 08:48 AM.
 
Old 07-25-2025, 12:58 PM   #14
Steve48220
Member
 
Registered: Jun 2013
Location: Ferndale, MI USA
Distribution: Debian, NetBSD
Posts: 39

Rep: Reputation: Disabled
Quote:
Originally Posted by TB0ne View Post
And is there a reason your 'friend' can't post their own questions???
The original post stated that it was from a Chinese forum. It would be logical to think that the 'friend' doesn't understand English well enough to post here. It would also be logical to believe that has English as a second language might not understand all the nuances of the English language. Saying 'within' could have multiple meanings.
 
1 members found this post helpful.
Old 07-25-2025, 01:27 PM   #15
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 28,359

Rep: Reputation: 8379Reputation: 8379Reputation: 8379Reputation: 8379Reputation: 8379Reputation: 8379Reputation: 8379Reputation: 8379Reputation: 8379Reputation: 8379Reputation: 8379
Quote:
Originally Posted by Steve48220 View Post
The original post stated that it was from a Chinese forum. It would be logical to think that the 'friend' doesn't understand English well enough to post here. It would also be logical to believe that has English as a second language might not understand all the nuances of the English language. Saying 'within' could have multiple meanings.
Also logical to think that if the OP can communicate, their 'friend' can as well, and can go to the OP for any misunderstandings/miscommunications.
 
  


Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Trash is Full. Empty Trash before moving more files/folders to Trash. wdarledge Slackware 45 12-13-2017 03:53 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:10 PM.

Contact Us - Advertising Info - Rules - Privacy - Donations - Contributing Member - LQ Sitemap - "Weather apps tell you it'll rain. Wyndo tells you when to go."
Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions