# We will first look at (some of the) metadata stored in i-nodes. # The simplest way to learn those is the ‹stat› command. # Unfortunately, ‹stat› is not standardized by POSIX and may be # missing on a system or behave differently. Anyway, on Linux it # works like this: stat intro.txt echo echo compare: stat / echo echo also compare: stat /dev/null # Depending on the file type (printed as the last thing on the # second line), there are some interesting bits of info: # # 1. the size (in bytes) # 2. the inode number # 3. the number of links pointing at this inode (the reference # count, basically) # 4. the owner and group (‹uid› and ‹gid›) # 5. permission bits (e.g.: ‹0644› or ‹-rw-r--r--›) # 6. modification, access and change timestamps # # We will delve into the details of 4 and 5 in the second half of # the semester. The timestamps record at what time last operation # of given kind happened with the file. Those are not authoritative: # users are allowed to change them (see ‹man touch›). More details # in ‹man 1 stat› and also ‹man 2 stat›. # # Well this was somewhat easy. Let's look at the C version: # # $ micro stat.c