The difference and use of ctrl+z, CTRL + C, and ctrl+d in Linux commands __linux

Source: Internet
Author: User

The meaning of ctrl+c,ctrl+d,ctrl+z in Linux

Both Ctrl + C and ctrl+z are breaking orders, but their role is different.

CTRL + C is the execution of a forced interrupt program.

The ctrl+z is to break the task, but the task is not over, he is still in the process he just maintains a pending state.

[root@localhost ~]# ping baidu.com ping baidu.com (220.181.57.217) bytes of data. Bytes from 220.181.57.217:icmp_seq=1 ttl=128 time=58.7 ms-bytes from 220.181.57.217:icmp_seq=2 ttl=128 time=76.6 m  S-bytes from 220.181.57.217:icmp_seq=3 ttl=128 time=54.6 ms-bytes from 220.181.57.217:icmp_seq=4 ttl=128 time=72.7 Ms bytes from 220.181.57.217:icmp_seq=5 ttl=128 time=51.3 ms-bytes from 220.181.57.217:icmp_seq=6 ttl=128 time=12 4 ms bytes from 220.181.57.217:icmp_seq=7 ttl=128 time=71.2 ms-bytes from 220.181.57.217:icmp_seq=8 ttl=128 time=5 2.4 ms bytes from 220.181.57.217:icmp_seq=9 ttl=128 time=51.7 ms-bytes from 220.181.57.217:icmp_seq=10 ttl=128 Tim e=254 ms bytes from 220.181.57.217:icmp_seq=12 ttl=128 time=64.2 ms-bytes from 220.181.57.217:icmp_seq=13 ttl=128 time=51.8 ms bytes from 220.181.57.217:icmp_seq=14 ttl=128 time=92.5 ms-bytes from 220.181.57.217:icmp_seq=15 ttl= 128 time=52.1 ms bytes from 220.181.57.217:icmp_seq=16 ttl=128 time=51.8 Ms ^z [1]+ Stopped Ping baidu.com 

The user can use the FG/BG operation to continue the foreground or backstage tasks,
FG command to restart the interrupted task of the foreground,

[root@localhost ~]# FG
Ping baidu.com
bytes from 180.149.132.47:icmp_seq=6 ttl=128 time=59.0 ms bytes
F Rom 180.149.132.47:icmp_seq=7 ttl=128 time=67.2 ms
bytes from 180.149.132.47:icmp_seq=8 ttl=128 time=54.5 Ms
Bytes from 180.149.132.47:icmp_seq=10 ttl=128 time=55.9 ms bytes from
180.149.132.47:icmp_seq=12 ttl=128 56.8 Ms
bytes from 180.149.132.47:icmp_seq=13 ttl=128 time=60.0 ms-bytes from
180.149.132.47:icmp_seq=14 t tl=128 time=155 ms
^z
[1]+  Stopped                 Ping baidu.com

The BG command puts the interrupted task in the background for execution.

For example: When you vi a file is, if you need to use the shell to perform other operations, but you do not intend to close VI, because you have to save the launch, you can simply press Ctrl+z,shell will be the VI process hangs ~, when you end that Shell operation, You can use FG command to continue vi your file.

Instead of sending a signal, ctrl+d represents a special binary value that represents EOF.

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.