Steps to Install Strace Process Monitoring Tool on Ubuntu 20.04 LTS

Strace is a free & open source process monitoring tool for linux system. It helps in troubleshooting issues, & used for Debugging, Intercept System calls, Record system calls, & Signals received by a process, & Trace running processes purposes.

There are few steps to install Strace on ubuntu:

Step 1: Update the System.

apt-get update

Step 2: Install the Strace on system.

apt install strace

  • Check the Strace version.

strace -V

  • Here is the command output.

Step 3: Strace Syntax & Examples:

  • Get the system call,argument & result of the call.

strace ls

  • Here is the command output.

  • Run the following command for Count number of system calls.

strace -c ls

  • Here is the command output.

  • Trace specific system calls.

strace -e trace=write ls

  • Here is the command output.

strace -e trace=read ls

  • Here is the command output.

  • Trace network related system calls.

strace -e trace=network nc -v -n 127.0.0.1 22

  • Here is the command output.

  • Trace signal related system calls.

strace -e trace=signal nc -v -n 127.0.0.1 22

  • Here is the command output.

  • Print timestamp of each call.

strace -r ls

  • Here is the command output.

  • Display time spent on system calls.

strace -T ls

  • Here is the command output.

  • Display wall clock time of each system call.

strace -t ls

  • Here is the command output.

  • Display instruction pointer..

strace -i ls

  • Here is the command output.

  • To Store output to a file.

strace -o output.txt ls

  • Here is the command output.

 

Leave a Reply