List files opened by a process

Show all files, sockets and connections that a process has open.

lsof -p <pid>

tool
linux133 commands
tags
linuxdebug

More linux commands

  • watch -n 2 'kubectl get pods -n <ns>'

    Re-run a command every 2 seconds and show the fresh output. Add -d to highlight changes.

  • nohup ./script.sh > /tmp/out.log 2>&1 &

    Run a script that keeps working after you close the terminal (SIGHUP) and write its output to a file.

  • ssh -L 8080:internal-service:80 user@bastion -N -f

    Forward local port 8080 to an internal service through a bastion host and keep the tunnel in the background.

  • tar -xzf archive.tar.gz -C /target/dir/

    Extract a gzipped tar archive into a given directory.

  • openssl rand -base64 32

    Generate 32 bytes from a cryptographically secure source and encode them in base64.

all 133 linux commands