您的位置:首页 > 运维架构 > Linux

一些常用Linux, Unix 命令

2013-07-19 17:07 483 查看
1. Communication between two Linux systems.

SSH (Secure SHell):

SSH’s main job is to provide access to acommand-line over a network.

ssh <username>@<computer name or IPaddress>

ssh joe@laptop

ssh mike@192.168.1.1

scp ~/home/test joe@192.168.118.18:~/home

sftp avoids that massive security risk bytransmitted everything in encrypted form. It is much, much harder to intercept.

When sshd receives a request for connection from aclient, it creates a new process for that particular connection.

sshfs make a remote file system available over SSHact as if it was inside a folder on your own system.

PuTTY is a popular graphical SSH client and itsupports Windows and Linux.

2. Unix Soft (Symbolic) Link and Hard Link

ln [-f] [-n][-s] existingfile newname

-f: Link files without questioning the user,even if the mode of target forbids writing. This is the default if the standardinput is not a terminal.

-n: Does not overwrite existing files.

-s: Make it so that it does not create a symboliclink.

The difference between hard and symbolic link:

Unix filesconsist of two parts: the data part and the file name part.

The file namepart carries a name and an associated inode number.

The data partis associated with something called “inode”.

More than onefile name can reference the same inode number, there files are said to be “hardlinked” together.

“hard link”is also considered as an alias name of the file.

On the other hand, there is a special file type whose data part carries a path to another file. Since it is a special file, the OS recognizes the data as a path, andredirects opens, reads, and writes so that, instead of accessing the datawithin the special
file, they access the data in the file named by the data inthe special file. This special file is called a “soft link” or “symbolic link”.

“ln –s test softln”

“ln test hardln”

1) When create one hard link, the inode count + 1. If file linked is deleted, because the inode count > 0, so the real file can not be restored and the inodecount - 1. The hard link is also useful to access the target file.

2) Because when create a symbolic link, it creates a new inode, so soft links can be used between different systems or partitions.

“test” and “hardln”reference to the content of “test”.

“softln” is linked with the file reference “test”.

When remove “test”,we can also use hardln to access the content of “test”, but softln has error and can not see the content of test again by accessing softln.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: