I thought it might be useful if we started a thread about how to do different things using Linux. I know a lot of you are Linux aficionados so please feel free to add to this thread on whatever topic you would like to discuss. I will start with an introduction on how to use nano, a command line text editor.
At some point using Linux you may wish to delve deeper and look under the hood of your operating system. The Linux terminal allows you to run programs and edit text files to name but a few. Many system configuration settings can be changed by editing text files. There are excellent GUI text editors like Gedit and Kwrite that will let you edit text files.
However, there may come a time when you need to edit a text file on the command line interface (CLI).
In the following example I will use the Debian operating system and the nano text editor.
- Open up a terminal prompt and get root access. Type su then enter your root password.
- If you don’t have nano installed then install it with the following command:
aptitude install nano
- Let us say that you wish to add the backports repo to your sources.list. At a root shell prompt start-up nano and give the command pathway to your sources.list
- This will display your sources.list which is a list of all software repositories on your Debian system. Add the following line to your sources.list:
deb backports.debian.org/debian-backports squeeze-backports main
- To save your file using nano you will issue the following keyboard combination:
Ctrl+o <--------- that is a lowercase o
- To exit nano you will issue the following keyboard combination:
- Then update your sources.list by issuing the following command:
You can now install software from the backports repo. A command line interface text editor can be a valuable thing if your system needs to be repaired and X windows no longer functions. Here is another tutorial on how to use the terminal prompt.