Basic Linux commands (Continuous updates)

Source: Internet
Author: User

Init 0 --- Shutdown

Init 1 --- logout

Note: Both commands can be run only with the root permission.

Common users get root permissions:

Su

Enter the root password.

PWD --- display path

Copy the file and delete the source file:

MV [source file path and file name] [target file and file name]

The absolute path is expressed by/XXX/xxx. X, And/is required. The relative path is based on the current directory. Where... indicates to roll back to the upper-level directory .. Indicates

Current directory. It can be ../XXX/xxx. X or./XXX/xxx. X.

1.Zip

Linux comes with an unZipProgram can be decompressedFile, The decompression command is:

Unzip filename.zip

A zip program is also provided to compress the zip code.File, Command is

Zip filename.zip files

The file will be compressed to filename.zip.

2.RAR

BecauseRARIt is a paid software, so Linux does not come with this software for pressurization and decompression. You canRARUnder the official website http://www.rarsoft.com

Download the trial version.

After installation, available commands

Unrar e filename.rar decompress the file

RAR a files filename will compress filesinto filename.rar. Note that RAR will automatically add the suffix. rar to your file.

 

File/directory permission setting command: chmod

It is used to change the access permissions of files or directories. This command has two usage methods:

1. Use a text setting method that contains letters and operator expressions

Syntax format: chmod [who] [opt] [mode] File Name/directory name

Which indicates the object, which is one or a combination of the following letters:
U: indicates the file owner.
G: indicates the same group of users.
O: other users
A: indicates all users.

Opt indicates the operation, which can be:
+: Add a permission.
-: Cancel a permission.
=: Grant the given permissions and cancel the original permissions.

Mode indicates the permission:
R: readable
W: writable
X: executable

For example, to add the read and write permissions for file a.txt to users in the same group:

Chmod g + RW a.txt

Ii. digit setting

The number setting rule is simpler: chmod [mode] File Name

The key is the mode value. Many beginners will be confused at the beginning. In fact, it is very simple. We regard rwx as a binary number. If there is one, it indicates that there is no

If the value is 0, rwx R-x r--can be expressed:

111 101 100

Convert each three digits into a decimal number, that is, 754.

For example, we want to grant the permission for the.txt file:

Other users in the same group
Readable is yes
Writable is executable

Then, we first obtain the permission string RW-r -- Based on the table above, and convert it to the binary number 110 110 100, and then convert each three digits into a decimal number,

We get 664, So we run the following command:

Chmod 664 a.txt

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.