Linux most commonly used command combat

Source: Internet
Author: User

1. Change the name of the machine:

Vim/etc/hostname

Master

Modify the machine name in the file for the name we want (equivalent to the domain name)

Can be closed by shutdown-h now

2. View current machine IP:

Ifconfig

3.vim/etc/hosts

127.0.0.1 localhost

establish the mapping between the IP and the domain name , access to the domain name directly, if you want to access the remote machine, you must configure the remote machine's domain name and IP address mapping in the current machine/etc/hosts file , So when we access the remote domain name, we will resolve the/etc/hosts to locate the remote machine's IP address, thus accessing the remote machine.

4.vim cat gedit Viewing files

The file needs a page view, you can use the more command, press ENTER to page

Tail viewing the final contents of a file

5. Create a file Touch spark.txt

6.mkdir a Create a level directory, Mkdir-p a/b/c create a multilevel directory at once

7.rmdir Delete directory, RM-RF Force delete all contents in current file (clip)

8.TAR-CZVF xxx.gz a.txt Compressed file tar-zxvf xxx.gz

9.man < operation name > can be viewed using

10. File Permissions

The 1th column: "-" represents the file; "D" represents the directory; "L" Shortcut

2nd to 4th Column: Represents the current user's specific operation permissions for the file

1) Readable R 2^2=4

2) Writable W 2^1=2

3) executable x 2^0=1

5th to 7th column: Represents the user group of the current user for the file (folder) operation permissions

Column 8th to 10th: Action permissions on the file (folder) on behalf of users other than the current user group

11th column: Number of connections representing the current file

12th column: The user owner who represents the current file

13th column: Represents the user group where the current user resides

14th column: Representing file size

15th column: Represents the time the file was created or modified

11. User and user groups to modify files

Create User: Useradd Work1

Owner of the settings file: Chown work1 a.txt

Change the user group to which the current file belongs: Chgrp work A.txt

12. Modify File Permissions

chmod 764 a.txt Results:-rwxrw-r--

chmod 744 a.txt Results:-rwxr--r--

13.SHH Remote login without password

sudo apt-get install SSH download installation SSH service;

sudo apt-get install rsync installation automatic synchronization service;

Linux most commonly used command combat

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.