是否可以追踪我的 shell(bash, fish, zsh)?
Is it possible to trace my shell(bash, fish, zsh)?
我正在使用 运行ning archlinux(具体来说是 arcolinux 发行版),一切都很好,但有一个小问题让我很烦恼,这个问题是每次我打开一个终端时,这个 pops 我们在航站楼顶部
"Linux pengu 5.15.25-1-lts x86_64 未知"
我知道这是一个带有自定义标志的 uname 命令,但是我的 config.fish(我使用 fish shell(我 运行 fish 和 bash i),我知道每次我打开我的鱼 shell 我的 config.fish 运行 中的东西时,我是否遗漏了什么?
这是我的 config.fish:
{
fish_vi_key_bindings
set VIRTUAL_ENV_DISABLE_PROMPT "1"
set -x MANPAGER "sh -c 'col -bx | bat -l man -p'"
## Export variable need for qt-theme
if type "qtile" >> /dev/null 2>&1
set -x QT_QPA_PLATFORMTHEME "qt5ct"
end
# Set settings for https://github.com/franciscolourenco/done
set -U __done_min_cmd_duration 10000
set -U __done_notification_urgency_level low
## Environment setup
# Apply .profile: use this to put fish compatible .profile stuff in
if test -f ~/.fish_profile
source ~/.fish_profile
end
# Add ~/.local/bin to PATH
if test -d ~/.local/bin
if not contains -- ~/.local/bin $PATH
set -p PATH ~/.local/bin
end
end
# Add depot_tools to PATH
if test -d ~/Applications/depot_tools
if not contains -- ~/Applications/depot_tools $PATH
set -p PATH ~/Applications/depot_tools
end
end
set -p PATH ~/.scripts
set -p PATH /home/omar/eclipse/java-2021-12/eclipse
set -p PATH ~/bin
## Starship prompt
if status --is-interactive
source ("/usr/bin/starship" init fish --print-full-init | psub)
end
## Advanced command-not-found hook
#source /usr/share/doc/find-the-command/ftc.fish
## Functions
# Functions needed for !! and !$ https://github.com/oh-my-fish/plugin-bang-bang
function __history_previous_command
switch (commandline -t)
case "!"
commandline -t $history[1]; commandline -f repaint
case "*"
commandline -i !
end
end
function __history_previous_command_arguments
switch (commandline -t)
case "!"
commandline -t ""
commandline -f history-token-search-backward
case "*"
commandline -i '$'
end
end
if [ "$fish_key_bindings" = fish_vi_key_bindings ];
bind -Minsert ! __history_previous_command
bind -Minsert '$' __history_previous_command_arguments
else
bind ! __history_previous_command
bind '$' __history_previous_command_arguments
end
# Fish command history
function history
builtin history --show-time='%F %T '
end
function backup --argument filename
cp $filename $filename.bak
end
# Copy DIR1 DIR2
function copy
set count (count $argv | tr -d \n)
if test "$count" = 2; and test -d "$argv[1]"
set from (echo $argv[1] | trim-right /)
set to (echo $argv[2])
command cp -r $from $to
else
command cp $argv
end
end
## Useful aliases
#Aliases to setbrightness
alias setbright1='xrandr --output HDMI-0 --brightness 1.00' #Sets the brightness to 1.00
alias setbright75='xrandr --output HDMI-0 --brightness 0.75' #Sets the brightness to 0.75
alias setbright50='xrandr --output HDMI-0 --brightness 0.50' #Sets the brightness to 0.50
alias setbright40='xrandr --output HDMI-0 --brightness 0.40' #Sets the brightness to 0.40
alias setbright30='xrandr --output HDMI-0 --brightness 0.30' #Sets the brightness to 0.30
# Replace ls with exa
alias ls='exa -al --color=always --group-directories-first --icons' # preferred listing
alias la='exa -a --color=always --group-directories-first --icons' # all files and dirs
alias ll='exa -l --color=always --group-directories-first --icons' # long format
alias lt='exa -aT --color=always --group-directories-first --icons' # tree listing
alias l.="exa -a | egrep '^\.'" # show only dotfiles
# Aliases for quickly accessing config files(fish, bash, alacritty,etc..)
alias cf='vim ~/.config/fish/config.fish' # for quickly accessing fish config file
alias cb='vim .bashrc' # for quickly accessing bash config file
alias ca='vim ~/.config/alacritty/alacritty.yml' # for quickly acssesing alacritty config file
alias ck='vim ~/.config/kitty/kitty.conf'
alias cw='vim ~/.config/awesome/rc.lua'
# Replace some more things with better alternatives
alias cat='bat --style header --style rules --style snip --style changes --style header'
[ ! -x /usr/bin/yay ] && [ -x /usr/bin/paru ] && alias yay='paru'
#Media player utilities
alias pause='playerctl -p spotify pause'
alias play='playerctl -p spotify play'
# Common use
alias book='/home/omar/.scripts/books.sh'
alias poweroff='systemctl poweroff'
alias reboot='systemctl reboot'
alias grubup="sudo update-grub"
alias fixpacman="sudo rm /var/lib/pacman/db.lck"
alias tarnow='tar -acf '
alias untar='tar -zxvf '
alias wget='wget -c '
alias rmpkg="sudo pacman -Rdd"
alias psmem='ps auxf | sort -nr -k 4'
alias psmem10='ps auxf | sort -nr -k 4 | head -10'
alias upd='/usr/bin/update'
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias .....='cd ../../../..'
alias ......='cd ../../../../..'
alias dir='dir --color=auto'
alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias hw='hwinfo --short' # Hardware Info
alias big="expac -H M '%m\t%n' | sort -h | nl" # Sort installed packages according to size in MB
alias gitpkg='pacman -Q | grep -i "\-git" | wc -l' # List amount of -git packages
# Get fastest mirrors
alias mirror="sudo reflector -f 30 -l 30 --number 10 --verbose --save /etc/pacman.d/mirrorlist"
alias mirrord="sudo reflector --latest 50 --number 20 --sort delay --save /etc/pacman.d/mirrorlist"
alias mirrors="sudo reflector --latest 50 --number 20 --sort score --save /etc/pacman.d/mirrorlist"
alias mirrora="sudo reflector --latest 50 --number 20 --sort age --save /etc/pacman.d/mirrorlist"
# Help people new to Arch
alias apt='man pacman'
alias apt-get='man pacman'
alias please='sudo'
alias tb='nc termbin.com 9999'
# Cleanup orphaned packages
alias cleanup='sudo pacman -Rns (pacman -Qtdq)'
# Get the error messages from journalctl
alias jctl="journalctl -p 3 -xb"
# Recent installed packages
alias rip="expac --timefmt='%Y-%m-%d %T' '%l\t%n %v' | sort | tail -200 | nl"
#Cool terminal stuff(pipes, convo, etc...)
alias pipes='cd pipes.sh;./pipes.sh';cd
## Run paleofetch if session is interactive
#if status --is-interactive
#colorscript random
#end
}
我试图通过在我的鱼上调用 strace 之类的东西来调试问题 shell 但它只是重新启动了我的鱼 shell,我还写了一个小脚本,我做了一个 while 循环并执行此命令:ps -ax | grep 名称;睡眠0.1
这应该给我任何 uname 命令的实例
一遍又一遍地 运行ning 我的鱼 shell 但没有 uname 实例
我真的很困惑
strace
可以使用 -p
:
附加到进程
-p pid trace process with process id PID, may be repeated
这样您就可以附加到您的 运行 进程。
您可能还会觉得有用
-f follow forks
-ff follow forks with output into separate files
如果附加到父进程。
你可以通过设置fish_trace
变量让fish输出它运行的命令。示例:
fish_trace=1 fish
文档中提到了这一点 around debugging fish。
虽然我没有跟踪鱼 shell 系统调用或类似的东西,但我意识到我正在使用 oh-my-fish 插件或框架,并且它正在加载一个显示不需要的消息的主题,感谢您的提示,虽然我至少现在知道如何追踪鱼 shell
我正在使用 运行ning archlinux(具体来说是 arcolinux 发行版),一切都很好,但有一个小问题让我很烦恼,这个问题是每次我打开一个终端时,这个 pops 我们在航站楼顶部
"Linux pengu 5.15.25-1-lts x86_64 未知"
我知道这是一个带有自定义标志的 uname 命令,但是我的 config.fish(我使用 fish shell(我 运行 fish 和 bash i),我知道每次我打开我的鱼 shell 我的 config.fish 运行 中的东西时,我是否遗漏了什么? 这是我的 config.fish:
{
fish_vi_key_bindings
set VIRTUAL_ENV_DISABLE_PROMPT "1"
set -x MANPAGER "sh -c 'col -bx | bat -l man -p'"
## Export variable need for qt-theme
if type "qtile" >> /dev/null 2>&1
set -x QT_QPA_PLATFORMTHEME "qt5ct"
end
# Set settings for https://github.com/franciscolourenco/done
set -U __done_min_cmd_duration 10000
set -U __done_notification_urgency_level low
## Environment setup
# Apply .profile: use this to put fish compatible .profile stuff in
if test -f ~/.fish_profile
source ~/.fish_profile
end
# Add ~/.local/bin to PATH
if test -d ~/.local/bin
if not contains -- ~/.local/bin $PATH
set -p PATH ~/.local/bin
end
end
# Add depot_tools to PATH
if test -d ~/Applications/depot_tools
if not contains -- ~/Applications/depot_tools $PATH
set -p PATH ~/Applications/depot_tools
end
end
set -p PATH ~/.scripts
set -p PATH /home/omar/eclipse/java-2021-12/eclipse
set -p PATH ~/bin
## Starship prompt
if status --is-interactive
source ("/usr/bin/starship" init fish --print-full-init | psub)
end
## Advanced command-not-found hook
#source /usr/share/doc/find-the-command/ftc.fish
## Functions
# Functions needed for !! and !$ https://github.com/oh-my-fish/plugin-bang-bang
function __history_previous_command
switch (commandline -t)
case "!"
commandline -t $history[1]; commandline -f repaint
case "*"
commandline -i !
end
end
function __history_previous_command_arguments
switch (commandline -t)
case "!"
commandline -t ""
commandline -f history-token-search-backward
case "*"
commandline -i '$'
end
end
if [ "$fish_key_bindings" = fish_vi_key_bindings ];
bind -Minsert ! __history_previous_command
bind -Minsert '$' __history_previous_command_arguments
else
bind ! __history_previous_command
bind '$' __history_previous_command_arguments
end
# Fish command history
function history
builtin history --show-time='%F %T '
end
function backup --argument filename
cp $filename $filename.bak
end
# Copy DIR1 DIR2
function copy
set count (count $argv | tr -d \n)
if test "$count" = 2; and test -d "$argv[1]"
set from (echo $argv[1] | trim-right /)
set to (echo $argv[2])
command cp -r $from $to
else
command cp $argv
end
end
## Useful aliases
#Aliases to setbrightness
alias setbright1='xrandr --output HDMI-0 --brightness 1.00' #Sets the brightness to 1.00
alias setbright75='xrandr --output HDMI-0 --brightness 0.75' #Sets the brightness to 0.75
alias setbright50='xrandr --output HDMI-0 --brightness 0.50' #Sets the brightness to 0.50
alias setbright40='xrandr --output HDMI-0 --brightness 0.40' #Sets the brightness to 0.40
alias setbright30='xrandr --output HDMI-0 --brightness 0.30' #Sets the brightness to 0.30
# Replace ls with exa
alias ls='exa -al --color=always --group-directories-first --icons' # preferred listing
alias la='exa -a --color=always --group-directories-first --icons' # all files and dirs
alias ll='exa -l --color=always --group-directories-first --icons' # long format
alias lt='exa -aT --color=always --group-directories-first --icons' # tree listing
alias l.="exa -a | egrep '^\.'" # show only dotfiles
# Aliases for quickly accessing config files(fish, bash, alacritty,etc..)
alias cf='vim ~/.config/fish/config.fish' # for quickly accessing fish config file
alias cb='vim .bashrc' # for quickly accessing bash config file
alias ca='vim ~/.config/alacritty/alacritty.yml' # for quickly acssesing alacritty config file
alias ck='vim ~/.config/kitty/kitty.conf'
alias cw='vim ~/.config/awesome/rc.lua'
# Replace some more things with better alternatives
alias cat='bat --style header --style rules --style snip --style changes --style header'
[ ! -x /usr/bin/yay ] && [ -x /usr/bin/paru ] && alias yay='paru'
#Media player utilities
alias pause='playerctl -p spotify pause'
alias play='playerctl -p spotify play'
# Common use
alias book='/home/omar/.scripts/books.sh'
alias poweroff='systemctl poweroff'
alias reboot='systemctl reboot'
alias grubup="sudo update-grub"
alias fixpacman="sudo rm /var/lib/pacman/db.lck"
alias tarnow='tar -acf '
alias untar='tar -zxvf '
alias wget='wget -c '
alias rmpkg="sudo pacman -Rdd"
alias psmem='ps auxf | sort -nr -k 4'
alias psmem10='ps auxf | sort -nr -k 4 | head -10'
alias upd='/usr/bin/update'
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias .....='cd ../../../..'
alias ......='cd ../../../../..'
alias dir='dir --color=auto'
alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias hw='hwinfo --short' # Hardware Info
alias big="expac -H M '%m\t%n' | sort -h | nl" # Sort installed packages according to size in MB
alias gitpkg='pacman -Q | grep -i "\-git" | wc -l' # List amount of -git packages
# Get fastest mirrors
alias mirror="sudo reflector -f 30 -l 30 --number 10 --verbose --save /etc/pacman.d/mirrorlist"
alias mirrord="sudo reflector --latest 50 --number 20 --sort delay --save /etc/pacman.d/mirrorlist"
alias mirrors="sudo reflector --latest 50 --number 20 --sort score --save /etc/pacman.d/mirrorlist"
alias mirrora="sudo reflector --latest 50 --number 20 --sort age --save /etc/pacman.d/mirrorlist"
# Help people new to Arch
alias apt='man pacman'
alias apt-get='man pacman'
alias please='sudo'
alias tb='nc termbin.com 9999'
# Cleanup orphaned packages
alias cleanup='sudo pacman -Rns (pacman -Qtdq)'
# Get the error messages from journalctl
alias jctl="journalctl -p 3 -xb"
# Recent installed packages
alias rip="expac --timefmt='%Y-%m-%d %T' '%l\t%n %v' | sort | tail -200 | nl"
#Cool terminal stuff(pipes, convo, etc...)
alias pipes='cd pipes.sh;./pipes.sh';cd
## Run paleofetch if session is interactive
#if status --is-interactive
#colorscript random
#end
}
我试图通过在我的鱼上调用 strace 之类的东西来调试问题 shell 但它只是重新启动了我的鱼 shell,我还写了一个小脚本,我做了一个 while 循环并执行此命令:ps -ax | grep 名称;睡眠0.1 这应该给我任何 uname 命令的实例 一遍又一遍地 运行ning 我的鱼 shell 但没有 uname 实例 我真的很困惑
strace
可以使用 -p
:
-p pid trace process with process id PID, may be repeated
这样您就可以附加到您的 运行 进程。
您可能还会觉得有用
-f follow forks
-ff follow forks with output into separate files
如果附加到父进程。
你可以通过设置fish_trace
变量让fish输出它运行的命令。示例:
fish_trace=1 fish
文档中提到了这一点 around debugging fish。
虽然我没有跟踪鱼 shell 系统调用或类似的东西,但我意识到我正在使用 oh-my-fish 插件或框架,并且它正在加载一个显示不需要的消息的主题,感谢您的提示,虽然我至少现在知道如何追踪鱼 shell