Common commands for Linux

Source: Internet
Author: User
Tags echo command readable

Shell command
Command Description:
The pwd command is used to view the current location--expanded in absolute path, starting with root
ls command
View all file directories at the current location
Ls-l displaying files in an exhaustive form
Ls-a Show all content, including hidden files
The Clear command clears the contents of the screen and can be ctrl+l

CD command can change the user's current directory, the command to give the location directory
CD ~ can go back to the user directory
CD/can go back to the root directory
Cd.. Go back to the top level directory
The mkdir command indicates that a new directory is created under the current directory
mkdir Class_c
Day01
Code
Note
Day02
Code
Note
.....

The rmdir command is to delete the directory

The Vi/vim Editor creates a file that, if it is in the same directory, opens directly,
If not, a new file is created.

The echo command can display the contents of the command back on the screen again.
echo Hello World > 1.txt
> called output redirection.
>> can also implement output redirection, which appends new content to the original content.

Cat Commands can be inserted into the contents of a file, displayed on the screen

Linux is not executed according to the extension and is executed according to the information.
Most Linux commands support the option feature.

Read and Write permission issues:
R indicates a read operation-"4", W for write operation-"2",
X indicates execution-"1"-indicates that it cannot be executed-"0"

-RWXRWX---
For [d] is the directory
For [-] is the file
For [l] is indicated as a linked file
for [b] is represented as an interface device available for storage in the device file
for [C] is represented as a serial port device in the device file, such as a keyboard, mouse.

Rights management is divided into three categories:
File/folder Owner
Group to which the file belongs
The others

In the next attribute, three is a group of three parameters that are all "rwx". wherein, [r

] stands for readable, [W] stands for writable, [x] stands for executable, [-] stands for no such attribute.
The combination of rwx can be represented by the and representation of these numbers (bitwise OR)
rwx = 4+2+1 = 7
R-x = 4+0+1 = 5
---= 0+0+0 = 0
Rwxr-x---can be expressed in 750来!


For example: If there is a file with the attribute "-rwxr-xr--", then what does it mean?
The above attribute represents a file, the owner of the file can read and write executable, but the same group

Group of people can only read and execute, non-group users are only readable.

The chmod command can change the permissions of a file or directory.
The chmod command can modify the action properties of a file.

chmod [R] xyz file

Where XYZ is three sets of rwx attribute values and

[Email protected] t1]$ ls-l
DRWXRWXRWX 2 Kelan kelan 4096 22:35 T11
[Email protected] t1]$ chmod 774 T11

The rm/rmdir command can delete a directory that already exists, requiring that the directory must be empty.
The RM command plus option-RF can be used to delete a non-empty directory.
RM-RF F indicates mandatory

The use of Man

can query the function and format of some commands

The CP command can copy files.
The MV Command can cut a file.

gzip compression
Tar zcvf compressed tar zcvf XXX.tar.gz XXX
Tar zxvf Decompression

Hard connections and soft connections
Hard connect: The file corresponds directly to the disk storage location.
Soft connections: Files and source files correspond.
-There is no inevitable connection, one is gone, the other is still there.

The ln command is used to establish a connection file.
Ln-s B.txt C.txt
Delete the source file with Ln-s Soft connection, the new file cannot be used.

The more/page command can gradually display the contents of a file on the screen.
Indicates that the contents of the file are displayed on the screen, showing the start of several lines,
Press ENTER to show down, press Q to exit

The Head command can view the first few lines of the file. takes up less space.
Head-3 means to see the first three rows, plus the number of rows to display.
The Tail command can view the last few lines of the file.

The Find command can be found based on the external characteristics of the file.
The content is not viewed and only the external characteristics of the file are found.
Find-name "XXX"-print
The grep command can be found in an intrinsic file
grep day01 create.sh

The PS command can be used to view the currently running application and view the process
Ps-aux can view all the processes that are running on the Linux system
The kill command terminates a process and forces a process to be terminated kill-9 2452 number indicating the process number

? is a wildcard, he can be used as any one or more other characters.
* is also a wildcard character that can be used as one or more other characters.

The yy command in Vi/vim can copy the contents of the current line
DD command to delete the contents of the current line
The p command can be copied or removed by pasting the command on the line where the cursor is located

Command shutdown

Shutdown-h now immediately shuts down the machine

Shutdown-h 12:00 The system will shut down in 12:00 today.

Shutdown-h +10 system will shut down automatically in 10 minutes.

Shutdown-r now system restarts immediately

Shutdown-r +30 ' The system would open again! ' In 30 minutes the system will reboot and display the following information

Shutdown-k now ' This system would reboot '

Just send a warning message to scare people!

Common commands for Linux

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.