<linux command, editor and Shell Programming > Commands Section reading notes

Source: Internet
Author: User
Tags pear

Ctrl+u can delete rows under the shell, if this key doesn't work, try Ctrl+x

CTRL + Z You can suspend a program without terminating the program, but you can suspend the program.

This job can then be switched to the foreground by the FG command

CP command target file if it is an existing file, then this command will overwrite the original file, so it is best to alias the CP command: Alias cp= "Cp-i", the MV command is the same

The-f option of LS causes a slash behind the directory, and an asterisk appears after the executable file

MkDir's-P selection can also be created with a command directory

The CD command without any parameters will set the user's home directory as the working directory

To delete a directory that contains other files, you need to first delete the file by using RM, and then delete the directory

The MV command can move multiple files to the same directory at the same time, and the last parameter is the target directory

MV Names.txt Temp.exe NewDirectory

It is always possible to put executable files on the file name before another./To execute the executable file under the working directory

Cat > Sample.txt

After entering this command, you can enter text into the file sample.txt in the terminal, this action is called redirection

If the file already exists before the redirect command executes, the shell will rewrite it and destroy its original content.

Use cat and redirect output symbols to connect multiple files to a larger file (cat catenate abbreviation)

Cat 1.txt 3.txt > Combie.txt

The shell provides a noclobber feature that prevents a redirect from overwriting a file that already exists. Under Bash, you can enable this feature by setting the variable noclobber with the command Set-o Noclobber. The command uses +o to disable this feature, and under TCH, use the set Noclobber and unset noclobber commands to enable and disable this feature.

Use the combo symbol ">|" You can override the settings of Noclobber,

$ cat Orange Pear > Orange

Cat:orange:input file is output file

Although Cat reported an error, the shell destroyed the contents of an existing orange file before giving the error. After executing the command, the Orange file is the same as the contents of the pear file. This is because when the shell encounters the redirect symbol (>), the first action it takes is to delete the contents of the original orange file. To implement this function, you can use the following method:

Cat Orange Pear > Temp

MV Temp Orange

Use the Append output symbol >> to add new information to the end of a file without changing the existing information.

You can redirect data that you do not want to see or do not want to save to/dev/null so that the output data disappears virtually

The following cat command empties the contents of the file messages, but retains the owner and permissions of the file

Cat/dev/null > Message

The Tee utility copies standard input to files and standard output. The utility is named tee because: it has only one input, but implements bidirectional output. In the example below, who's output passes through the pipe to the standard input of tee, and the tee utility copies the standard input to the file Who.out and also to the standard output. The standard output of the tee goes through the pipe to the standard input of grep, which displays the row containing the string Sam.

$ who | Tee Who.out | grep root

Job programming and PID number, if you enter the symbol & after the command line and press ENTER, then the shell will run the job in the background.

Directory of Linux

/etc Local computer system configuration file

/etc/opt contains the configuration file for the plug-in software in the/OPT directory

/opt Optional plug-in package

/var variable data

Permissions

Use a for all users, O for other users, G for group users, and U for the owner of the file (although not necessarily the owner of the file)

The first number specifies the permissions of the file owner, the second number specifies the permissions of the group user, and the third number specifies the permissions of the other user

Link

Hard Links

A hard link to a file appears in the file structure in the form of another file. If a file and its link appear in the same directory, the file must be different from the name of the link, because the file in the same directory cannot have a name. You can only create a hard link to the file in the file system that contains the file.

Utility LN Without the-s or--symbolic option to create a hard link for an existing file

<linux command, editor and Shell Programming > Commands Section reading notes

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.