Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
2 . ..... etc .... media ..... root .... tmp
2 .. 2 home
when we have
Quote:
ls -ai ~
some of the output is:
Quote:
2752412 .
2 ..
in "/" the inode numbers of "home", "." and ".." are the same. while the inode of "." changes in /home. I have a vague answer fr it in my mind, but I don't know why in "/" all said inodes are the same?
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime,seclabel)
devtmpfs on /dev type devtmpfs (rw,nosuid,seclabel,size=4076932k,nr_inodes=1028433,mode=755)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
selinuxfs on /sys/fs/selinux type selinuxfs (rw,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,seclabel)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,seclabel,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,nodev,seclabel,mode=755)
tmpfs on /sys/fs/cgroup type tmpfs (rw,nosuid,nodev,noexec,seclabel,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpuacct,cpu)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/net_cls type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
/dev/mapper/fedora-root on / type ext4 (rw,relatime,seclabel,data=ordered)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=35,pgrp=1,timeout=300,minproto=5,maxproto=5,direct)
configfs on /sys/kernel/config type configfs (rw,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
mqueue on /dev/mqueue type mqueue (rw,relatime,seclabel)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,seclabel)
tmpfs on /tmp type tmpfs (rw,seclabel)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,relatime)
/dev/sda7 on /boot type ext4 (rw,relatime,seclabel,data=ordered)
/dev/mapper/fedora-home on /home type ext4 (rw,relatime,seclabel,data=ordered)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)
/dev/sr0 on /run/media/sryzdn/WebTemplates1 type iso9660 (ro,nosuid,nodev,relatime,uid=1000,gid=1000,iocharset=utf8,mode=0400,dmode=0500,uhelper=udisks2)
/dev/sda3 on /run/media/sryzdn/28082EC8082E953A type fuseblk (rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096)
What does it have about the inodes of ".", ".." and "home" being the same ?!?!?!?
Actually, 'df -h' would be easier to glean from.
Anyway, the top inode on a partition is '2'.
On the system root '/' I get 2 for '.' and '..', which makes sense.
(FYI inode 1 is /sys).
If you have partitions mounted direct at root '/', you'll get the same effect.
I've got a couple of extra mounts, but not mounted off '/', so the parent '..' inodes are high nums.
Code:
cd /
ls -ai
2 .
2 ..
2 boot
# low mounted partitions
cd /var/lib/libvirt
ls -ai
2 images 2 partn_pool
cd /var/lib/libvirt/images
ls -ai
2 .
3933962 ..
# which matches
Filesystem Size Used Avail Use% Mounted on
/dev/sdb2 70G 20G 46G 31% /
tmpfs 3.8G 424K 3.8G 1% /dev/shm
/dev/sdb1 504M 84M 395M 18% /boot
/dev/sda6 99G 16G 78G 17% /var/lib/libvirt/images
/dev/sda8 9.9G 9.2G 201M 98% /var/lib/libvirt/partn_pool
# also
cd /boot
ls -ai
2 .
2 ..
Each partition has its own inode list/table, which, incidentally, is why you can't hardlink across filesystems (partitions).
The directory structure is a tree, the parent directory contains entries for all subdirectories it contains (thus /home is a subdirectory of /).
".." is the name of the parent directory. Thus .. in the / points to the same directory as / (which is the same as the entry for ".").
In /home, the ".." entry points to the root directory /.
The "." entry in a directory represents the directory itself.
So every directory has an entry for ".." that can be different. They would be the same for all subdirectories of a given directory. All entries for "." will be different.
As every file is represented by an inode number, the inode numbers also represent the directories (directories are just files - just marked as "special"), all they really contain is an inode number, and the file name (/usr/include/bits/dirent.h for details).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.