If nano is your Linux editor of choice, and you want to make it a bit more flexible, Jack Wallen is ready to help you with the built-in Execute tool.
The nano text editor has some really cool tricks up its sleeve. One that you probably weren't aware of was the ability to execute commands and add the output of those commands into the file you are working with.
SEE: The best programming languages to learn--and the worst (TechRepublic Premium)
Say, for example, you are writing a script or some other file and you needed the contents of your home directory added to it. You could always open a second terminal window, issue the ls command, copy the results, and then paste them into the document. Or, you could use the built-in Execute feature that would paste the output of the command into the document for you. It's so much easier than the manual method.
Let me show you how it's done.
Open a terminal window and then issue the command nano to launch the editor. To use the execute feature, hit the Ctrl + T keyboard shortcut. You should now see a Command to execute.
Let's say you do want to read in the contents of your home directory into the file. For that, you would type ls ~/ and hit enter. Nano would automatically populate the file with the output of that command.
SEE: C++ programming language: How it became the foundation for everything, and what's next (free PDF) (TechRepublic)
Obviously, some commands aren't going to work as well as others. For example, you wouldn't use the top command (because of the real-time output), but you might use the cat command to read the contents of another file into the one you're currently editing. With nano's execute feature, you can get really creative with what output you read into your files.
Using this tool can be way more efficient than the old copy/paste method. Give it a try and see if the Execute feature doesn't become one of your favorites when using the nano text editor.
Open Source Weekly Newsletter
You don't want to miss our tips, tutorials, and commentary on the Linux OS and open source applications. Delivered Tuesdays
Sign up todayAlso see
- Microsoft is boosting its support for the Python programming ecosystem (TechRepublic)
- Coding interviews are terrible. Can we make them better? (TechRepublic)
- How to become a developer: A cheat sheet (TechRepublic)
- Kubernetes: A cheat sheet (free PDF)(TechRepublic)
- Could Microsoft be en route to dumping Windows in favor of Linux? (TechRepublic)
- A guide to The Open Source Index and GitHub projects checklist (TechRepublic Premium)
- How open source-software transformed the business world (ZDNet)
- Linux, Android, and more open source tech coverage (TechRepublic on Flipboard)