Copyright infringement

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

If nano is your favorite Linux editor, and you want to make it a little more flexible, Jack Wallen is ready to help you with its built-in implementation tool.

The nano text editor has some really cool tricks. One of the things you may not have been aware of is the ability to execute commands and add the output of those commands to the file you’re working with.

We see: The best programming languages ​​to learn – and the worst (TechRepublic Premium)

Let’s say, for example, that you are writing a script or other file and you need to add the contents of your home directory to it. You can always open a second terminal window, and issue a file ls command, copy the results, and then paste them into your document. Or you can use the built in execution feature that will paste the command output into the document for you. It is much easier than the manual method.

Let me show you how this is done.

Open a terminal window and issue the command nano to run the editor. To use the execute feature, press the keyboard shortcut Ctrl + T. You should now see a command to execute.

Let’s say you want to read the contents of the home directory in a file. So, you will write ls ~ / and hit enter. Nano will automatically populate the file with the output of this command.

We see: The C++ Programming Language: How It Became the Foundation of It All, and What Next (Free PDF) (TechRepublic)

Obviously, some commands will not work as well as others. For example, you will not use the . extension higher command (because of the real-time output), but you can use an extension cat A command to read the contents of another file in the file you are currently editing. With the nano implementation feature, you can be really creative with what output you read in your files.

Using this tool can be much more efficient than the old copy/paste method. Give it a try and see if the implementation feature doesn’t become one of your favorites when using the nano text editor.

see also

Linux.  jpg

Photo: jivacore / Shutterstock