One Linux command per day

Source: Internet
Author: User
Tags call shell create directory

2014-08-19

REDIRECT Symbol  greater than sign: a command execution result (standard output, or error output, which would otherwise have been printed to the screen) instance of redirecting other output devices (files, open file operators, or printers, etc.)  :   1.ls > B.txt Writes the result after LS to the B.txt file (if it exists to overwrite the contents of the B.txt)   2.ls >> b.txt The result after LS is not overwritten with the end of the write B.txt file (new if no b.txt)   3.mysqldump-u Root-p Test > 20101216_test.sql pour out data  less than: command default input from keyboard, change from file, or other open file and device input   instance:   1.mysql-u root-p-H Test < 20101216_test.sql Import data

2014-08-18

Pipeline: The pipe symbol provided by Linux "|" Separate the two commands from the left command execution result through the pipeline to the command on the right to execute the instance: Ls-al|grep java This command means that you first perform ls-al to list all current files or directories, and then pass the pipeline "|" to the GREP query whether a directory or file containing Java is commonly used : 1. PS aux|grep Java 2. tail-100f Log.txt|grep Log

2014-08-17

Locate: Quick Find files (find filenames quickly) locate faster than find, it is not really looking, but rather check database, general file database in/var/lib/slocate/ Slocate.db, so the locate lookup is not real-time, but the database update is the most common parameters: 1.-e   will be excluded from the scope of the search.   -1  if it is 1. The security mode is started. In safe mode, the user does not see files that the permissions cannot see.        this slows down because the locate must get access to the file in the actual file system. -   f   excludes specific file systems, for example, we have no reason to put the files in the proc file system in the database.  -Q Quiet mode, no error message is displayed.   -N displays at most x outputs. -   R uses the normal arithmetic to do the searching condition.   -o Specifies the name of the data inventory.   -d Specifies the path of the repository-   h displays the secondary message   -V display version message instance: 1.locate pwd Find all the files associated with PWD 2.locate/etc/sh   Search all files in the ETC directory that begin with SH 3.locate-r/etc/sh$  Search all files in the ETC directory that end with SH

2014-08-16

Less: Tool for paging the file or other output (opposite of more)-   b < buffer size > Set buffer size-  e When the  file display ends, automatically leaves the-  f  Force open special files such as peripheral code, directory and binary file-  g  only flag last search keyword-i  ignore search case-  m  Show as percentage of more command-  n  Displays the line number of each row-  o < file name > save less output in the specified file-  q  does not use warning tone-  s to  display continuous empty behavior line-  s  The line too long will be out of the partial discard  -x < number > the "tab" key is displayed as the specified number of spaces  /strings: Search Down "string" function  ? string: Search Up "string" function  N: Repeat previous search (with Or? About)  N: Reverse Duplicate previous search (with/or? related)  B  Turn back one page  D turn back  half page  h  Display Help interface  Q exit less  command  U Roll  forward half page  y  forward scroll one line  space key scroll  a line return scroll  [PageDown]: Flip one page  [pageup]:   Flip one page up

2014-08-15

 for CRT Viewing) command parameters:   +n      from joys n lines       to define a screen size of n rows   +/pattern search for the string before each file is displayed, Then from the first two lines of the string start to show the-   C from the top of the       screen, and then show the-   D       continue, ' Q ' To quit (press the SPACEBAR to continue, press the Q key to exit), disable the ring function-   l        Ignore Ctrl+l (page break) character-   p to       change a page by clearing the window instead of scrolling, similar to-C option   -S to       display consecutive empty lines as one line-   u       Remove the line from the contents of the file by   4. Common Operations Command:   Enter    down n lines, need to be defined. The default is 1 lines   ctrl+f scroll   down one screen scroll  down one screen   ctrl+b return to  previous screen   =       Output The line number of the current line   : F     The output file name and the line number of the current line   V      call VI editor   ! Command   call Shell and execute command   q       exit more

2014-08-14

