LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-30-2018, 03:31 PM   #1
kevinbenko
Member
 
Registered: Jun 2005
Location: Fargo, North Dakota
Distribution: Debian Stable {Probably forever}
Posts: 634

Rep: Reputation: 174Reputation: 174
Delete A File Using Inode


This is hopefully a quick question for someone to answer.

I have a file that is a bit weird... I made it accidentally and I am unable to delete is through normal methods.

I know what the inode number of the file is.

What command can I use (probably rm) to delete this evil and nasty file using only the inode number.

I read the manual in rm, unlink, chattr, and shred.
But I found nothing about deleting the file via the inode number.

Can someone please give me a command and options to delete this file.....


Thank you for your help, and have a good day.
 
Old 09-30-2018, 03:46 PM   #2
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,674

Rep: Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712
Hint: check the man page for find. Find can find by inode, and delete the found file in one step.

There are other ways: in linux there is ALWAYS more than one way to do it.
 
Old 09-30-2018, 04:55 PM   #3
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,733

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
+1 for find.
Note, if the file name contains spaces or other weird characters, try quoting it.
 
Old 09-30-2018, 05:10 PM   #4
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 21 MATE
Posts: 8,048
Blog Entries: 5

Rep: Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925
You might also be interested in the debugfs utility (in the e2fsprogs package). It's quite powerful, so use with caution.
 
Old 09-30-2018, 06:40 PM   #5
kevinbenko
Member
 
Registered: Jun 2005
Location: Fargo, North Dakota
Distribution: Debian Stable {Probably forever}
Posts: 634

Original Poster
Rep: Reputation: 174Reputation: 174
OK... thank you all... It worked.

The full truth...

It was on my media player, with a WiNdOwS filesystem.
"Find" annihilated the files that I was unable to delete.

THANK YOU!!!

Last edited by kevinbenko; 09-30-2018 at 06:43 PM.
 
  


Reply



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
Neither specifying inode ratio nor inode quantity seems to have an effect on mkfs.ext2 Bogomips_ Linux - Software 4 01-24-2017 07:24 PM
loop through a DIR to delete files by inode j-me Linux - General 5 02-09-2010 04:05 PM
Quickly retrieve a file from its file system / inode jef_te Linux - Newbie 1 04-17-2008 07:50 PM
hard links problem: how to delete all pointers to an inode at once? onufry Linux - General 6 11-18-2007 06:27 PM
Can you write a script to display file name, Inode, and size of any file? JaxsunApex Linux - Newbie 3 01-30-2007 08:39 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:24 PM.

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
Open Source Consulting | Domain Registration