Linux listing commands, inode number and links
listing command
===================
#ls -------------it will list out all the files and directories under ur pwd
#ls -F--------it will show u which and all are files and which and all are directories
ls -l---------to list all the files and directories along with their permission under the pwd
-rw-r--r--. 1 root root 0 Mar 11 06:04 f2
- -------it indicates normal file
d --------it indicates a directory
l ----------it is a linked file
rw- -------------this permission is for the owner of the file
r-- ----------------this permission is for the group owner of this file
r-- -------------------this permission is for the others
. --------no acl permission
+ --------acl permission has been applied
1 --------------no of links
root ------------owner of that file
root -------------group owner of that file
0 ---------------size of the file
#ls -l <fn>-----------------it will list out the permission for a particular file
#ls -ld <dn> ----------------it will list out the permission for a particular directory
#ls -i -------to list indode number for all the files and directories in pwd
#ls -li <fn>--------it will list out inode number along with permission of that file
#ls -ldi <dn>----------it will list out inode number along with the permissions of that directory
#ls s*--------------it will list all the files with the starting letter s
#ls -lS -----------------it will list out the highest size of the file
#ls -lt------------------to list the timing when the files and directories where created
#ls -ltr------------------to list the timing in reverse order
#l.-----------only to see the hidden files
#ls -a---------------to see both hidden as well as non-hidden files in ur pwd
inode number
=============
inode number contains complete information about files and directories
information like----file size,permission,owner,group owner
file name ---------------------is for human reference
inode number is for kernel reference
#ls -i
links
==============
link file is a shortcut file of its original file
there are two types of links
==============================
soft link
hard link
soflink
========= hardlink
file size is not same =============
compared to original file file size is same
inode numbers are same
inode number of originalfile backup file
and soft link file is different if original file gets deleted also data wont get lost
hardlink is not applied for directory
shortcut file
if original file is deleted
the link is broken and data is lost
softlink can be applied to a directory
commands
============
ln -s /f1 /f2
to create a soft link file
ln /f1 /f3
to create a hard link file
absolute path and relative path
===================================
absolute path
================
give the full locn path
always start with /
relative path
==============
giving the path path locn from where the parent directory starts
and should use cd and ls everytime
going back to previous folder
cd ..
cd ../..
mkdir -p /root/d45/d46/d47
creating a file f1 inside d47 folder
absolute path
==============
touch /root/d45/d46/d47/f1
relative path
===============
pwd
ls
cd /root
ls
cd d45
ls
cd d46
ls
cd d47
touch f1
absolute path
================
cd /root/d45/d46/d47
mkdir -p /root/d45/d46/d47/d49
Comments
Post a Comment