linux�´�����ɾ������Ӳ����
��Linuxϵͳ��,�ں�Ϊÿһ���´������ļ�����һ��Inode(��������),ÿ���ļ�����һ��Ωһ��inode�š��ļ����Ա���������������ڷ����ļ�ʱ���������㱻���Ƶ��ڴ��ڣ��Ӷ�ʵ���ļ��Ŀ��ٷ��ʡ�
������һ���ڹ����ļ��ͷ��������û�������Ŀ¼��֮�佨����ϵ��һ�ַ�����Linux�а����������ӣ�Ӳ����(Hard Link)��������(Soft Link),�������ֳ�Ϊ�������ӣ�Symbolic link�������������൱��Windows�µĿ��ݷ�ʽ��
һ��Ӳ����
Ӳ����˵������һ��ָ�룬ָ���ļ������ڵ㣬ϵͳ����Ϊ�����·���inode��������:ln����������Ӳ���ӡ�
�:
ln [options] existingfile newfile��sexistingfile �����������ļ����ļ���newfile���´����������ļ���
ln [options] existingfile-list directory
-f ����ʱ����ͬ������ɾ��.
-i ɾ��ǰ����ѯ��.
ln -s abc cde ����abc ��������
ln abc cde ����abc��Ӳ���ӣ�
�÷�:
��һ��:Ϊ��existingfile������Ӳ����,�ļ���Ϊ��newfile����
�ڶ���:�ڡ�directory��Ŀ¼��,Ϊ��existingfile-list���а����������ļ�����һ��ͬ����Ӳ���ӡ�
���ÿ�ѡ[options] �Cf ���ۡ�newfile����������,���������ӡ�-n ������newfile���Ѵ���,�Ͳ��������ӡ�
������һЩ����:
[[email protected] test]# ls -il
�ܼ� 0
1491138 -rw-r�Cr�C 1 root root 48 07-14 14:17 file1
1491139 -rw-r�Cr�C 2 root root 0 07-14 14:17 file2
[[email protected] test]# ln file2 file2hand
[[email protected] test]# ls -il
�ܼ� 0
1491138 -rw-r�Cr�C 1 root root 48 07-14 14:17 file1
1491139 -rw-r�Cr�C 2 root root 0 07-14 14:17 file2
1491139 -rw-r�Cr�C 2 root root 0 07-14 14:17 file2hand
[[email protected] test]#
ע���ڴ�������ǰ,file1 ��ʾ��������ĿΪ1,�������Ӻ�file1��file1hard��������Ŀ����Ϊ2;file1��file1hard��inode����һ����file1��file1hard��ʾ���ļ���СҲ��һ�����ɼ�������ln�����IJ���������file1��file1hard��ͬһ���ļ����������֣����Ǿ���ͬ���������ڵ��ź��ļ����ԣ������ļ�file1��Ӳ���ӣ�����Ϊfile1���ļ������ڵ��ڵ�ǰĿ¼�Ͻ���һ����ָ�롣������ɾ�������κ�һ��,��rm file2 ,ÿ��ֻ��ɾ��һ��ָ��,������ͬʱ��һ,����������Ϊ0ʱ���ں˲Ż����ļ����ݴӴ�����ɾ����
�������ڲ�ͬĿ¼����ͬһ�ļ�ϵͳ�н����ļ���Ӳ���ӡ���file1��file2��Ŀ¼/home/root/dir1�У������������/home/root�н���file2��Ӳ���ӡ�
ln file2 /home/root/file2hard
�����ij������ǽ�dir1Ŀ¼�������ļ�����Ŀ¼dir2�н���Ӳ����
#mkdir dir2
#ln /home/root/dir1/* /home/root/dir2
����ʹ���� ln �Cf existingfile newfile,����newfile�Ѿ����ڣ�������ԭ��newfile��ʲô�ļ���ֻ�õ�ǰ�û�������дȨ�ޣ�newfile�ͳ�Ϊexisitngfile��Ӳ�����ļ���
����Ӳ���ӽ�ʡ�ռ䣬Ҳ��Linuxϵͳ�����ļ�ϵͳ�Ĵ�ͳ��ʽ�����Ǵ���һ�²���֮����
��1���������ڲ�ͬ�ļ�ϵͳ���ļ��佨������
��2��ֻ�г����û��ſ���ΪĿ¼����Ӳ���ӡ�
���������ӣ��������ӣ�
�����ӿ˷���Ӳ���ӵIJ��㣬û���κ��ļ�ϵͳ�����ƣ��κ��û����Դ���ָ��Ŀ¼�ķ������ӡ��������ڸ�Ϊ�㷺ʹ�ã������и����������ԣ��������Կ�Խ��ͬ��������ͬ�������ļ��������ӡ�
���������ӣ�ֻҪ��ln��������ѡ�� �Cs�������ٸ�����
[[email protected] test]# ls -il
�ܼ� 0
1491138 -rw-r�Cr�C 1 root root 48 07-14 14:17 file1
1491139 -rw-r�Cr�C 2 root root 0 07-14 14:17 file2
1491139 -rw-r�Cr�C 2 root root 0 07-14 14:17 file2hand
[[email protected] test]# ln -s file1 file1soft
[[email protected] test]# ls -il
�ܼ� 0
1491138 -rw-r�Cr�C 1 root root 48 07-14 14:17 file1
1491140 lrwxrwxrwx 1 root root 5 07-14 14:24 file1soft -> file1
1491139 -rw-r�Cr�C 2 root root 0 07-14 14:17 file2
1491139 -rw-r�Cr�C 2 root root 0 07-14 14:17 file2hand
���������Ӻ��Ľ������Կ�������������Ӳ���ӣ����������ڸ����ϣ���ʵ����Ҳ�Dz�ͬ�ġ�������Ӳ����ԭ�ļ��������ļ�����һ��inode�ţ�˵��������ͬһ���ļ�����������ԭ�ļ��������ļ�ӵ�в�ͬ��inode�ţ�����������������ͬ���ļ������ļ���������������ȷд�����������ļ�����Ӳ����û��д��������Ϊ�ڱ�����Ӳ�����ļ���ԭ�ļ�����ȫƽ�ȹ�ϵ��������Ŀ�Dz�һ���ģ������ӵ�������Ŀ�������ӣ��ļ���С�Dz�һ���ģ�Ӳ�����ļ���ʾ�Ĵ�С�Ǹ�ԭ�ļ���һ���ģ�����ǿ������Ϊ�ǵ�ͬ�����������������ʾ�Ĵ�С��ԭ�ļ��Ͳ�ͬ�ˣ�file1��С��48B����file1soft��5B����������5ʵ���Ͼ��ǡ�file1���Ĵ�С��
��֮�����������Ӿ��ǽ�����һ�����ļ��������������ļ�ʱ��ϵͳ�ͻᷢ�����Ǹ������ļ�������ȡ�����ļ��ҵ�����Ҫ���ʵ��ļ���
�ڲ�ͬϵͳ֮�佨�������ӡ���Ŀ¼�������ӣ������Ͳ������ˣ����߿����Լ�ȥ���ԣ���Ҳ���ڲ���ʵ����ѧϰ�ġ�
��Ȼ������Ҳ��Ӳ����û�е�ȱ�㣬��Ϊ�����ļ�������ԭ�ļ���·����Ϣ�����Ե�ԭ�ļ���һ��Ŀ¼���Ƶ�����Ŀ¼�У��ٷ��������ļ���ϵͳ���Ҳ����ˡ�������Ӳ���Ӿ�û������ȱ�ݣ�������ô�ƾ���ô�ƣ��Ǻǣ���������Ҫϵͳ���������Ŀռ����ڽ����µ������ڵ��ͱ���ԭ�ļ���·����
����һ�£�����ͨ��symlink���鿴�����ļ��������� man symlink��ѧϰ��
����ɾ������
�д�������ɾ��
[[email protected] test]# ls -il
�ܼ� 0
1491138 -rw-r�Cr�C 1 root root 0 07-14 14:17 file1
1491140 lrwxrwxrwx 1 root root 5 07-14 14:24 file1soft -> file1
1491139 -rw-r�Cr�C 2 root root 0 07-14 14:17 file2
1491139 -rw-r�Cr�C 2 root root 0 07-14 14:17 file2hand
[[email protected] test]# rm -rf file1soft
[[email protected] test]# ls -il
�ܼ� 0
1491138 -rw-r�Cr�C 1 root root 0 07-14 14:17 file1
1491139 -rw-r�Cr�C 2 root root 0 07-14 14:17 file2
1491139 -rw-r�Cr�C 2 root root 0 07-14 14:17 file2hand
[[email protected] test]#
������������������������
linux �����Ӻ�Ӳ���ӵ�����:
������������������������
4�㲻ͬ ��
��1�������ӿ��� ���ļ�ϵͳ ��Ӳ���Ӳ����� ��
ʵ���ķ��������ù����ļ���windows�µ� aa.txt�ı��ĵ����ӵ�linux��/rootĿ¼ �� bb,cc . ln -s aa.txt
/root/bb ���ӳɹ� ��ln aa.txt /root/bb ʧ�� ��
��2������ I�ڵ������� ��Ӳ���Ӳ����ж��ٸ�����ָ������ͬһ��I�ڵ㣬���� �������������� ��ֻҪ���������������� 0���ļ���һֱ���� ��������ɾ������
Դ�ļ����� ���ӵ��ļ� ��ֻҪ��һ������ ���ļ��� ���� ����ʵҲ����ʲô Դ�ļ������ļ��� ����Ϊ����ָ������ͬһ�� I�ڵ㣩�� ������Դ�ļ����������ļ�
�κ�һ����ʱ�� �������� �ļ�������ͬ������ �������Ӳ�ֱ��ʹ��i�ڵ�����Ϊ�ļ�ָ��,����ʹ���ļ�·������Ϊָ�롣���� ɾ�������ļ� ��Դ�ļ���Ӱ�죬��
�� ɾ�� Դ�ļ��������ļ��ͻ��Ҳ���Ҫָ�����ļ� �����������Լ���inode,���ڴ�������һСƬ�ռ�����·����.
��3�������ӿ��Զ�һ�������ڵ��ļ����������� ��
��4�������ӿ��Զ�Ŀ¼�������ӡ�
��ע��I�ڵ� :����UNIX�ڲ����������ļ����Ե����ݽṹ.����ͨ����I�ڵ�Ϊ�ļ���������(��Ϣ����).i�ڵ� ���й����ļ��Ĵֵ���Ҫ�� Ϣ,�����ļ����ݿ���
�����ϵĵ�ַ.ÿһ��I�ڵ������Լ��ı�־��,���dz�Ϊ�ļ�˳����.I�ڵ���������Ϣ 1.�ļ����� 2.�ļ�������ϵ 3.�ļ��ķ���Ȩ�� 4.�ļ���ʱ����.
- ת����ע����Դ��ITѧϰ�� ��ַ��http://www.t086.com/ �����������Ƽ�������
- �ر������� ��վ�������ر�������ֹת�ص�ר�������������¿�������ת�أ���������ע��������ԭʼ���ߡ����°�Ȩ������ԭʼ�������С����ڱ���վת�����µĸ��˺���վ�����DZ�ʾ������л�⡣������վת�ص������а�Ȩ��������ϵ���ǣ����ǻᾡ�����Ը�����
- �������е���ɫ
- �������ж�IP��ַ��A��B���C��
- ������ϵ��Ц�� (ʷ����ȫ��
- ��Google���������ŵ���ͨv4.0
- ���ٶ�ͳ��URL��hm������utm�����Ķ�Ӧ��ϵ
- ��ƻ������MACbook Air���ݼ���ȫ
- ��Linux��ʹ��host��dig��nslookup��ѯDNS
- ���������ԡ���װ Windows XP ����ϵͳ��ͼ��ȫ����
- �����Լ���VPS�Google��������
- ��С�ڴ�VPS֮Nginx+PHP-fpm�߸����Ż���ѹ�����Է���
- ������������������̸�����ɶ��ر�
- ��������������ѡʳƷ����2020�ļ��ȵ�Ͷ�ʲ��Ժ���������
- �����ڵ�����֤50���ƴ�50����ָ֤�������Ĺ���
- ����֤50����Щ��Ʊ_��֤50Ȩ����������
- ������300����֤50����֤500��ָ��2019���ڶ��ζ��ڵ���������
- ������300��ֵ/�ɳ�ָ�����Ʒ����������й�ƽ��Ȩ���½�
- ����ָ֤��������֤50��ָ��������
- ����ָ֤��������֤����ָ��������
- ����ָ֤��������֤100ָ��������
- ����ָ֤����������300ָ��������