Skip to main content

Bash

The cluster runs a Linux operating system where Bash shell scripts and interactive commands are supported. A basic familiarity with Bash shell (Linux) commands is required for interacting with the cluster.

Common commands​

CommandDescription
cp file1 file2Copy file1 and rename it to file2
mv file1 file2Move or rename file1 to file2
rm fileDeletes a file
rmdir dir/Removes an empty directory
-rThe -r flag will allow cp and rm to work with directories

Some additional useful commands can be found here.

Editing files​

Elja offers the basic text editors available for Linux

Vim​

Vim is a highly configurable text editor built to make creating and changing any kind of text very efficient.

Usage​

To open a file named file.txt in vim use the command:

vim file.txt

After you are done editing, exit Vim:

  1. Press Esc first (to ensure you're in "normal mode")
  2. Then type one of these commands followed by Enter:
    • :q - quit (only works if no changes were made)
    • :q! - quit and discard any changes
    • :wq - save and quit
    • :x - save and quit (shorter alternative)

Remember: Vim has different modes (normal, insert, visual). You enter insert mode to type/edit (by pressing i), and need to return to normal mode (by pressing Esc) before using commands.

Vim/Vi cheat sheet

Vi​

Vi is a lightweight version of Vim

Usage​

Opening a file in Vi is very similar to Vim:

vi file.txt

The same exit commands apply as with Vim:

  • Press Esc first
  • Type :q, :q!, :wq, or :x followed by Enter

Vim/Vi cheat sheet

Emacs​

Emacs is a text editor designed for POSIX operating systems and available on Linux, BSD, macOS, Windows, and more. Users love Emacs because it features efficient commands for common but complex actions and for the plugins and configuration hacks that have developed around it for nearly 40 years.

Usage​

emacs file.txt

Emacs cheat sheet

Nano​

Lightweight and straightforward, nano delivers a simple, intuitive editor with no extra fuss.

Usage​

nano file.txt

Nano cheat sheet

bash_profile and bashrc​

bash_profile​

The .bash_profile is a hidde script that is executed only once when you log into your account. This is used to set environment variables and to run commands that are needed only once at the start of your session. It is commonly used to set PATH variable.

bashrc​

Bashrc is a configuration file for the Bash shell, which is the default shell on Elja. It is executed each time you open a new instance of a terminal window, for instance when using the screen command, and is used to set environment variables, define aliases and customizing your prompt.