============================================= Some help on using the terminal and an editor [TOC] ============================================= 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: ---- VIDEO --------------------------------------------------------------------- https://www.youtube.com/embed/SsoOG6ZeyUI -------------------------------------------------------------------------------- Here a link that gives you a bit more __background__ information. :links: Vim -> https://en.wikipedia.org/wiki/Vim_(text_editor) Emacs -> https://en.wikipedia.org/wiki/Emacs editor war -> https://en.wikipedia.org/wiki/Editor_war Tutorial 1 -> http://www.ee.surrey.ac.uk/Teaching/Unix/unix1.html Tutorial 2 -> http://www.ee.surrey.ac.uk/Teaching/Unix/unix2.html Tutorial 3 -> http://www.ee.surrey.ac.uk/Teaching/Unix/unix3.html background -> https://thenewstack.io/spaces-vs-tabs-a-20-year-debate-and-now-this-what-the-hell-is-wrong-with-go/ long video -> https://www.youtube.com/watch?v=IiwGbcd8S7I :navigate: up -> doc:index back -> doc:session00/page03 next -> doc:session00/page05