Most SAP systems built today run on Linux — SUSE or Red Hat under S/4HANA — which means Basis work increasingly starts at the OS prompt, not inside SAPGUI. These twenty commands cover the five things you'll reach for daily: watching the system, controlling the SAP instance, reading logs, moving files, and checking connectivity.
System and process monitoring
ps -ef | grep <sid>adm— confirm which SAP work processes are actually running under the instance owner.top— live CPU and memory by process; the first stop when a system "feels slow."free -h— memory and swap in human-readable units; check swap usage before blaming the application.df -h— filesystem usage by mount point; the classic cause of a stuck archive or spool is a full filesystem.du -sh *— size up a directory's contents whendfsays a filesystem is full but you don't know what's eating it.
Controlling the SAP instance from the OS
su - <sid>adm— switch to the SAP administrator user with its full environment loaded.sapcontrol -nr <NN> -function GetProcessList— the OS-level equivalent of SM51, useful when SAPGUI itself won't connect.startsap/stopsap— start or stop the instance cleanly instead of killing processes by hand.
Reading logs without opening SAPGUI
tail -f dev_w0— follow a work process trace live while reproducing an issue.grep -i error dev_w*— scan every work process trace for errors in one pass.less— page through a large trace or log file without loading the whole thing into an editor.zgrep/zcat— search or view rotated, gzip-compressed logs without decompressing them first.
Finding and moving files
Full walkthroughs of these two live on this blog already — command reference here, details in the linked posts.
find /usr/sap/<SID> -name "*.trc" -mtime +30— locate trace files older than 30 days before a cleanup. See The Linux find Command.tar --list --verbose --file archive.tar.gz— inspect an archive's contents before extracting it. See The TAR command | Bash Basics.scp file.tar.gz user@host:/path/— copy a file securely between SAP hosts.
Networking and connectivity checks
ping <host>— confirm basic reachability before chasing an RFC error.telnet <host> <port>(ornc -zv <host> <port>) — check whether a specific port is actually open; this catches firewall issues telnet-to-host alone misses.ss -tulpn— list listening ports and the process holding each one; the modern replacement fornetstat.
Editors, permissions, and the rest
vi/vim— unavoidable for editing config on a server with no GUI. See VI Shortcuts & Commands For Newbies and How to Exit From VIM (VI)? if:wqisn't yet muscle memory.sudo <command>— run a single command with elevated rights without logging in as root. See Linux Commands For Beginners: SUDO.chmod/chown— fix file permission and ownership issues, a common cause of a work process failing to write its own trace file.crontab -l— check what's scheduled on the OS level, separate from SAP's own job scheduler.
Quick reference
| Command | Use it for |
|---|---|
| ps -ef | grep sidadm | Confirm SAP work processes are running |
| top / free -h | CPU, memory, swap at a glance |
| df -h / du -sh | Filesystem space and what's using it |
| sapcontrol -function GetProcessList | SM51 from the OS prompt |
| tail -f / grep / less / zgrep | Reading and searching logs |
| find / tar / scp | Locating, archiving, and moving files |
| ping / nc -zv / ss -tulpn | Connectivity and port checks |
| vi / sudo / chmod / chown | Editing config and fixing permissions |
FAQ
Do SAP Basis administrators need to know Linux?
Yes — most current SAP installations, especially S/4HANA, run on SUSE or Red Hat Enterprise Linux. SAPGUI covers application-level administration, but instance control, log review, and OS-level troubleshooting all happen at the Linux command line.
What command switches to the SAP administrator user?
su - <sid>adm switches to the SAP system's administrator account with its environment (paths, SAP-specific variables) loaded, which plain su <sid>adm without the dash does not do.
How do I check if SAP work processes are running from the OS?
Run ps -ef | grep <sid>adm to see the raw OS processes, or sapcontrol -nr <NN> -function GetProcessList for the same view SM51 shows inside SAPGUI.
No comments:
Post a Comment