ARSC HPC Users' Newsletter Number 424 2013-08-21

The Arctic Region Supercomputing Center Users' Newsletter provides a platform for discourse relevant to users of high performance computing systems. Topics include: programming, commands, tools, applications, and more.

Please send items, ideas, announcements, etc. to

To subscribe or manage your subscription, visit:


UAF-ARSC-HPC-Users Info Page


Getting Assistance Has Never Been Easier

Visit the ARSC Suite in WRRB 105 on the UAF campus, and you will find a newly remodeled support area. The helpdesk is open and staffed from 8am-noon and 1-5pm business days.

Bring your questions or problems, or just stop by to chat about your ideas for how ARSC could be more useful for your work. There is a sitting area, a library, and a workdesk where you can plug in your laptop computer.

Need online examples of models, and building programs from source? Take a look under $SAMPLES_HOME and /usr/local/unsupported on fish and pacman, where you will many examples.


Coming Soon: Updates to

The ARSC Web site at will receive a major update during upcoming days. The new site, which is slated to launch on August 28, features a Knowledge Base section. In that section, you will find short articles providing guidance on common topics.

Feedback on the new site is welcome!


Fall Training at ARSC

The ARSC fall training series is offered via Physics 693, "Fundamental Skills for Computational Science." This is is a full-length semester course, taught by Tom Logan. Tom is joined by a number of guest lecturers from the ARSC staff.

As space allows, the course is open for non-credit drop-ins. Students at any level, as well as faculty and staff members, are invited.

The schedule of classes is available:


Core Skills | ARSC

This is a great way to learn more about programming for high performance computing, as well as fundamentals such as effective command line use, file transfer, and data formats.


Practical Emacs Part II

Christopher Howard, ARSC Research Projects Assistant

(Part 1 may be found in Issue 422, June 2013.)

Accessing the Emacs Manual on Emacs Version 21.*.

The command C-h r, typically used to access the Emacs manual, is not available in Emacs 21.* versions. In this article series, replace the command C-h r with C-h i m Emacs <RET>, when using a 21.* version.

Easy Customization Interface

Later in this article, the user will need to know how to set Emacs global variables. One method is to the use Easy Customization Interface, available through the command M-x customize-variable
VARIABLENAME <RET>. For more details, run the command C-h r m Easy Customization <RET>.

Dired (Directory Editor)

Emacs includes a built-in directory editor, Dired, which is useful for many common file management tasks. Use C-x d DIRECTORYPATH <RET> to open Dired for the specified directory. Alternatively, use C-x 4 d to open Dired in a separate window or C-x 5 d to open it in a separate frame.

Dired will list files in the specified directory. Use C-p and C-n to navigate this file list. Press "q" to bury the Dired buffer (that is, to make it go away).

Here are some practical commands that can be used inside the Dired buffer. These commands operate on the file over which the cursor is located:

<RET>     visit a file
v         view a file (in a pager)
^ (caret) move up a directory
C         copy a file
D         delete a file
R         rename a file
+         create a new directory
S         create a symbolic link
M         change the mode of a file (as chmod would)
Z         compress or decompress a file
:e        encrypt a file
:d        decrypt a file
=         compare with another file

Emacs also provides a Dired-like virtual file system interface to archives. If the user opens an archive file (such as a file with a .tar.gz extension) Emacs will allow the files in the archive to be manipulated inside the archive with some of the normal file operations, such as renaming them or editing their contents.

Buffer Management

To access a full list of all buffers open in the Emacs session, use the command C-x C-b. To visit any buffer on the list, move the cursor over the list entry and press return. This list may also be used to kill multiple buffers at once: press the "d" key to mark the buffers to be killed and press "x" to kill them. Press "q" to bury the buffer list.

Automatic Buffer Restoration

Reopening files from a previous work session can be cumbersome. However, Emacs has a "desktop" feature that automatically restores buffers still open at the end of the previous Emacs session. To activate this feature, set the variable "desktop-save-mode" to "t". For Emacs 21.* use the variable "desktop-enable". Temporary buffers such as *scratch* will not be restored to their previous states.

To avoid an annoying delay from opening many file buffers at the beginning of a session, set the variable "desktop-restore-eager" to a low number. This is the maximum number of buffers Emacs will restore at the start of each session. The rest of the buffers will be restored as soon as the session becomes idle, that is, when the user stops typing or running commands. This variable is not available in 21.* versions.

Read-Only Mode

To avoid accidentally mutilating files accessed for viewing purposes only, open them in read-only mode. To do this, simply use C-x C-r FILENAME <RET>, which works the same as the regular find-file command, except that Emacs will not allow the buffer to be edited once the file has been opened. Additionally, C-x C-r will not create a new file if the named file cannot be found, thereby preventing the user from accidentally creating a new file.

For any buffer already opened, it is easy to toggle read-only mode off or on: simply use C-x C-q. The echo area will then describe whether the mode has been enabled or disabled.

Remote File Access

Emacs allows the user to view and edit remote files through the SSH protocol. This feature avoids the bother of opening a new Emacs instance on the remote system, or duplicating custom Emacs settings. To open a remote file, simply use the normal find-file command (C-x C-f FILENAME <RET>) or find-file-read-only (C-x C-r FILENAME <RET>) following one of these formats for the file name:


If using a "/METHOD..." format, replace METHOD with "ssh". If the method is not chosen explicitly, Emacs will first check the host name and user name for clues to determine whether the remote system is an FTP server. If no such clues are found, Emacs will assume SSH was intended. (Versions 21.* have only one method - FTP - and it is therefore never specified explicitly.)

Furthermore, the FILENAME may be relative to the login directory (usually the home directory). When possible, Emacs will auto-complete (use the TAB key) as it does with local file paths.


