首页 > 系统相关 >How to use Linux command to find out the background process All In One

How to use Linux command to find out the background process All In One

时间:2023-05-08 14:57:21浏览次数:47  
标签:bin ps use process sudo How pi pts bash

How to use Linux command to find out the background process All In One

Linux command check background process

jobs

$ jobs
[1]+  运行中               sudo python3 /home/pi/OLED_Stats/stats.py &

bg

$ bg %1

$ pi@raspberrypi:~ $ bg --help
bg: bg [任务声明 ...]
    移动任务至后台。

    将 JOB_SPEC 标识的任务放至后台,就像它们
    是带 `&' 启动的一样。如果 JOB_SPEC 不存在,shell 观念中的
    当前任务将会被使用。

    退出状态:
    返回成功除非任务管理没有启用或者错误发生。
pi@raspberrypi:~ $ 

ps

$ sudo ps -aux | less

$ sudo ps -r
    PID TTY      STAT   TIME COMMAND
  47556 tty1     R+     0:00 top -bn1
  47560 pts/0    R+     0:00 ps -r
$ sudo ps T
    PID TTY      STAT   TIME COMMAND
  35505 pts/0    Ss     0:00 -bash
  35754 pts/0    S      0:00 sudo python3 /home/pi/OLED_Stats/stats.py
  35762 pts/0    S      0:22 python3 /home/pi/OLED_Stats/stats.py
  47945 pts/0    S+     0:00 sudo ps T
  47946 pts/0    R+     0:00 ps T
pi@raspberrypi:~ $ 

https://www.cyberciti.biz/faq/find-out-what-processes-are-running-in-the-background-on-linux/

??? ps

https://unix.stackexchange.com/questions/701938/how-do-i-list-all-background-processes

demos

$ cat .profile 
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.

# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
	. "$HOME/.bashrc"
    fi
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
    PATH="$HOME/.local/bin:$PATH"
fi

echo "每次登录自动执行脚本 ✅"
bash /home/pi/Desktop/ip-program.sh

echo "开启SSD1306 OLED 

标签:bin,ps,use,process,sudo,How,pi,pts,bash
From: https://www.cnblogs.com/xgqfrms/p/17381751.html

相关文章