Tips and tricks of using Ctrl+Z in Ubuntu Linux

Keyboard shortcuts are one of the most straightforward ways to improve personal productivity while using applications or operating systems. Some of the most well known keyboard shortcuts are Ctrl+C to copy content and files, Ctrl+X for cutting, and Ctrl+V for pasting. There’s another very important shortcut, which you should know about – Ctrl+Z. In this article we’ll cover why and how you can use this shortcut in Linux (Ubuntu, for example).

We’ll cover Ctrl+Z shortcut for the following use-cases:

  • Working with text editors
  • Files management
  • Terminal

Working with text editors

You can use the Ctrl+Z keyboard shortcut to undo any actions in any modern applications.

While working with a text editor, this shortcut allows you to undo a typo or formatting issue.

For example, in the text editor, I would like to write “World is open source“.

1. Tips and tricks of using Ctrl + Z in Ubuntu Linux - TextEdit typo

I intentionally misspelled the word “source” in the screenshot.

Usually, to fix the typo we press backspace a couple of times until the mistake is corrected.

But there’s more easy way exists!

Just press Ctrl+Z.

2. Tips and tricks of using Ctrl + Z in Ubuntu Linux - TextEdit undo typo

Pressing CTRL+Z will remove previously entered word.

Now, continue typing.

3. Tips and tricks of using Ctrl + Z in Ubuntu Linux - TextEdit typo corrected

So simple!

Undo file operations

There are three test files in the opened directory that you can see in the following screenshot.

4. Tips and tricks of using Ctrl + Z in Ubuntu Linux - Ubuntu File Manager 3 files

Let’s imagine, that you accidentally deleted one of them.

5. Tips and tricks of using Ctrl + Z in Ubuntu Linux - Ubuntu File Manager 2 files

Press CTRL+Z to undo the delete operation and restore file to its previous location.

6. Tips and tricks of using Ctrl + Z in Ubuntu Linux - Ubuntu File Manager files restored

Release the terminal

Now, let’s cover the last and, probably, the most important use-case – using Ctrl+Z in the terminal. 

Using the Ctrl+Z shortcut in the terminal allows you to send a long-running command to a terminal background and return you a terminal control, so you can continue using it for your own needs.

To illustrate this example, let’s install termdown utility, which will do countdown for a specified period of time and print output to the terminal:

sudo snap install termdown
7. Tips and tricks of using Ctrl + Z at Ubuntu - Install termdown

If you face snap command first time, it allows you to install Linux applications from Linux app store.

Let’s call the termdown to start a countdown for 300 seconds.

termdown 300
8. Tips and tricks of using Ctrl + Z at Ubuntu - termdown 300 seconds

The countdown has been started.

9. Tips and tricks of using Ctrl + Z at Ubuntu - termdown countdown

Now, press the CTRL+Z to release the terminal.

10. Tips and tricks of using Ctrl + Z at Ubuntu - send termdown to foreground

You may continue using your terminal for your own needs.

As soon as you’re ready to return back the process, which is running in the background, run the following command:

fg
11. Tips and tricks of using Ctrl + Z at Ubuntu - restore process from the foreground execution using fg

This command will return termdown execution to the terminal back (put it back to the foreground).

12. Tips and tricks of using Ctrl + Z at Ubuntu - termdown restored

Summary

There are many different shortcuts that exist in Linux which allows us to improve daily productivity.

In this article, we covered the most important of them – CTRL+Z shortcut.

We hope you’ve found this article useful. If so, please, help us to spread it to the world!

Like this article?

Share on facebook
Share on Facebook
Share on twitter
Share on Twitter
Share on linkedin
Share on Linkdin
Share on pinterest
Share on Pinterest

Leave a comment