Linux Basic Operations Command

Source: Internet
Author: User
Tags readable disk usage

First, LS

ls most commonly used parameters are three:-a-l-F

1,ls-a

Files on Linux are treated as hidden files by the system, and only the LS command is not visible to them, and the hidden file is displayed with Ls-a in addition to the generic file name.

2, Ls-l (this parameter is the letter L of Lowercase)
This command can be used to display the contents of the file in a long format, you can view more detailed file information

Number of file properties files The group file size file name to which the owner belongs

drwx------2 li li 1024x768 21:05 Mail

Explain:

Linux files are basically divided into three properties: readable (R), writable (W), executable (x). But here are 10 squares to add (when the actual program is implemented, it is actually 10 bit bits).

The first small is a special representation, indicating a directory or a link file, and so on, d for the directory, l for the link file, if it is represented by a horizontal "-", then this is the file.

The rest of the grid is one unit per 3 squares. Because Linux is a multi-user multitasking system, so a file may be used by many people at the same time, so we have to set the permissions of each file, its file permissions are arranged in the order of the location (in-rwxr-xr-x for example):

rwx (Owner) r-x (Group) r-x (Other)
This example indicates that the user is readable, writable and executable, the same group of users can be read, not writable, executable, other users can read, not write, can be executed.

In addition, some of the execution of the program properties is not X, but s, which means that the user who executes the program may temporarily have the same power as the owner to execute the program. Generally appear in the system management such as instructions or programs, let the user execute, with root identity.

3, Ls-f (F in uppercase)

Use this parameter to indicate that a symbol representing the file type is added after the file,

For example, * indicates an executable,/represents a directory, @ represents a Nexus file.

Second, CD command

If you enter the CD directly, nothing is added back to the user's own home Directory.

This function is the same as CD ~.

Third, mkdir,rmdir Command

The mkdir command is used to create a new directory, rmdir used to delete the directory that was created.

Iv. CP Command

This command is equivalent to the Copy command under DOS, with the following specific usage:

Cp-r source file Destination file (target)
Parameter r is a copy of a subdirectory in a homologous file

v. RM Command
This command is used to delete a file, the RM command commonly used parameters are three:-i,-r,-f.

1, for example, I now want to delete a file named text: Rm-i test
The system will ask us: "Rm:remove ' Test '?" Y ", after hitting the carriage return, this file will really be deleted.

The reason to do this is because Linux does not have the undelete command like DOS, or can be used pctool and other tools to save deleted files back, Linux deleted files are not saved back, so use this parameter before the deletion to let you determine again, is very necessary.

2. Rm-r Directory Name
This operation can be deleted with the subdirectories below this directory, functionally and rmdir similar.

3. rm-f file name (directory name)

This action can be forced to delete.

VI. MV Command
The function of this command is to move the directory or file, and the extended function is to rename the directory or file.

When you use this command to move a directory, he will also remove it along with subdirectories under that directory.

Also, because there are no rename commands under Linux, you can use the following methods if you want to rename a file or directory:

MV Original file (directory) new file (directory)

vii. Order of DU,DF
The du command can display the disk space occupied by the current directory, and the DF command can display the disk space remaining on the current disk.
If the du command does not add any parameters, then the entire disk is returned to use, if the directory is added later, it is the directory on disk usage (this function is not a Dos).

But I generally do not like to use Du, because it gives the information is too much, I do not see, and DF This command I am the most commonly used, because the amount of space left on the disk for me is very important.

DF Desktop

Eight, Cat command

This command is a very important command in Linux, and its function is to display or connect to a generic ASCII text file.

Cat is a shorthand for concatenate, similar to the Type command under DOS. Its usage is as follows:

Cat Text

Show text This file

Cat file1 file2

Display the contents of the File1,file2 sequentially

Cat File1 File2>file3

Combine the contents of the File1,file2 and redirect (>) to the File3 file.

One thing to note here is that File3 is a file that has not existed before redirection, such as File3 is an already existing file, then its own content is overwritten and becomes file1+file2 content.

If there is no name for the file on the left and a filename on the right, for example:

Also, if you use the following instructions:

Cat File1>>file2

This will become the File1 file content "append" to the File2 file, and file2 content is still there, this redirection 〉〉 than the common, can be used more.

ix. Order of More,less

Here are two instructions for displaying a generic text file.
If a text file is too long for more than one screen, it is not ideal to use cat, so you can try more and less two instructions.

The more instruction can make more than one page of the file temporarily stay on the screen, wait until you press any of the keys before continuing to display.

and less in addition to more features, you can also use the arrow keys to go up or under the Web scrolling file, so you feel free to browse, read the article, less is a very good choice.

Ten, clear command
This command is used to clear the screen
Xi. pwd Command
The function of this command is to display the user's current working path, this command does not need to say more, everyone is known.

Twelve. ln command

13. Man command

Man is a help to look at instruction usage, and the most important thing to learn about any Unix-like operating system is to learn to use man as a secondary command.

MAN is the acronym for Manual ( manual ) , and Its description is very detailed.

Linux Basic Operations Command

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.