The list-directory commands also work remotely (C-x d and C-x C-d) if a remote directory path is provided in one of the aforementioned formats.

Distinguishing Buffer Names

If Emacs opens two files that have the same file name but are in different directories, it will distinguish between the two buffers by adding a number after the name in the buffer name area: for example, "main.c<1>" and "main.c<2>". This gets confusing very quickly. However, if the global Emacs variable "uniquify-buffer-name-style" is set to the value "post-forward", Emacs will use a more helpful method: Instead, the file name will be followed by a pipe symbol, followed by the name of the directory (or, rather, enough of the directory path as is necessary to distinguish between the two files). For example, "Makefile|src" and "Makefile|dist" would be used to distinguish between makefiles in the "src" and the "dist" directories.

Column Numbers

By default, Emacs displays the line number of your buffer in the mode line. It can also display the column number, that is, the position index of your cursor on a line. To activate this feature, set the variable "column-number-mode" to "t".


Quick-Tip Q & A


Last time, we asked:

Q: Do you have a useful custom Unix/Linux shell prompt? If so, please share the code you use to produce your prompt, and make sure you mention which shell you utilize (i.e., an entry for .bashrc, .cshrc, ect.).

A: From Ryan Czerwiec:

There are definitely some very fancy things you can do with prompts, and I've messed with a few over the years, but my most common one is this (using tcsh or csh):

 set prompt = "[${HOST}]:${cwd}/ ! >"

This lets me know which machine that terminal is on, which directory I'm in, and what number in the command history I'm at. It's not hard to truncate the pathname to the lowest-level directory, but I use so many parallel trees with the same name that I need the whole thing (yes, my prompt can get quite long). It also may not be necessary if your terminal dynamically updates the pathname on the title bar, but mine doesn't on remote systems, and doesn't have enough space to show more than a couple levels deep anyway. The command history number is very useful when I'm doing repetitive tasks and need to recall those or do command substitutions. So, it looks like this:

[spirit04]:/home/rmczerwi/ 25 >

The man page for sh contains a section on prompting (down around line 2550 on my machine-your mileage may vary) listing all of the different things besides plain text that you can put in your PS1 and PS2 (which is also described further up in the man page) shell variables for sh, bash, etc., or you can mix and match these with your PROMPT_COMMAND shell variable to do cool things. My prompt could be created in bash by:

PS1='[\h]:\w/ \! > '

Or by putting a printf command in the PROMPT_COMMAND variable instead, which would look similar to the csh syntax.

A: Richard Griswold uses the z-shell:

Here is the code that I have in .zshrc to set my ZSH prompt:

export PS1_COMMON=$'%{\e[1;%(#.31.32)m%}%~ %(?.:\).:\() > %{\e[0m%}'
if [[ $TERM == 'linux' ]]; then
  export PS1=$PS1_COMMON
  export PS1=$'%{\e]0;%(#.ROOT .)%m:%~\a%}'$PS1_COMMON

The prompt is broken down into two parts: a common part that sets the prompt text, and a part that only runs inside of graphical terminals, like xterm, that sets the title bar.

Here's the breakdown of the graphical terminal portion of the prompt:

$'            - Process like the string arguments of the print builtin
%{            - Start literal escape sequence
\e]0;         - Start setting xterm title
%(#.ROOT .)   - Prepend "ROOT " to the title if running as root
%m            - The hostname up to the first dot
:             - Literal character
%~            - Current working directory, with ~ for home
\a            - End setting xterm title
%}            - End literal escape sequence
'             - End string

Here's the breakdown of the common portion of the prompt:

$'            - Process like the string arguments of the print builtin
%{            - Start literal escape sequence
\e[;          - Start setting text color
%(#.31.32)    - Set text to red if running as root and green otherwise
m             - End setting text color
%}            - End literal escape sequence
%~            - Current working directory, with ~ for home
$(?.:\).:\()  - Print  if the last command succeeded and  if it failed
 >            - Literal characters
%{            - Start literal escape sequence
\e[0m         - Reset text color
%}            - End literal escape sequence
'             - End string

A. Greg Newby, your humble narrator, uses zsh on some systems, and tcsh on others (including most ARSC systems).

For zsh, the Z shell, this in my .zshrc:

PS1=$'%{\e[1;36m%}%m(%n) %~ [%!] > %{\e[1;0m%}'

The outcome includes the hostname, which user I am, the command number (for using command history features) the the working directory. Oh, and it's cyan. On one system, the prompt looks like this:

sysname(newby) /usr/local [206] >

With tcsh, I have a rather awkward embedded sed script that shows only the last two or three components of the directory path. This is useful when the path gets long. From my .cshrc:

set hn=`/bin/hostname -s`
alias sp  'set prompt="${hn}(`whoami`) [\\!] `dirs|sed -e '\''s| .*||'\'' -e '\''s|.*[^/]\(/[^/]*/[^/]*\)|..\1|'\''` } "'
alias cd 'cd \!*;sp'

Example, with a longish path:

cd /import/local/unsupported/arsc-updates
demeter(newby) [129] ../unsupported/arsc-updates }

I'm pretty sure there are easier ways to do this.

Here is a new question for next time:

Q: What are some of your favorite experiences on the first day of classes?


[[ Answers, Questions, and Tips Graciously Accepted ]]


About ARSC

The Arctic Region Supercomputing Center (ARSC) provides research and high performance computing, large-scale storage, and related services to the students, faculty and staff of the University of Alaska.



Greg Newby, ARSC Director,, 907-450-8663


Publication Schedule

Monthly, on approximately the third Wednesday.


Subscription Information

Subscribing and unsubscribing:


UAF-ARSC-HPC-Users Info Page

Quick tip answers and other correspondence:

Back Issues are Available


ARSC | ARSC HPC Users' Newsletter Index

Back to Top