Which  view the location of the executable file (locate a program file in the user's path) the which instruction searches the location of a system command in the path specified by the path variable, and returns the first search result. Example: which Java

2014-08-13

NL will output the contents of the file automatically add line numbers (number lines of files)-    B A: Indicates whether blank lines, also list line numbers (similar to cat-n);-    B T: If there is a blank line, do not list the line number (default value) for the empty row;    -N-Ln: The line number is displayed on the left of the screen;    -n RN: The line number is displayed on the very right of its own field, without adding 0;    -n RZ: The line number is displayed on the right-most side of its field, plus 0;  -W: the number of digits occupied by the line number field. Example: 1. Nl-b a file1 output and travel number 2. Nl-b a-n rz file1  List line number parallel number plus 0 3. Nl-b a-n rz-w 3 file1 Keep line numbers listed 3 digits

2014-08-12

Tail: The command writes the file to standard output (display the last part of a file) from the specified point:-F Loop read-n< lines > Display number of rows-S,--sleep-interval=s and-F are used to represent each Repeated intervals of sleep S-second instance 1.tail-n file1 display 10 lines at the end of the content 2.tail-100f file1 dynamic display at the end of the 100 lines of content 3.tail-100f file1|grep java dynamic display at the end of 100 lines containing JAV Content of a

2014-08-11

Cat: Connection file or standard input and print  (concatenate files and print on the normal output) Common parameters:  -A,--show-all           equivalent to-vet-  B, --number-nonblank    to non-null output line number-  e                       equivalent to-ve-  E,--show-ends          shows $-N at the end of each line  ,--number     For all line numbers of the output, the number of rows starting at 1 for all outputs is number-  s,--squeeze-blank  has two consecutive lines above the blank line, the substitution is a line of blank lines-  t                       and-VT equivalent  -T,-- Show-tabs          the tab character as ^i-  V,--show-nonprinting   uses ^ and M-references, except LFD and TAB instances 1. cat file Displays the entire file contents 2. cat fi Le1 file2 >file Merge files to file 3. TAC file Displays the contents of the file upside down

2014-08-10

CP: Copy (copy files) 1. CP file1 file2 Copies the file file1 to file File2 2. Cp-i file1 file2 Copy the file file1 to file File2 ask if you want to copy 3. Cp-f file1 file2 The file file1 is forced to replicate to File2 4. The CP dir1 DIR2 copies the catalog Dir1 into Dir2 5. CP file1 file2 file3 dir copies multiple files to the Dir directory

2014-08-09

  MV: Move file (move files)  1. MV file1 file2 renamed the file File1 to File2  2. The mv file dir  moves file files to dir  3. mv-i file1 File 2 Rename the file file1 to File2, and if file2 already exists, ask whether to overwrite  4. mv-f file1 file2 renamed file File1 to File2, even if file2 exists, is directly covered by  5. MV Dir1 DIR2 If the directory Dir2 does not exist, rename the directory Dir1 to Dir2; otherwise, move Dir1 to Dir2  6. MV file1 file2 file3 dir1 move multiple files to the Dir1 directory

2014-08-08

RM: Remove (remove directory entries)-  F,--force           Force Delete. Ignore non-existent files, do not prompt to confirm-I                    need to confirm-R before deleting,-  R,--recursive   recursively delete the directory and its contents-  V,--verbose         detailed display of the steps ( Careful use RM, afraid of the wrong delete can customize the Recycle Bin function) Custom Recycle step: 1.  "[email protected]" "moved to $D OK"; } 2.  Alias rm= ' Myrm '

2014-08-07

mkdir: Create directory (make directories)  1)  mkdir-m 777 test-  m,--mode= mode, set permissions < mode > (similar to chmod)  2) MKDIR-VP s rc/{lib/,java/}  -P,--parents  can create a multilevel directory  -V,--verbose  displays information each time a new directory is created

2014-08-06

Every day a linux command pwd: Output the current directory (Print the name of the working directory) Pwd-p  show the actual path Pwd-l directory connection link, the Output connection path (pwd default is PWD-L) $PWD The variables in the current directory, you can use echo $PWD output, and the result is the same as the PWD $OLDPWD the previous directory variable

2014-08-05

CD [directory name]: Toggles the current directory into dirname (change the present directory to DIR) Common command combination 1. CD/Enter the system root directory 2. Cd.. Return to the previous level of directory 3. CD ~ or CD   Current user home directory (Note: "Current user home Directory" and "system root" are two different concepts) 4. CD-  Returns the directory where you entered this directory 5. CD!$  execute linux CD  !$ Take the last parameter of the last command as input

2014-08-04

 ls: Lists all subdirectories and files in the target directory (list directory contents) common combination parameter 1) ls-al-a,–all all files listed in the directory, including the. The beginning of the implied file-l lists the file's permissions, owner, file size, and other information in detail to 2) LS u* u* Star is a regular expression match. A file or directory with the beginning of the U 3) ls-f lists all the files and directories under the current working directory; directory after name plus  "/" , executable file after name plus  "*"  

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.