Useful command
A list comprised of a brief description of few usueful command is given.
grep
It will search word patterns for you in selected documents or a list of them
grep -w -R "foo"
where the -w flag stands for word while -R for research in subdirectories.
It will search all the file names that in which he finds a pattern (in this case:
foo).
mmv
Rename more than one file at once, extension included:
mmv '\*.STL' '\#1.stl'
tail
To check running simulation written in a log file, it is possible to see in terminal the live writing
tail -f foo.log
sed
For replacing the text repetitively in file stream:
find . -type f | xargs sed -i s/<oldWord>/<newWord>/g
The above chains of commands will change the content of every file that constains an
oldWorld pattern substituting it with newWord.
cp
A useful usage of the copy utility follows. for example, to copy a file in different directory, execute:
ls -d processor* | xargs -i cp -r 0.orig/* ./{}/0
find
To find the correct case frame in tutorial, follows simlar commands chain:
find $FOAM_TUTORIALS -type f | xargs grep -r <wordYouAreInterestedIn> # It will search in all tutorial files
find $FOAM_TUTORIALS -name controlDict | xargs grep -r <wordYouAreInterestedIn> # It will search in all controlDict files
Which list controlDict files where the word foo have been found
If you want to know how the continuity errors are computed use find in this way:
$FOAM_SRC –iname *continuity*
and open any of the files.