Updated News Around the World

Linux 101: How to execute commands from within the nano text editor

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.

linux.jpg

Image: jivacore/Shutterstock

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.

Also see

For all the latest Technology News Click Here 

 For the latest news and updates, follow us on Google News

Read original article here

Denial of responsibility! NewsUpdate is an automatic aggregator around the global media. All the content are available free on Internet. We have just arranged it in one platform for educational purpose only. In each content, the hyperlink to the primary source is specified. All trademarks belong to their rightful owners, all materials to their authors. If you are the owner of the content and do not want us to publish your materials on our website, please contact us by email – [email protected]. The content will be deleted within 24 hours.