Useful commands for Basis Administrators working with Linux.
To send the output of a program by email, use a pipe:
| mailx -s "$(hostname) control_check_ora.log" adminsap@company.example
Find files modified in the last day and format the timestamp:
find /path/to/directory/* -mtime -1 | xargs ls -ldtrh --time-style="+%Y-%m-%d %H:%M:%S"
find /oracle/*/sapdata? | xargs ls -ldtrh --time-style="+%Y-%m-%d %H:%M:%S" | grep sr3.data
nc -zv webserver.local 8080
Output:
Connection to webserver.local 8080 port [tcp/*] succeeded!
Create a 10G file:
dd if=/dev/zero of=/oracle/<SID>/DELETE_IF_NECESSARY.SAP bs=1 count=0 seek=10737418240
Sync remote directories using rsync over SSH instead of SFTP:
rsync -auvz -e "ssh -l root -i <SSH_PRIV_KEY>" <source_server>:/path/to/source/directory /local/target/path
Get all .xml and .xsl files from /usr/sap/<SID>/SUM/abap/doc (root directory only).
From a Linux box, run the following commands to generate the HTML reports:
xsltproc UpgAnalysis.xsl UPGANA.XML > report.html
xsltproc SAPupPhaseList.xsl phaselist.xml > phaselist.html
Check certificate details for a web server:
curl -I https://webserver.company.example -v
Inspect the full certificate chain:
openssl s_client -showcerts -connect api.company.example:443
Note
The commands above connect to the target host on port 443 and display the certificate chain, issuer, validity dates, and TLS session details.