Linux Tips and Tricks


Here is a collection of Linux commands that I find useful:
  • Search for all inp-files that contain the text “PENALTY” (case insensitive)
    grep --include=\*.inp -rnwli ~ -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
  • Run LS-DYNA from a terminal:
    lsdyna i=file.k jobid=tmp
  • 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
  • Run a Windows installer in debug mode (I know, this is not for Linux, but still useful):
    msiexec /i Installer.msi /L*V C:\Temp\log.txt
  • 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 
In the comments below, indicate what important (and “tricky”) commands that you would like to add!
Share on facebook
Share on twitter
Share on linkedin

More to explore

Leave a Comment