西维蜀黍

【Linux】命令 - telnet

telnet

  ...


【Linux】操作 - 查看进程的 stdout

Approach 1 - readlink

  • 1: STROUT
  • 2: STRERR

文件描述符 1(STDOUT)/proc/[$PID]/fd/,内核将此文件表示为指向文件描述符(FD)重定向到的文件的符号链接。

$ readlink -f /proc/[pid]/fd/[index]
/tmp/file
  ...


【Linux】命令 - strace

strace

strace is a diagnostic, debugging and instructional userspace utility for Linux. It is used to monitor and tamper with interactions between processes and the Linux kernel, which include system calls, signal deliveries, and changes of process state. The operation of strace is made possible by the kernel feature known as ptrace.

在Linux世界,进程不能直接访问硬件设备,当进程需要访问硬件设备(比如读取磁盘文件,接收网络数据等等)时,必须由用户态模式切换至内核态模式,通过系统调用访问硬件设备。strace可以跟踪到一个进程产生的系统调用,包括参数,返回值,执行消耗的时间。

  ...


【Golang】打印调用栈信息

debug.Stack() - 打印当前 goroutine 的堆栈

package main

import (
	"fmt"
	"runtime/debug"
)

func test1() {
	test2()
}

func test2() {
	test3()
}

func test3() {
	fmt.Printf("%s", debug.Stack())
	//debug.PrintStack() // equivalent to the above
}

func main() {
	test1()
}
  ...


【Linux】Linux Distribution

Debian

Ubuntu - GNOME

Linux Mint

Pop!_OS - GNOME

ElementiryOS

  ...