Chapter 3
Managing files from the command line
cd
mkdir
rm
To remove empty directory:
To remove files:
ls
Aşağıdakı komandanın nəticəsi kimi ilk hərifn nə olması nəyi bildirir?
Hard link:
1) Əgər fayllar müxtəlif filesystemdədirsə hardlink işləməyəcək
2) Fayl sistemlərə baxmaq üçün df
komandasını icra etmək lazımdır. Məsələn aşağıdakı /
filesystemi ilə /boot
filesystemi fərqlidir çünki sol tərəfdə fərqli filesystem yazılmışdır.
2) Eyni fayldan yaradılmış bütün hard linklər eyni inode number-ə məxsus olur. inode number fayl sistemdə yalnız bir fayla aid ola bilər.
Faylın inode number-inə baxmaq üçün aşağıdakı komandanı icra etmək lazımdır:
Soft link:
Hardlinkdən fərqli olaraq, softlinklər eyni inode numberə aid olmurlar.
Hard Links:
Same Inode Number: A hard link has the same inode number as the original file. It's essentially another name for the same file data on the disk.
Behaves Like the Original File: Any changes made to the hard link are reflected in the original file, and vice versa, because they are the same file at the disk level.
No Link to the Original Filename: Hard links are directly connected to the file data, not to the filename. If you delete or move the original file, the hard link remains valid and continues to access the file data.
Limitations: Hard links cannot span across different file systems and cannot be created for directories (to prevent potential issues like loops).
Soft Links (Symbolic Links):
Different Inode Number: A soft link has a different inode number and is essentially a separate file that points to the original file's name or path.
Behaves Like a Shortcut: It acts like a pointer or a shortcut to the original file. If you edit a file through its symbolic link, you are actually editing the original file, because the symbolic link directs you to it.
Dependent on the Original Filename: Since a soft link points to the filename or path, if the original file is moved or deleted, the soft link becomes a "broken link" and cannot access the file data anymore.
More Flexible: Soft links can point to files on different file systems and can link to directories.
The choice between hard links and soft links usually depends on the specific needs:
Use Hard Links when you want a duplicate reference to the same file data on the same filesystem, which remains valid even if the original file is deleted.
Use Soft Links for more flexible linking, especially across filesystems, or for directory linking, but with the understanding that the link is dependent on the existence and location of the target file.
Command-line expansions
*
Any string of zero or more characters.
?
Any single character.
[abc...]
Any one character in the enclosed class (between the square brackets).
[!abc...]
Any one character not in the enclosed class.
[^abc...]
Any one character not in the enclosed class.
[[:alpha:]]
Any alphabetic character.
[[:lower:]]
Any lowercase character.
[[:upper:]]
Any uppercase character.
[[:alnum:]]
Any alphabetic character or digit.
[[:punct:]]
Any printable character not a space or alphanumeric.
[[:digit:]]
Any single digit from 0 to 9.
[[:space:]]
Any single white space character. This may include tabs, newlines, carriage returns, form feeds, or spaces.
Last updated
Was this helpful?