This is an internal help article with extremely helpful UNIX and DOS commands. It is not external because we don't want to be responsible for out of date information and we do not want be blamed if users use these commands wrong. Also we want to keep this out of the hands of evil doers.
Mac OS X command for Mac file copying including related resource fork file and permission preservation:
ditto [source] [destination] (* Like copying via the Apple Finder)
Mac OS X command to determine the currently installed JRE version:
java -version
The following 2 commands will make the hidden files (files that start with a dot) visible from the Apple Finder:
defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder
The second command will re-start the Finder. Once restarted the hidden files will be visible.
Check if a MAC OSX system is 64-bit capable:
/usr/sbin/sysctl -n hw.cpu64bit_capable
Commands to reliably determine current shell type on Linux, Mac and Solaris
(because "echo $SHELL" doesn't always give you the correct information)
Linux:
ps -o command -p $$ --no-heading c
--or just--
ps -o command -p $$
Mac OS X:
ps -o command -p $$
Solaris:
ps -p $$ -o comm
Windows Cygwin:
ps | awk '{print $1, $8}' | grep "$$" | awk '{print $2}'
Note: In some cases for above, rather than just using the command "ps", you may need to use the explicit command "/bin/ps", for example: /bin/ps -p $$ -o comm
See also (currently internal) Tech Tip 4433.
Command on Linux and Mac OS X to see the status of active TCP/IP ports on a system:
Command that an be used to stop Linux firewall to test to see if license manager connection is blocked by firewall. Should start firewall back up again after done testing.
sudo service iptables stop
Linux: Encode a binary executable file into an alphanumeric stream and then decode back to binaray using utility "base64":
Encode from binary to alphanumeric stream:
base64 mybinary > mybinary.txt
Decode resulting alphanumeric stream back to the original binary:
base64 -d -i mybinary.txt > mybinary
Then give the resulting file execute permission before running the program:
chmod +x mybinary
mybinary
LINUX:
Both of the following may be generally relevant but also useful for shared memory usage issues, but also for IDL_IDLBridge, semaphores, threading, and ESE issues
Shared memory usage commands:
ipcs
ipcs -l
ipcs -u
User resource limits:
ulimit -a <-- bash
limit <-- tcsh or csh
ulimit -n 4096 <-- If allowed by the system, increases the number of file descriptors to 4096
JAVA:
Java Installation Home Directory
(In the context of the new Flexera License Server (2016), from the "java.home" location, if "./bin/javac" exists then you should consider this the JAVA_HOME directory. If only "./bin/java" exists then this would be the JRE_HOME directory.)
* One way to try to find the Java installation directory location of "java" command (ju 8aug2016):
java -XshowSettings:properties -version
Linux:
For example (bash -- redirecting stderr to stdout):
$ ./java -XshowSettings:properties -version 2>&1 | grep java.home
java.home = /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.101-3.b13.el7_2.x86_64/jre
Windows:
For example, from a Windows Command Prompt window:
java -XshowSettings:properties -version 2>&1 | find "java.home"
Java Installation Bit Version
* To find the bit-version of the Java installation, run the command:
java -version
If the result indicates a 64-bit version then it is 64-bit Java. If no bit-version is indicated then the Java installation is 32-bit. Example output from a 64-bit Java installation:
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
=================
DOS COMMANDS
=================
Send a file to a network printer:
print /d:\\printsrv\flr3prt3 myfile.txt
print /d:\\printsrv\flr3prt3 mybinarypsfile.ps
Run a program without invoking a new DOS shell window:
START "[a-title-string]" [path-to-windows-executable][executable-arguments]
===============================
* Change Windows process priority on the fly using WMIC command *
The command line syntax:
wmic process where name="AppName" CALL setpriority ProcessIDLevel
The customary notepad example setting it to "Above Normal":
wmic process where name="notepad.exe" CALL setpriority 32768
NOTE: Be careful setting the priories higher than normal because it could cause problems with system critical processes.
Idle: 64
Below Normal: 16384
Normal: 32
Above Normal: 32768
High Priority: 128
Real Time: 256
===============================
* Windows XP: Get the file path of a running executable with WMIC
See also Microsoft article:
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/wmic.mspx?mfr=true
For example:
C:\>wmic
wmic:root\cli>PROCESS WHERE (Description="idl.exe")
Caption CommandLine CreationClassName CreationDate CSCreationClassName CSName Description ExecutablePath ExecutionState Handle HandleCount InstallDate KernelModeTime MaximumWorkingSetSize MinimumWorkingSetSize Name OSCreationClassName OSName OtherOperationCount OtherTransferCount PageFaults PageFileUsage ParentProcessId PeakPageFileUsage PeakVirtualSize PeakWorkingSetSize Priority PrivatePageCount ProcessId QuotaNonPagedPoolUsage QuotaPagedPoolUsage QuotaPeakNonPagedPoolUsage QuotaPeakPagedPoolUsage ReadOperationCount ReadTransferCount SessionId Status TerminationDate ThreadCount UserModeTime VirtualSize WindowsVersion WorkingSetSize WriteOperationCount WriteTransferCount
idl.exe "C:\Program Files\Exelis\IDL82\bin\bin.x86\idl.exe" Win32_Process 20121224154854.068993-420 Win32_ComputerSystem TEKXP32 idl.exe C:\Program Files\Exelis\IDL82\bin\bin.x86\idl.exe 1984 46 468750 1413120 204800 idl.exe Win32_OperatingSystem Microsoft Windows XP Professional|C:\WINDOWS|\Device\Harddisk0\Partition2 283 139878 723 1040384 2096 1040384 32423936 2879488 8 1040384 1984 3240 30008 3376 34036 65 17269 0 4 156250 29655040 5.1.2600 2879488 41 329
wmic:root\cli>
=======================================================
Windows 7 (and later?) - How to re-map .pro and .sav file name extensions
to open with the appropriate version IDL and IDL RT executables
=======================================================
To see what program version is associated to .pro and .sav files on your system, from a Windows Command Prompt window, issue the 2 commands:
ftype IDLprogramFile
ftype IDLbinaryFile
To remap the .pro and .sav file extension to a different version of IDL, from Windows Command Prompt window running as Administrator (e.g., for IDL 8.5):
ftype IDLprogramFile="C:\Program Files\Exelis\IDL85\bin\bin.x86_64\IDLSnapFileOpen.exe" "%1"
ftype IDLbinaryFile="C:\Program Files\Exelis\IDL85\bin\bin.x86_64\idlrt.exe" "%1"
Also, if needed, the ASSOC command shows the current file name extension association to a program reference, for example:
C:\Users\joeuser> assoc | find ".sav"
.sav=IDLbinaryfile
and can also be used to establish a connection to the program reference (although we would normally assume that this is already defined), for example:
ASSOC .sav=IDLbinaryfile
=======================================================
Windows: How to change the default "idlde" command used with Start
command from command prompt (e.g.: "start idlde") or from Start
menu > Run interface?
=======================================================
For example, for IDL 8.5, running PowerShell as Administrator, issue the following 2 commands:
set-itemproperty "HKLM:\Software\Microsoft\Windows\CurrentVersion\App Paths\idlde.exe" -name "(Default)" "C:\Program Files\Exelis\IDL85\bin\bin.x86_64\idlde.exe"
set-itemproperty "HKLM:\Software\Microsoft\Windows\CurrentVersion\App Paths\idlde.exe" -name "Path" "C:\Program Files\Exelis\IDL85\bin\bin.x86_64\"
===============================
keywords: useful unix commands, to know, helpful unix commands