Command format
Type of command:
1, Internal command Linux system used by the shell to provide.
2, external command installation of third-party software will be.
type command name check command Types | use the output of the front command as the input pipe for the command behind it grep Filtering the data grep grep [options] filename grep --color root/etc/passwdgrep --color ^root/ etc/passwd
For example:
1 ls grep --color conf2lsgrep --color ^conf3ls grep --color conf$
Which command to view the file corresponding to the command
which rpm
RPM-QF/BIN/RPM identifying the specified file is provided by that package
Mount View Mount Information
Optical Device Name/dev/hdc/dev/cdrom
File Type iso9660
Packages for Server service commands
VT Virtualization Package
RPM-IVH package name Ailas A simple command for complex commands, easy to manipulate alias to see the aliases command alias alias =' command action ' in the system Define a command alias Unalias command alias name delete a defined command alias
Tar pack command
Packaging file conventions commonly known as. Tar End Tar [Options] Package file name package files list option -f must have options -v Show unpacking process -C Pack -x unpack -T View package file list -C Specify extract directory --get--Remove--Delete When the backup file name exists, it will be overwritten by the current backup
Use the system date to back up the file name
Date + options
%Y%m%d%F%H%m%Sdate --help
tar -cvf/bak/'date +%f '. Tar *.txttar3. tar *.txt-removetar -cf. tar /etc/passwd /etc/Shadow packaging does not specify the path where the packaged files are stored, and the packaged files are stored in the directory where the package commands are executed.
Wildcard characters at the command line
* match all characters? Any one of the {} matches in any single character [ABC] match range matches any one of the listed
As follows:
ls /etc/???? . conf/etc/capi.conf/etc/krb5.conf/etc/nscd.conf/etc/grub.conf/etc/ldap.conf/etc/ host.conf/etc/touchls *ls ls ~]#
Compression
gzip -9 file name gunzip file name gzip -D file name * The source file will be deleted when compressing and decompressing Compressed file name default. GZ-9 high-ratio compression
BZIP2 file name
bzip2 /all_conf.tar compression bunzip2 /all_conf.tar. bz2 uncompressed * Compression and decompression when the source file is deleted the compressed file name defaults. bz2
Zip
Zip -9 Compressed file name compressed files -o Force overwrite target file -9 High proportional compression unzip// Unzip
Gzip bzip2 Zip
tar+gzip xxxx. Tar . GZ tar+bzip2 xxxx. Tar . bz2 tar -zcvf/bak/etc.tar. gz/etc*/. Conftar-jcvf/bak/etc.tar.bz2/etc/*.conftar- Zxvf/bak/etc.tar.gz-c/baotar-jxvf/bak/etc.tar.bz2-c/bao1
Command review:
Gunzip Unzip Tar gzip bzip2 Zip grep WC *whichmountdate-IVH-QF
VMware Install Virtual Enhancement tools
1 Mount /dev/cdrom/mnt2tar -zxvf vmwaretools-9.2. 2-893683. tar. gz-c/root3 CD/root4 cd vmware-tools-distrib/5 ls 6 ./vmware-install. pl
Practice
Displays the file name in the/etc directory consisting of 2 letters, and the files ending in. conf and counting the number of such files. Copy all files in the/etc directory to the newly created/back directory and package all files under the/back directory with the system date name backup file name to save the backed up files to the system/softtar directory. Conf. Delete all files in the/back directory. Extract the first 2 files in the package file to the current directory delete the last 2 files in the package file package and compress the/etc directory into the/baktar directory to view the size of the compressed file recursively compress all the. txt files in the current directory Baktar directory of the package compressed files extracted to the system's/newtar directory, and to see if the decompression successfully mounted the system installation CD-ROM to the system's/disk directory, and look at the disc in the server directory does not have a name is VSFTPD beginning of the package and statistics such a package there are several.
Use of the Vim file editor
Make changes to a file Vim file name edit file (file already exists) create and open file (when file does not exist)
Vim's working mode
(You can perform the action in the specified mode) 1 2 Input mode edit the contents of the file 3 last row mode Save as import Exit ...
shift+: Switching from normal mode to last-line mode
I i o a a switching input mode from general mode
(The location of the input data is different) O in the line below the cursor input o at the cursor line above the input I at the cursor position in front of input I move the cursor to the beginning of the line, the input of the text before the cursor AA
ESC fallback from input mode to normal mode
General mode:
shift+g moves the cursor to the last line of the file GG moves the cursor to the first line of the file. GG moves the cursor over the specified
Operations in the last-line mode
:w Save: Wq Save and exit: X:wq! forced coexistence and exit: Q exit: Q! do not save exit: Set Nu Display line number: Set Nonu remove line number: Set Nohlsearch remove the search highlighting:! Command not to rewind vim edit execute system command
Save As
1 :w directory/ filename store the file in the specified directory 2 :w file name to the current directory 3 :10 ,w file name
Import
1 : R file name 2 : R directory/ file name 3 : 10r file name
Find
1 / Find the string (case-sensitive)2 position the location on the first matched string and highlight 3n position the cursor on the next matching string 4 N moves the cursor back to the previous matched string
Reference: Vim shortcut keys
Linux Fundamentals 2