Linux No. 02 Day

Source: Internet
Author: User
Tags array definition

Linux No. 02 Day 1. Linux disk and file system VFS ———— virtual file System DF Command ———— View mounted partition DF Partition name du command ———— view folder size du folder name ln command ———— Symbolic link fdisk command ———— partition command fdisk Hard disk name partprobe command ———— update partition table Partprobe hard disk name MKFS command ———— format partition (the new partition can only be used after formatting) mkfs-t file system type (ext3, EXT4) partition name MKFS. File system Type (EXT3,  EXT4) partition name (equivalent to the above) fsck/badblocks command ———— disk check BADBLOCKS-SV partition name mount command ———— Mount device (temporary, invalid after shutdown restart) Mount external device directory Mount the external device in the directory umount command ———— uninstall device Umount mount point umount External device fstab file ———— mount file (valid for restart shutdown) configuration Information Format: Device name mount point format type default permissions backup identity inspection ID 2. File compression and Packaging 2 .1 commonly used compression commands compress command gzip/zcat command gzip file name (will directly compress the original file into. gz suffix files, source files are not) gzip-c file name > File name. GZ (files that will directly compress the original file into a. gz suffix, the source file also exists) gzip-d file name (the source file will be extracted directly, the source file is not) Zcat file name (view compressed file contents, plain text) Bzip2/bzcat command (using the same way   Note suffix bz2) 2.2 Common Packaging Command tar command (no compression) tar CVF file name. tar file name (package file, keep source file) tar cvf file name. tar file name--remove-files (package file, do not keep source file) tar TVF File (to view the contents of the file under the package) Tar xvf file (unpack the contents of the file) 2.3 Common backup commands ———— full backup (0) ———— differential backup (level from high to low) ———— incremental backup (level from low to high) dump command ———— Backup dump level (0~9) backup File names need to back up files 2.4 Common restore command the RESTORE command ———— Recovery 3.vim Program Editor VIM is the enhanced version of VI 1. Insert mode: 1.I the current cursor after a character 2. I start 3.a After the current cursor after one character 4. A line at the end of the bank 5.O the bank after A blank line 6. OLine 7.insert current cursor 2. Command mode: 1.esc2.yy ———— copy row 3.p ———— paste row 4.dd ———— Delete current line 5.x ———— Delete current character 6.r ———— replace current character 3. Last-line mode: 1. Colon: (save W, exit Q , replace S, locate (directly enter a number to jump to that number line)) 2. Slash/(Find) 3.next toggle next file 4.first First file 5.last last file 4. Special symbol: 1.^ means the beginning of the line 2.$ means the tail 3.% Represents all Rows 4. Recognize and learn bash1. View the system-supported shellcat/etc/shells (Linux default bash) 2.which command ———— View the command name of the directory which the commands (if the directory is not found and the command is available, Indicates that the command is a bash built-in command) The 3.type command ———— View the command's information type command name 4. Variable 1. Variable assignment: variable name = value 2. Variable use: $ variable name (must have dollar sign) 3. Variable Cancellation: unset Variable name 4. A local variable (valid only in the current session) defines the variable name = variable value 5. Environment variables (valid for all sessions) define the export variable name = variable value 6. Position variable (variable at specified position) $ (the first variable) $ (the second variable) $# (a total of several variables) $* (variables are ... ) 7. Variable View SET command (view all variables as local and environment variables) the ENV/EXPORT/EXPORT-P command (display environment variable) The 8.read command ———— assign the value of the keyboard input to the variable (with the carriage return as the end identifier) read variable name 9. Array definition xx= (AA bb cc) output echo ${xx[*]} All output echo ${xx[0]} output first element echo ${#xx [*]} output array element echo ${!xx[*]} Output all elements subscript 10.declare command ———— definition variable Volume Declare-x aa=1 (environment variable) declare +x aa=1 (not environment variable) declare-r AA (AA value cannot be changed, that is, constant) 11. wildcard character 1.  [] matches a character 2.-represents a range A-Z-A to Z3.? Represents any one character 4.! or ^ means that non-[^0-9], or non-numeric 5.*, represents any one or more characters 5. Output redirection 1.> command ———— output the console output to a file (if the file does not exist, create the file, overwrite if present) Cal >Name (only correct results) Cal 2> file name (only incorrect results are redirected) 2.>> command ———— Output the console output to a file (if the file does not exist, create the file if it exists, append) Cal >> file name (only correct results can be redirected) Cal 2>> file name (only incorrect results can be redirected) the 3.&> command ———— output the console output to a file (either correctly or incorrectly redirected, overwriting the file) 6. Command special symbol 1.: Command 1: Command 2 (i.e. After you finish command 1, execute command 2, whether or not command 1 is correct, 2.&& command 1&& command 2 (if command 1 is incorrect, command 2 is not executed) 3.| | Command 1| | Command 2 (if command 1 is correct, do not execute command 2) 7. Results of Pipeline Command 1 pass the pipeline to command 2 to make parameters such as command 1 | Command 21. Select the command cut ———— separate the contents of the file for regular files such as: cut-d:-f1 file name (that is, by: To select the 1th part of the file content) grep ———— Select the file content, applicable to irregular but know the keyword file such as: Ifconfig eth1 | grep "Mask" (that is, press the Mask keyword to show the line) 2. Sort the command sort ———— output the results such as: GREP-IVN "abc" File name | Sort-r (reverse output) WC ———— word count such as: WC file name (return line number, number of words, number of characters (both spaces and newline characters)) Uniq ———— result statistics such as: Uniq file name-C (return result and result count) 3. Bidirectional redirection Command Tee ———— Output the results to a file such as: Ifconfig eth1 | Tee file name |grep "Mask" 4. Character conversion command TR ———— conversion word such as: tr ' A-Z ' A-Z ' < file name Col ———— convert character (tab to space) such as: Col-x file name join ———— match merge file (matching file 1 and the file 2 keyword merge, with the delimiter to identify the keyword) such as: Join-t ': ' File 1 file 2paste ———— paste merge files (paste merge directly) such as: Paste file 1 file 2expand ———— (functionally consistent with Col) such as: Expand File name 5. Cutting Life Make split ———— cut large files into small files such as: Split-b 10k Large File Small file (small file size10k) 6. Parameter substitution xargs ———— provides parameter support for commands that do not support pipelines such as: Find-name "xxx*" |xargs ls-h5.shellscript script 1. The opening format #!/bin/bash2. Comment lines use #3. Execute script 1.source script file name 2.bash script file name 3. ./script file name 4. return value 1. Execution returned 02. Execution error returned not 05. Determine Branch 1.if ...; Then...elif ...;  Then...else....fi2.case...esac3.function6. Loop Branch 1.while/until ... done2.for...do...done

  

Linux No. 02 Day

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.