Command Line Operations

(Last update: Apr 23, 2024)

There is a lot of information on the web about command line operations and UNIX commands. Please look up information on the web. Here are a few hints about command line operations.

UNIX commands

The following basic commands are frequently used in command line operations. Please search the web for usage instructions.

  • ls
  • cd
  • cp
  • mv
  • rm
  • mkdir
  • less
  • pwd

You will be able to get a correct (or almost correct) answer from AI chatbot. However, please check whether the operation is really safe by other means before actually executing it.

File/Command Completion with Tab key

You can use the tab key to complete a file or command name. An example is shown below.

We assume that you have three Gaussian input files with very long names. You want to run Gaussian jobs using g16sub command.

$ ls
long_molecular_name_b3lyp_631Gdp.gjf
verylong_molecular_name_b3lyp_631Gdp.gjf
verylong_molecular_name_m06_2x_631Gdp.gjf

You decide to submit "long_molecular_name_b3lyp_631Gdp.gjf" job first. Instead of entering whole the file name, type only the first "l" of the file. (■ represents the cursor position.)

$ g16sub l

Here press "tab" key. Then the file name is completed as follows.

$ g16sub long_molecular_name_b3lyp_631Gdp.gjf

You just need to press enter key and submit the job. As shown in this example, file name can be completed with tab key. Now let's try with other two files, verylong_molecular_name_b3lyp_631Gdp.gjf and verylong_molecular_name_m06_2x_631Gdp.gjf. Type the fist character "v" and press tab...

$ g16sub v

When you type tab key, the file name would be completed but not fully.

$ g16sub verylong_molecular_name_

This is because the names of these two files are the same up to this point. If you press "b" and then tab key, the file name should be completed.

$ g16sub verylong_molecular_name_b

(After typing tab key:)

$ g16sub verylong_molecular_name_b3lyp_631Gdp.gjf

When you press "m" instead of "b" and then press tab key, the other one will be completed.

The command name can be completed as well. For example, on ccfep, type "g16s" and then press tab key, g16sub command will be completed. This completion mechanism is very useful when typing long name commands or filenames. The completion depends on the cursor position. Please beware the cursor position when you press tab key. If something unexpected happens, you might want to press Ctrl+c to discard the current line.

Command History

While using the command line, press the arrow up key (↑) to see the command history. (If you press multiple times, you can see more older ones.) This is very useful when you repeat some actions. You can modify the part of the called command line history. Newer command history than the current one can be shown by arrow down key (↓).

Left and right keys (←,→) can be used to change cursor position on the current command line.

Text Editor

Vim and Emacs are available. If you are familiar with them or you want to be familiar with them, please use them. However, these editors have unique operations and are difficult for beginners.

You can give up editing files on remote RCCS host (ccfep) and do it on your local computers. This is a reasonable choice.

If you still want to edit files on RCCS side (on ccfep), "nano" is a better choice than Vim or Emacs. You can run nano with "nano (file name)" command. Operation instructions are displayed at the bottom of the terminal, where ^ means Ctrl key. If you want to quit nano (^X), press Ctrl+x. You can see help with Ctrl+g (help can be closed with ^X). M-(character) can be invoked with Alt key. For example, M-\ (go to first line) can be invoked with alt+\. M-/ (go to last line) can be invoked with alt+/.

Character Types in File Name

Something unexpected might happen when symbols or non-ASCII characters (e.g. Japanese characters) are used for file names. Number and alphabet characters (0-9,a-z,A-Z) and underscore (_) can be safely used for file names. Period (.), plus (+), and minus or hyphen (-) are also safe as long as they are not used at the first letter of the file name. The other symbols shouldn't be used in file names. (Most of them can be used in file names, though.)