Close this search box.

Linux Tips and Tricks

Here is a collection of Linux commands and hints that I find useful:

➡️ Search for all inp-files that contain the text “PENALTY” (case insensitive)

					grep --include=\*.inp -rni ~ -e "PENALTY"

➡️ List what hosts are active on the local network:

					arp-scan -l
nmap -sn

➡️ Debugging a core dump:

					gdb executable core
thread apply all bt

➡️ To determine if a Redhat / CentOS computer needs to be rebooted:

					sudo needs-restarting -r

➡️ Enable core dumps on Redhat / CentOS. As root type (needs to be done after each reboot):

					echo /tmp/core-%e-sig%s-user%u-group%g-pid%p-time%t > /proc/sys/kernel/core_pattern

➡️ Split and combine HUGE files:

					split --verbose -b1G file.tar file.tar.
cat file.tar.* > file.tar

➡️ Update PolyUMod and MCalibration files (the \ before cp runs the command without any alias):

					cd PolyUMod_Installer_Lin64_vX.X.X/files
\cp -r -p * /opt/PolymerFEM/

➡️ Run ANSYS in batch mode from a Windows PowerShell:

					C:/"Program Files"/"ANSYS Inc"/v192/ansys/bin/winx64/ANSYS192.exe -b -i simulation.dat -o job.output -j job -dis -np 1

On Linux run:

					# one time, if needed:
# source /opt/intel/oneapi/
/opt/ansys_inc/v221/ansys/bin/ansys221 -b -i mcal_simulation.inp -o log -job job -np 1

➡️ 3 Ways to run LS-DYNA from a terminal:

					lsdyna i=file.k jobid=tmp ncpu=4
/opt/PolymerFEM/PolyUMod/PolyUMod_LSDYNA/lsdyna_dp.e i=mcal_simulation.k jobid=slask
source /opt/intel/oneapi/
mpirun -np 1 /opt/PolymerFEM/PolyUMod/PolyUMod_LSDYNA/lsdyna_dp_mpp.e i=mcal_simulation.k jobId=slask


➡️ Create an animated gif-image from a set of png-images:

					convert -delay 150 -loop 0 *png myimage.gif

➡️ Setup vim so that only tabs with a width of 4 are used:

					set autoindent noexpandtab tabstop=4 shiftwidth=4

➡️ Take a screen shot of a region in Ubuntu 20.04:

					Ctrl + Shift + Print

➡️ When I tried to ANSYS v201 on Ubuntu 20.04 I got error like the following

					Syntax error: Bad fd number

I was able to fix that odd error by editing the first line of the following 3 files:






Now I can run the latest version of ANSYS on the latest version of Ubuntu. Cool.

➡️ Convert many 12-bit tif images to 16-bit images:

					for a in *tif; convert $a -depth 16 new_$a

➡️ Neo-Hookean:

					C10 = mu / 2
mu = 2 C10

➡️ Read in and plot data using Julia

					using Plots, CSV, DataFrames
dsim = DataFrame(CSV.File("", delim=' ', ignorerepeated=true))
plot!(dsim[:,1], dsim[:,2], label="FEA", linestyle=:dash, linewidth=2)
plot!(size=(1200,800), xlims=(12.0, 20.0), ylims=(0.0, 60.0), legend=:topright, framestyle=:box)
plot!(tickfontsize=14, guidefontsize=16, legendfontsize=10, xlabel="Displacement", ylabel="Radial Force (N)")

					using Plots
x = range(1, 100, length=50)
y = 2.0 .* x.^3.5
plot(x, y, xaxis=:log, yaxis=:log)

➡️ Start zsh command in the background and then disown it:

					sleep 1 &!

➡️ Compress a folder to xz-format:

					tar caf folder.tar.xz folder

In the comments below, indicate if you have any other “tricky” commands that you would like to add!


More to explore

LLDPE Material Modeling

Demonstration of how you can use the PolyUMod Material Database model for LLDPE. This is an excellent model for generic LLDPE.

Leave a Comment