Some help on using the terminal and an editor

Here you find some more information on how to use the terminal and an editor that can be used on the server.

Working with a Unix shell

Here some links to a tutorial (in the beginning the first two will be sufficient):

  • Tutorial 1: Listing files and directories. Making and changing directories.

  • Tutorial 2: Copying, moving and deleting files. Displaying the contents of a file on the screen

  • Tutorial 3: Redirecting output and using pipelines.

And here mini cheet sheet for some frequently used commands:

exit

Terminate the shell. If you are on the server it disconnects.

pwd

“print working directory” (shows you where you are in the file hierarchy)

ls

“list” Lists the files in the current working directory

mkdir some_directory

“make directory” creates a directory in the current working directory.

cd some_directory

“change directory” changes the current working diretory to the sub-diretory some_directory.

cd ..

Changes the working directory the parent directory (“you go up”).

cd

Note that there are no arguments here. No matter where you are in the file hierarchy, this brings you to your home directory.

cd -

Change back to the last working directory

Using an editor that runs in a terminal

Using an editor with a graphical user interface (GUI) is tedious if you run it through ssh. Of course you can use a local editor and somehow synchronize your files over the network. But in my opinion and experience that is not much better.

For beginners I suggest you use an editor like nano on the server. Typically nano is installed on every Unix system. Hence you don't have to look for alternative in case you work on a different server. If this is good enough for you, you can stop reading (for now).

If you want to learn something “for lifetime” use Vim (or Emacs). Personally I prefer Vim (or Vi) for many reasons. But this is an endless discussion inside the coding community (see editor war).

Often beginners do not understand why an editor is such a big deal. In my experince you will go through 3 levels when you do a lot of coding:

  • In level 1 you use a simple editor that just does the job. For example something like nano where you just can type some text and save it.

  • Then you start using some integrated development environment (IDE). Like XCode, Eclipse or (I guess) Visual Studio. Such IDEs have a more powerful editor with a GUI that makes it much simpler to handle large projects. This is level 2.

  • But than you realize that for coding using a mouse is extremly inefficient. You will look for something that can be controlled with the keyboard only. So this is level 3, and its the final stage in which you remain for the rest of you life. In this level you will find out that there are only two editor that are capable to satisfy your needs: Vim or Emacs. You have to choose and this choice will be final.

Vim (and Emcas) have a steep learning curve. But learning how to use Vim (or Emacs) is something you do for life.

I was searching for good Vim tutorials. This is what I found so far (and considered to be good):

  • Kind of a long video (about an hour) but it shows pretty much everything (if this is even possible for Vim).

  • ... still searching from time to time ...

Spaces vs. Tabs and Vim vs. Emcas

I am using Vim over Emacs, and I am using Tabs over Spaces. So I am not taking sides in this discussion:

Here a link that gives you a bit more background information.