Appendix A
Appendix A
Linux Commands
This offering is not approved or endorsed by ESI® Group, ESI-OpenCFD® or the OpenFOAM®
Foundation, the producer of the OpenFOAM® software and owner of the OpenFOAM® trademark.
OpenFOAM® Basic Training
Appendix A
ISBN 978-3-903337-02-2
Publisher: chemical-engineering.at
Available from: www.fluiddynamics.at
OpenFOAM® Basic Training
Appendix A
cat, more, less File viewer with pure read function - in order of ease of operation. In less with
pagedown/pageup you can navigate within the file, with / and ? can look for
strings, q can be used for closing less. cat is back for universally available on
Unix.
cd, cd .. Changing the directory, cd .. goes one directory up and cd ~ moves to home
directory. Important to note is the space between cd and .. as opposed to DOS!
cp, cp -r Copying files or entire directory trees (with -r option). Caution: There is no
warning or prompt when overwriting existing files! The important thing is that a
target has to be always given, at least one . which means, copy to the current
directory.
ctrl+r Reverse search, for searching an already typed command in a terminal window.
du, du -s, Calculates the amount of space consumed in a directory. For safety reasons you
should use the -k option (output in kilobytes), since some systems provide the
du -k
space in blocks that include only 512 bytes ...
gedit Text editor with graphical user interface. When working with gedit some
temporary files (originalFileName~) are created, they can be deleted after
saving.
grep Search command for plain-text data sets for lines matching a regular expression.
kill, kill -9 Stopping processes. For this the process ID is required, which can be found with
top or ps. The Exit is irrevocable course - but you cannot shoot processes, if
you are not the "owner".
ls, ls –la Lists the contents of a directory, with option -la also hidden files are displayed,
as well as the file size and characteristics.
Appendix A
Nano, pico The command to run the nano text editor, a terminal based text editor.
| It is known as pipe and is used for merging two commands, redirecting one
command as input to another, e.g. less|grep searches a specified word in the
output of file opened with less.
ps, ps –A Lists all the processes that were started in the respective command window with
the options are all running processes on the system display.
ps waux
rm, CAUTION: Deletes files. The option -r will also remove directories and files recursively and
rm -fr delete directories, f (force) prevents any further inquiry. - Incorrectly applied, this
command can lead to irreversible loss of all (private) data. There is no undelete
or undo!
scp The copy command over the network - as secure FTP replacement. Also
dominates the -r (recursive) option. Usage: scp source file destination file with
source and the destination format can be USERNAME@
COMPUTER.DOMAIN:PATH/TO/FILE. Source or target can of course also be
created locally, then (your) user name and computer are not required.
tail, tail -f File viewer, the default outputs the last 10 lines of a file. With option -n XX can
spend the last XX lines, with the -f option, the command is running from those
lines, which are attached to a file. The command is therefore perfect for watching
log files.
OpenFOAM® Basic Training
Appendix A
top Displays a constantly updated list of all running processes, with process ID,
memory and CPU usage. For processes of one user top [username] should be
used, and for quitting q or ctrl+c should be applied.
vi, vim File editor. For forward searching use /, for backward searching use ?. For
exiting esc+:x. nano or pico are recommended for beginners, which are easier
to handle.
OpenFOAM® Basic Training
Appendix A