Classic usage techniques for Linux common commands

Source: Internet
Author: User
Tags gz file first row

1, sagane@sagane-thinkpad-edge:~$ Mii-tool, when the network is not available, use this command to see if 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 password, you can remotely control this machine, even in the Windows environment to install Xshell software, simulation of Linux terminal Remote control server.

3, sagane@sagane-thinkpad-edge:~$ scp-r root@192.168.1.2:/home/sagane./, Copy the contents of the Sagane folder to the current directory, with the root user login IP address as 192.168.1.2 machine.

4, root@sagane-thinkpad-edge:/home/sagane/advio# Tailf/var/log/boot.log, real-time display of boot.log content changes.

5, with the UpdateDB command and locate command to find files, is the fastest way to find, the two commands to use together.

6, find. -type d, locating directory files in the current directory

-user Sagane, looking for files with user name Sagane

-name ""

-mmin-10, search for files changed in 10 minutes, +10 search for files changed 10 minutes ago

-mtime-10, search for files changed 10 days ago

Wildcard *: represents multiple characters

Wildcard character?: represents 1 characters

7, with the mouse center pulley clever implementation of sticky paste, which is like using a desktop terminal one of the reasons.

8, sagane@sagane-thinkpad-edge:~$ less examples.desktop, with less command to achieve the display of the contents of the file under the terminal.

9, sagane@sagane-thinkpad-edge:~$ df-h View the use of hard disk.

10, root@sagane-thinkpad-edge:/home# du-sh sagane/, view the size of the Sagane folder.

11, Vim command:

Shift+n: Look up, N: Look down;

: 1, $s/a/b/gc to replace a in the file with a B, plus G will be all the places in the file to replace, without G to replace the first row appears, plus the C description is interactive replacement;

D: Cut the selected section, DD cut a row, y Copy the selected section, yy copy a row

P: At the cursor at the top of the paste, p: At the cursor at the bottom of the Paste multiple window display

12, root@sagane-thinkpad-edge:/home/sagane# find. -name "test.c"-exec ls-lh {};

Do not omit the last semicolon when the command is entered, put the test.c file found by the Find command into the back brace, and run again.

13, root@sagane-thinkpad-edge:/home/sagane# grep-r ai test.c, find the character Ai in the test.c file.

Grep-e "^root"/etc/passwd in passwd file, the beginning of each line searches for the root character

Grep-e "bash$"/etc/passwd end of line search bash characters

Grep-e "R.. T "/etc/passwd. Represents 1 characters

Grep-e "R.*t"/etc/passwd. * to represent any character, same *

Grep-e "Root|sagane"/etc/passwd search root or Sagane strings

Grep-e "roo[a-z,a-z,0-9]"/etc/passwd Lock the range of a character

Grep-e "roo[^a-z,a-z,0-9]"/etc/passwd ^ is except for certain strings

GREP-E-V root/etc/passwd content other than root

14, > redirect

>> Chase aggravated Directional

2> Error Redirection

2>> Error Append Redirection

15, root@sagane-thinkpad-edge:/home/sagane/advio# grep-v main race.c | The grep AI searches for content other than main from the race.c file and outputs the output to a later command to find out if 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

Operations on the directory:

Tar CVF *.tar test to package the test directory XVF unpack the package

Tar TVF *.tar Display the contents of a compressed file

Tar RVF *.tar test appends the directory test to the *.tar package

Tar xvf *.tar-c test to extract the *.tar to the test directory

Tar zcvf *.tar.gz test compresses the test file into a *.tar.gz file

Tar jcvf *.tar.gz test compression

Tar zxvf *.tar.gz Decompression

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.