Linux Inode File Removal Tutorial

Linux Inode File Removal Tutorial

Linux Inode File Removal Tutorial

We think of the Linux and Unix concept of an “inode” as interesting in terms of an organizational design for a hard disk operating system, but more of a curiosity in most day to day interfacing to Linux. After all, Windows and DOS don’t use, or seem to need the concept. You may want to read more about this at Linux Inode Primer Tutorial as shown below.

That is, until, the other day, we accidentally renamed a Linux web server file to contain funny characters, somehow occurring during some FileZilla sftp operations we were doing. To FileZilla these “funny characters” only appear as a small blank left indentation to the filename as show with its GUI interface, but, go to the Linux command line via ssh and you see …


# ls -li
...
...
2596915 -rw-r--r-- 1 rjmprogr rjmprogr 44578 Sep 11 09:55 \ \ map.php
...
#

… and no matter what you try like …


# rm -f "*map.php"

… or …


# mv -i "*map.php" xx.xx

… or to attempt a clobber it with a local “map.php” via a FileZilla sftp file transfer, you cannot solve it causing problems via these conventional approaches.

We knew there was a way with “inodes” but cannot embed it in the memory, for the few times you “have” to use it, so looked up Google to arrive at this very useful link‘s advice (tip #5, starting with ls -li), thanks, so that we ended up at the Linux command line of an ssh session, going …


find . -inum 2596915 -exec rm -i {} \;

… to which you get prompted about removing that rogue file from the system, allowing for an orderly FileZilla sftp file transfer of local “map.php” to be achieved. And it is at times like this that I bless the “inode” concept. Please don’t think that you can’t get into a similar problem working with Windows (or DOS), because you can, but you’ll have to discover a method not involving “inodes” to get you out of your “pickle” there.


Previous relevant Linux Inode Primer Tutorial is shown below.

Linux Inode Primer Tutorial

Linux Inode Primer Tutorial

When you learn Unix or Linux you are taught that a lot of things about how the operating system works are about files.

And with Unix and Linux those files can often be (further) referenced via a number called an inode … to quote …

A Unix file is “stored” in two different parts of the disk – the data blocks and the inodes. (I won’t get into superblocks and other esoteric information.) The data blocks contain the “contents” of the file. The information about the file is stored elsewhere – in the inode.

… and this inode is examinable with the stat command to show … (and to quote again) …

  • Mode/permission (protection)
  • Owner ID
  • Group ID
  • Size of file
  • Number of hard links to the file
  • Time last accessed
  • Time last modified
  • Time inode last modified

Unix and linux operating systems will have a quota of inode numbers allowed, information for which can be found with a command like “df -ih” relevant to inode numbers used relative to quotas for each disk, which we talked about a bit at Client Pre-Emptive Iframe Crontab Curl Rotated Report Tutorial.

We show a few inode related Linux commands here.

If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.

This entry was posted in eLearning, Operating System, Tutorials and tagged , , , , , , , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>