What is the difference between ZZ and :wq commands?

Answers were Sorted based on User's Feedback



What is the difference between ZZ and :wq commands?..

Answer / stan reichardt

ZZ will quit the file, it will only save the file if there
have been changes to it. Therefore the timestamp on the
file will only change if there have been changes.

The ":wq" will save the file with or without any changes
being made. Therefore the timestamp wil always be changed.

Is This Answer Correct ?    29 Yes 3 No

What is the difference between ZZ and :wq commands?..

Answer / pravin

I guess both do the same task..! in the sense :wq,:x and ZZ
are used to save the changes of edited to storage and quit..
but to jot down the difference a foolish one.. :wq and :x
requires <enter> key to be pressed to fire this commands
where as ZZ works as a shortcut (hot) key.. it some what
like for prior commands we are requesting Vi to do the work
and later command we are telling/commanding

Is This Answer Correct ?    8 Yes 4 No

What is the difference between ZZ and :wq commands?..

Answer / ali ahsan

Both do the same job
I can't speak for others, but for myself, I prefer the ":wq".

While it may be two extra characters, I like that my mind goes through the process of "I want a command (:) that writes the file (w) and quits (q)".
It allows me to adjust my intent on the fly...do I mean "and overwrite any pre-existing file" then I
add a "!". If I really mean "do it for all the files", I can add an "a".
So my mind goes through the process of the checklist:

- do I want to write the file? (w)
- do I want to quit the file? (q)
- do I want to quit ALL the files? (a)
- do I want to write/abandon any changes? (!)

and build the command accordingly.
That's 16 different available options in some situations, whereas ZZ and ZQ only account for two of them.

Is This Answer Correct ?    1 Yes 0 No

What is the difference between ZZ and :wq commands?..

Answer / surendra

ZZ is the command mode comand in uix to save and quit file.
:wq is the execute command mode command to save and quit
file.

Both does the same job

Is This Answer Correct ?    4 Yes 5 No

Post New Answer

More Vi Editor Interview Questions

What is the command used to display line numbers in vi editor?

5 Answers  


what are the two different modes in vi editor?

7 Answers  


What is the format of vi command?

2 Answers  


What is the difference between lettered buffer and temporary buffer?

2 Answers  


How to create a .exrc file in vi editor?

1 Answers  






Which command is used to replace many characters?

4 Answers  


what is the command used to delete current line in vi editor?

2 Answers  


What does the /text command do?

4 Answers  


HOW WE CAN MAKE THE DLIEVERY WHICH IS BLOCKED DUE TO CREDIT LIMIT.

0 Answers   Seamless,


How to return to shell without leaving vi editor?

2 Answers  


What is the command used to replace many characters?

2 Answers  


what is the command used to append to buffer?

0 Answers   IBM,


Categories
  • Vi Editor Interview Questions Vi Editor (21)
  • Visual Studio IDE Interview Questions Visual Studio IDE (207)
  • Editors AllOther Interview Questions Editors AllOther (1)