5 Very Useful Linux Command Line Secrets and Tricks You Must Know

In this article, we are going to see very useful Linux command line secrets and tricks to save time and increase productivity. Most people need some time to figure out how to be productive when they first start using Linux. This operating system is incredibly flexible and essential for developers across the globe. In case Linux is the standard OS at your company, you most likely saw more experienced users interact very efficiently. Although it may look like it would take you years to achieve this level of expertise, the truth is that you can greatly enhance your productivity on Linux with only several useful tricks.

What’s great about the Linux command line is that you can use it for countless processes. For instance, you can even zip and unzip a file in Linux from the command line. Regardless of whether you just installed Linux on your computer or have been using it for years, you’ll find some useful command line secrets and tricks in this article.

5 Linux Command Line Secrets and Tricks

1. Execute Multiple Commands

Most new Linux users find out that they have to wait until a command runs successfully before they can run the next one. However, that’s not really true. There is a way to execute multiple commands with a simple trick in the command line. This doesn’t mean that the commands will execute at the same time, but rather that you’ll put some in queue. If you’d want to do this, here’s what your command should look like:

command_1; command_2; command_3

By doing this, you’ll ensure that once a command has run successfully, the next one will start to execute without requiring any input from you.

2. The !! Command

One thing you’ll have to get used to when you transition to Linux is that you’ll often have to write the word sudo at the beginning of your command. This is because the operating system requires root privileges to run certain commands. Sometimes, you may write a long and complex command only to find out that you forgot to add sudo at the start.

You shouldn’t worry if this happens to you, as there’s a simple trick that you can use to fix this issue. Simply type sudo !! as your next command, and your previous command will run successfully.

3. Search for Previous Commands

There are so many different commands that you can use on Linux that you could probably write several college essay papers on them. In fact, it’s sometimes difficult even for experts to remember all the commands they can use on this operating system.

It often happens that both new and experienced Linux users forget the exact command they used hours ago. You would lose a lot of time if you went online to search for this command, which is what a lot of people do. This is especially the case if the command is long and complex.

You can enhance your productivity if you use reverse search on your computer to find out exactly how the command went. Simply type in ctrl+r in the command line and type a part of the command that you remember. When you do this, the computer will search your history and display commands that match your search term. After you found what you’ve been looking for, type in ctrl+c to quit reverse search.

4. Keep a Program Running in the Background

In case you used Linux before, you know that a program that you run in the terminal will shut down as soon as the terminal session is finished. Nevertheless, this doesn’t have to be the case always. You can still keep the program running in the background even if you end the terminal session with a simple command.

To do this, type nohup at the beginning of your command. The nohup command stands for no hang up and is incredibly useful. It can save you a lot of time in case you forget that you want to keep a certain program running and accidentally close the terminal window.

5. Permanently Delete Files on Linux

Most people use Linux because they value privacy. If you want to protect your data and prevent anyone from seeing it, you can use a command that’ll enable you to shred files. You’re most likely familiar with the rm command that is used to delete files.

What you may not know is that this doesn’t delete your files completely. People with special software programs may still be able to extract your data even after you deleted them. That’s why the shred command is so important. If you type in shred –zvu <filename>, you’ll permanently delete a file and prevent anyone from ever accessing it again.

Conclusion

Using these Linux command line secrets and tricks can help both beginners and experienced developers save time when they’re working on something. Although Linux may seem complex at first, utilizing these tricks will show you why it’s a superior operating system.

We hope you have found this article helpful. Let us know your questions or feedback if any through the comment section in below. You can subscribe our newsletter and get notified when we publish new articles. Moreover, you can explore here other interesting articles.

If you like our article, please consider buying a coffee for us.
Thanks for your support!

Support us on Buy me a coffee! Buy me a coffee!



Join the Discussion.