Linux Shell Command Series (2)

Source: Internet
Author: User
Tags touch command

6. History command

The "History" command is a historical record. It shows the history of all commands executed in the terminal.

7. sudo command

The "sudo" (Super User Do) command allows authorized users to execute commands from Superuser or other users. specified by the security policy in the Sudoers list.
[Email protected]:~# sudo add-apt-repository ppa:tualatrix/ppa
Note: sudo allows users to borrow superuser privileges, whereas the "su" command actually allows the user to log on as a superuser. So sudo is more secure than Su.
It is not recommended to use sudo or su for everyday use, as it can cause serious errors if you accidentally do something wrong, which is why the Linux community is popular with a word:
"To err are human, but to really foul up everything, you need root password."
"Err can have no, but the root password is really a hopeless." ”

8. mkdir command

The Make Directory command creates a new directory under the named Path (mkdir). However, if the directory already exists, it will return an error message "Cannot create a folder, the folder already exists" ("Cannot create
folder, folder already exists ")

9. Touch command

The "Touch" command represents the update of the file's access and modification times to the current time. The touch command will only be created when the file does not exist. If the file already exists, it updates the timestamp, but does not change the file's
Content.
[Email protected]:~# Touch Tecmintfile
Note: Touch can be used to create a nonexistent file in a directory where the user has write permissions.


chmod command

The "chmod" command is to change the file's mode bit. chmod will change the file mode (permissions) of each given file, folder, script, etc. according to the required mode.
There are 3 types of permissions in the file (folder or other, for simplicity, we use the file)
Read (R) =4
Write (W) =2
Execute (x) =1
So if you want to give the file read-only permission, set to ' 4 '; write-only permission, set the permission to ' 2 '; Execute permission only, set to 1; Read and Write permissions, that is 4+2 = 6, and so on.
Now you need to set up 3 user and user group permissions. The first one is the owner, then the user's group, and finally the other user.

Rwxr-x--x abc.sh
The root privilege here is rwx (read and write and Execute permissions),
The owning user group permission is r-x (only read and execute permissions, no write permission),
For other user rights is-X (only Execute permissions)
In order to change its permissions, the owner, the user group and other users to provide read, write, execute permissions.

[Email protected]:~# chmod 777 abc.sh
Three are only read and write access

[Email protected]:~# chmod 666 abc.sh
The owner user has read-write and Execute permissions, and the user's group and other users have only executable permissions

[Email protected]:~# chmod 711 abc.sh
Note: This command is one of the most useful commands for system administrators and users. In a multiuser environment or server, for a user, if the file is not accessible, then this command can be resolved, if the set
The wrong permissions, it also provides access for authorization.

Linux Shell Command Series (2)

Related Article

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.