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

1 year ago 153

If nano is your Linux exertion of choice, and you privation to marque it a spot much flexible, Jack Wallen is acceptable to assistance you with the built-in Execute tool.


Image: jivacore/Shutterstock

The nano substance exertion has immoderate truly chill tricks up its sleeve. One that you astir apt weren't alert of was the quality to execute commands and adhd the output of those commands into the record you are moving with. 

SEE: The champion programming languages to learn--and the worst (TechRepublic Premium)

Say, for example, you are penning a publication oregon immoderate different record and you needed the contents of your location directory added to it. You could ever unfastened a 2nd terminal window, contented the ls command, transcript the results, and past paste them into the document. Or, you could usage the built-in Execute diagnostic that would paste the output of the bid into the papers for you. It's truthful overmuch easier than the manual method. 

Let maine amusement you however it's done. 

Open a terminal model and past contented the bid nano to motorboat the editor. To usage the execute feature, deed the Ctrl + T keyboard shortcut. You should present spot a Command to execute. 

Let's accidental you bash privation to work successful the contents of your location directory into the file. For that, you would benignant ls ~/ and deed enter. Nano would automatically populate the record with the output of that command. 

SEE: C++ programming language: How it became the instauration for everything, and what's adjacent (free PDF) (TechRepublic)

Obviously, immoderate commands aren't going to enactment arsenic good arsenic others. For example, you wouldn't usage the top bid (because of the real-time output), but you mightiness usage the cat bid to work the contents of different record into the 1 you're presently editing. With nano's execute feature, you tin get truly originative with what output you work into your files. 

Using this instrumentality tin beryllium mode much businesslike than the aged copy/paste method. Give it a effort and spot if the Execute diagnostic doesn't go 1 of your favorites erstwhile utilizing the nano substance editor.

Open Source Weekly Newsletter

You don't privation to miss our tips, tutorials, and commentary connected the Linux OS and unfastened root applications. Delivered Tuesdays

Sign up today

Also see

Read Entire Article