Typical use of common linux Commands

Source: Internet
Author: User
Typical linux commands: 1. sagane @ sagane-ThinkPad-Edge :~ $ Mii-tool: when the network is disconnected, use this command to check whether the physical link is normal. 2. ssagane @ sagane-ThinkPad-Edge :~ $ Sshroot@192.168.1.43, with the root user login IP address as 19 .. linux commonly used commands Classic use 1, sagane @ sagane-ThinkPad-Edge :~ $ Mii-tool: when the network is disconnected, use this command to check whether the physical link is normal. 2. ssagane @ sagane-ThinkPad-Edge :~ $ Ssh root@192.168.1.43, with the root user login IP address 192.168.1.43 machine, enter the root user password, remote control of this machine, or even install xshell and other software in windows, simulate remote server control in linux. 3. sagane @ sagane-ThinkPad-Edge :~ $ Scp-r root@192.168.1.2:/home/sagane./, copy the contents in the sagane folder to the current directory on a machine with the root user logon IP address 192.168.1.2. 4. root @ sagane-ThinkPad-Edge:/home/sagane/advio # tailf/var/log/boot. log, which displays changes in the content of boot. log in real time. 5. Using the updatedb and locate commands to find files is the fastest way to search. These two commands must be used in combination. 6. find. -type d: Search for the directory file "user sagane" in the current directory, find the file "-name"-mmin-10 "with the username" sagane ", and search for files changed within 10 minutes, + 10 search for a file changed 10 minutes ago-mtime-10, and search for a file wildcard changed 10 days ago *: multiple character wildcards?: Stands for 1 Character 7. it uses the wheel in the middle of the mouse to cleverly paste the post. this is also one of the reasons why I like to use a desktop terminal. 8. sagane @ sagane-ThinkPad-Edge :~ $ Less examples. desktop: use the less command to display the file content under the terminal. 9. sagane @ sagane-ThinkPad-Edge :~ $ Df-h to view hard disk usage. 10. root @ sagane-ThinkPad-Edge:/home # du-sh sagane/to view the size of the sagane folder. 11. vim command: shift + n: search up, n: search down;: 1, $ s/a/B/gc: Replace a with B in the file, after adding g, all the places in the file will be replaced. without adding g, only the places in the first line will be replaced. adding c indicates interactive Replacement. d: cut the selected part, dd cut a row, y copy the selected part, yy copy a row p: paste it on the cursor, P: paste the following lines at the cursor and display 12. root @ sagane-ThinkPad-Edge:/home/sagane # find. -name "test. c "-exec ls-lh {}\; do not omit the last semicolon when entering the above Command. run the test. put the c file in braces and run it again. 13. root @ sagane-ThinkPad-Edge:/home/sagane # grep-r ai test. c. search for the character ai in the test. c file. Grep-E "^ root"/etc/passwd in the passwd file, search for the root character grep-E "bash $"/etc/passwd at the beginning of each line search for the bash character grep-E "r .. t "/etc/passwd. 1 Character grep-E "r. * t "/etc/passwd. * represents any character, same as * grep-E "root | sagane"/etc/passwd search root or sagane string grep-E "roo [a-z, A-Z, 0-9] "/etc/passwd locking a character range grep-E" roo [^ a-z, A-Z, 0-9] "/etc/passwd ^ Is the content except some strings grep-E-v root/etc/passwd except root 14,> redirection> append redirection 2> error redirection 2> error append redirection 15, root @ Sagane-ThinkPad-Edge:/home/sagane/advio # grep-v main race. c | grep ai from race. search for content other than main in the c file and output the output result to the subsequent command to check whether there are any ai characters. 16. tty command to view the current terminal 17. compressed file command: gzip file gunzip file bzip2 file bunzip2 file operation on the directory: tar cvf *. tar test package the test directory into the xvf decompression package tar tvf *. tar: the content of the compressed file. tar rvf *. tar test append the directory test *. tar xvf *. tar-C test will *. decompress tar to the test directory tar zcvf * .tar.gz test and compress the test file into the * .tar.gz file tar jcvf * .tar.gz test. compress tar zxvf * .tar.gz for 18. you can add parameters when starting vim. For example, gvim-p This is enabled in the tag. : H startup-options can be enabled first Again: tabe In this way, the tag is opened. If you want to split and open it, run the command: sp Or vsp (Vertical split) open multiple files: 1. when vim is not started: enter vim file1 file2 in the terminal... filen can open all the files you want to open 2. vim has enabled input: open file can open another file, and the file content is displayed in vim. Multiple files are displayed at the same time: split: vsplit switch between files: 1. switch between files Ctrl + 6-next File: bn-next File: bp-previous file for files opened in multiple panes with (v) split, this method only switches different files in the current pane. 2. how to switch between the panes: Ctrl + w + direction key -- switch to the front/bottom/up/back pane Ctrl + w + h/j/k/l -- same as Ctrl + ww -- in turn switch back to the next pane
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.