Hi@akhtar,
Generally, these two commands are used to stop the process. First we will try with ctrl c and if it will not work, than we go with ctrl d to kill the process. But there are a small difference between these two commands.
ctrl c is used to kill a process. It terminates your program.
[root@master ~]# ping goo.gle
PING goo.gle (67.199.248.12) 56(84) bytes of data.
64 bytes from cname.bitly.com (67.199.248.12): icmp_seq=1 ttl=55 time=98.7 ms
64 bytes from cname.bitly.com (67.199.248.12): icmp_seq=2 ttl=55 time=20.3 ms
64 bytes from cname.bitly.com (67.199.248.12): icmp_seq=3 ttl=55 time=144 ms
64 bytes from cname.bitly.com (67.199.248.12): icmp_seq=4 ttl=55 time=58.5 ms
^C
--- goo.gle ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3015ms
rtt min/avg/max/mdev = 20.316/80.505/144.417/46.151 ms
ctrl z is used to pause the process. It will not terminate your program, it will keep your program in background. You can restart your program from that point where you used ctrl z.
[root@master ~]# ping goo.gle
PING goo.gle (67.199.248.12) 56(84) bytes of data.
64 bytes from cname.bitly.com (67.199.248.12): icmp_seq=1 ttl=55 time=22.5 ms
64 bytes from cname.bitly.com (67.199.248.12): icmp_seq=2 ttl=55 time=124 ms
64 bytes from cname.bitly.com (67.199.248.12): icmp_seq=3 ttl=55 time=37.4 ms
^Z
[1]+ Stopped ping goo.gle
[root@master ~]#
You can restart your program using the command fg. It means it will return your job in foreground again.
[root@master ~]# fg 1
ping goo.gle
64 bytes from cname.bitly.com (67.199.248.12): icmp_seq=4 ttl=56 time=24.2 ms
64 bytes from cname.bitly.com (67.199.248.12): icmp_seq=5 ttl=56 time=95.5 ms
64 bytes from cname.bitly.com (67.199.248.12): icmp_seq=6 ttl=56 time=19.3 ms
64 bytes from cname.bitly.com (67.199.248.12): icmp_seq=7 ttl=56 time=24.0 ms
^C
--- goo.gle ping statistics ---
7 packets transmitted, 7 received, 0% packet loss, time 91406ms
rtt min/avg/max/mdev = 19.342/49.685/124.594/39.327 ms
[root@master ~]#
Hope it will clear your doubt.
Enroll with Linux training online and learn in detail about Linux.
Thanks.