Ex 3.) Edit a simple text file.

You are here:
Estimated reading time: 1 min

Introduction

There are a number of different text editors in the environment.

Terminal mode

From the command line you can use vim, nano or emacs (in non-window mode). All of them are very powerful but there is a bit of a learning curve. The man pages, “cheat cheats” and youtube videos can be used to find more details, in particular on commands and keyboard shortcuts.

vim

 

Graphical mode

In windows mode you can use the terminal mode editors or you can use editors that have a GUI. Besides emacs in its (default) window mode, other more “notepad-like” editors like gedit are also available on SCIAMA. You can invoke these editors from the command line e.g.

gedit

Exercise

Linux applications often use (hidden) dot files. These are files located in your $HOME that start with a dot, eg: .bashrc. These are sometimes referred to as startup files which contain information used by a particular application when its starts.

Use an editor of your choice to edit the file $HOME/.bashrc .

Add the following line:-

PS1="(Training)[\u@\h\[\e[1;34m\](sciama)\[\e[0m\] \W]\$"

once added execute the following:-

source $HOME/.bashrc
ls

Do you see a difference in your prompt ?

NB: The cd command by itself returns you to $HOME (i.e. home directory) .

 

Was this article helpful?
Dislike 0
Views: 201