首页 > 代码库 > Unix command 积累

Unix command 积累

1,basename, 当向basename传递一个路径名时,它会删除任何前缀,直到最后一个斜线(‘/‘)字符,然后返回结果。

$ basename /home/jsmith/base.wiki base.wiki

2,
symbolic link
就是一个已有文件的别名
In computing, a symbolic link (also symlink or soft link) is a special type of file that contains a reference to another file or directory in the form of an absolute or relative path. Programs that read or write to files named by a symbolic link will behave as if operating directly on the target file.
ln -s target_path link_path
3, Hard links always refer to an existing file.
A file in the file system is basically a link to an inode.
A hard link then just creates another file with a link to the same underlying inode.
deleting renaming or moving the original file will not affect the hard link as it links to the underlying inode. Any changes to the data on the inode is reflected in all files that refer to that inode.

$ ln /tmp/file link-here