Linux Basic command Use (i)

Source: Internet
Author: User

1.head-n file to view the first n rows of a file

Tail-n file to view the following n rows of a file

Tail-f files can be viewed in real time, such as the log is updated to display the last few lines in real time

2. ln Source file destination file hard link

Ln-s source file destination file soft Connect

(1) Soft link permissions open, point to the source file, just a symbolic link, equivalent to a shortcut, synchronous update

(2) Hard link size and source files are identical, not copy files, can be updated at the same time, delete the source files, or continue to exist, hard links and the inode of the source file is consistent, cannot cross the partition

(3) Soft link Delete source files can not be accessed, the source file without a shortcut is useless, you can cross the partition

3.

(1) chmod u,g,o +,-, = Rights user, group, other file name

For example, chmod u+x filename adds executable action to the user of this file.

O is others
(2) chmod digital file name

If root creates a 777 file, the normal user cannot delete the

RWX Permissions for files: R-cat,more, head, etc., is the ability to view files

W-echo,vi and so on, just can modify the contents of the file, not to say can delete it

For directories: R-LS,LL, etc., you can view the contents of the catalog

W-rm,touch,mkdir, etc., can be deleted in this directory, create files

Therefore, in a directory to delete files, not require the file has write permission, but require the directory has write permission. 

4.chown Somebody filename Change file owner

(1) Useradd username Add user
passwd Username Set Password

CHGRP adm File1 Change the File1 group to ADM

(2) Umask permission mask value, with 777 to get the default permissions, the first bit is a special permission bit.

Umask-s View default permissions (not available on all systems)

(3) Assuming that umask is 0022, then it is 777-022=755,rwxr-xr-x, but the Linux rule: the default file created by default will then remove the X, then eventually it will be 644, that is, rw-r--r--

But the directory will make 755, because to enter the directory must be executable

To change the mask, the Umask mask value is the mask value, not the default permission value.

Like Umask 0002.

4. Seven Types of files

d  directory file.
L Symbolic Link (pointing to another file, similar to a shortcut under plague).
s socket file.
b -block device file, binary file.
C -character device file.
P Name the pipe file.
- ordinary files, or more accurately, do not belong to the above several types of files

Linux Basic command Use (i)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.