some commands for Linux background process management: FG, BG, Jobs, , CTRL + Z commands for everyone to learn referenceFirst, Add to the end of a command, you can put this command in the background execution, such as Gftp Two, CTRL + ZYou can put a command that is being executed in the foreground in the background and is paused, not executableThird, JobsSee how many commands are currently running in the backgroundThe JOBS-L option shows that the pid,
dead process.Last 4 kinds of additional states ....W Status: Memory not residingN Status: Nice greater than 0L Status: Locked pageThis section is described in the PS source code (OUTPUT.C):===================================static intPr_stat (void){int end = 0;outbuf[end++] = pp->state;if (Pp->rss = = 0 pp->state! = ' Z ')outbuf[end++] = ' W ';if (Pp->nice outbuf[end++] = ' if (Pp->nice > 0)outbuf[end++] = ' N ';if (Pp->vm_lock)outbuf[end++] = ' L ';Outbuf[end] = ' + ';return end;}============
FG, BG, Jobs, , CTRL + Z commandsFirst, Add to the end of a command, you can put this command in the background execution, such as Gftp two, CTRL + ZYou can put acommand in the background, and is in a paused state,not enforceableThird, JobsSee how many commands are currently running in the backgroundjobs-lThe Pid,jobs option can show that the status of all tasks can be running, stopped, Terminated, but if the task is terminated (kill), the shell remov
privileged.Sudo!! will run the previous command in the form of sudo. So the last command becomes this:
sudo apt-get install ranger
If you don't know what sudo is, poke it here.3. Pausing and running commands in the backgroundI have written a guide to how to run commands in the terminal background.
CTRL + Z-Pause Application
FG-Re-call the program to the front desk
How do you use this technique?Imagine you are editing a
220.181.57.217:icmp_seq=14 ttl=128 time=92.5 ms-bytes from 220.181.57.217:icmp_seq=15 ttl= 128 time=52.1 ms bytes from 220.181.57.217:icmp_seq=16 ttl=128 time=51.8 Ms ^z [1]+ Stopped Ping baidu.com
The user can use the FG/BG operation to continue the foreground or backstage tasks,FG command to restart the interrupted task of the foreground,
[root@localhost ~]# FG
component. Here's an example of building a ListBox component and populating it in the root window:
From Tkinter import *
root = Tk ()
listbox = ListBox (Root)
listbox.pack (Fill=both, expand=true)
# The fill option is to populate the entire parent component, and the expand option is still filled with the for
I in range when stretched:
listbox.insert (end, str (i))
Mainloop ()
Where the Fill option tells the window manager that the component will populate the entire space allocated to i
First, the background process Management commandFG, BG, Jobs, , CTRL + Z, CTRL + C, CTRL + \, CTRL + D1. Add to the end of a command, you can put this command in the background to perform, such as Firefox 2, CTRL + ZYou can put a command that is being executed in the foreground in the background and is paused, not executable3. JobsSee how many commands are currently running in the backgroundThe JOBS-L option shows that the pid,jobs status of all tasks can be running, stopped, Terminated, but if
not dispatched unless manually startedZombie State: Zombie, end process, child process does not close before parent process endsLinux system Status viewing and management tools: Pstree, PS, Pidof, Pgrep, Top, htop, glance, Pmap, Vmstat, Dstat, Kill, Pkill, job, BG, FG, NohupHere are a few useful tools to introduce.Pstree shows the left and right processes in a tree-shaped structure, especially when it shows the parent-child relationship between proce
In the server, the program is running in the background, when writing a Python script, you need:If you want Python robot.py is not possible, once the user log out, the script will automatically exit. With at, Cron can be implemented, but I found a command.Nohup, can ignore log out of the signal, now as long asNohup python robot.py Just fine. If you want to record the print in Python, you canNohup python robot.py >/log/log1.logView Python--pid running in the backgroundCommand:ps-ef |grep python
path
[Email Protected]~]echo $HISTFILE
/root/.bash_history
Histfilesize viewing the number of files stored
[Email Protected]~]echo $HISTFILESIZE
1000
Histsize the number of history commands saved under the current shell
[Email Protected]~]echo $HISTSIZE
1000
15.FC lists the most recently executed commands after logging in to the host
[[emailprotected]~]fc-l
Span style= "FONT-SIZE:16PX;" > #显示登录后最近执行过的命令
[[emailprotected]~]fc-ln
#不显示命令的编号
Linux front and back process switchingWhen you start a program with the shell, he often works in the foreground. For example, often with putty connection to the remote server to execute the script, if the local network is interrupted, this time the foreground process is over, the comparison of annoyance, must be re-executed. It is therefore necessary to switch between the front and back processes.For example, to enter Firefox directly in the terminal, it will open Firefox, but when you close thi
operation. If you do not pass in chars, the space is removed by default. Example:>>> s = " hello world ">>> s.strip()‘hello world‘>>>S. partition (seq)The inverse value is a tuple of three elements, the first representing the string preceding the SEQ sequence, the second representing the SEQ sequence, and the third representing the remaining string. If the SEQ is not found in S, the return (s, ‘‘, ‘‘)S.replace (old, new[, Count])Returns a copy of S that replaces old with new, and the optio
A Kahn Process Network was implemented with Pytho:Ideas:Use the Python list to simulate the queue.One queue per channelUse a list (Fglog) to record all push-to-FG channel values for the final displayThe channel's queue is set to a global variableCode implementation:h1f=[];fg=[];gh1=[];gh0=[];h0f=[]fglog=[]h1firstrun=Trueh0firstrun=Trueflastchoose=0gLastChoose=0defH1 ():GlobalH1firstrunifH1firstrun:h1firstru
There are two ways of doing this:1. Command : Background run, you shut down the terminal will stop running2. Nohup Command : Run in the background, you will continue to run the terminalFirst, IntroductionLinux/unix The biggest advantage that distinguishes Microsoft platform is the real multi-user, multi-tasking. Therefore, in the task management also has the characteristic management thought. we know that in Windows above, we either have a program running in the background as a service, or stop
that contains student and student with one character behind itgrep ' student. '/etc/passwd (patterns can be quoted in single and double quotes, and double-cited if the variable is to be substituted in the pattern)[]: matches any single character in the specified range [abc],[a-z],[0-9],[a-za-z]FG: Finding rows with numbersgrep ' [0-9] '/etc/passwd[^]: matches any single character outside the specified rangeFG: Finds lines that do not have lowercase l
First, Add to the end of a command, you can put this command in the background execution, such as Gftp Two, CTRL + ZYou can put a command that is being executed in the foreground in the background and is paused, not executableThird, JobsSee how many commands are currently running in the backgroundThe JOBS-L option shows that the pid,jobs status of all tasks can be running, stopped, Terminated, but if the task is terminated (kill), the shell removes the process identity of the task from the list
than on the screen. The command to enter the redirect is 6) Pipe characterThe pipe symbol "|" has been mentioned before, which is the result of running the previous command to the following command.7) Operation control.When you run a process, you can pause it (press CTRL + Z), then use the FG command to restore it, use the BG command to get him to run in the background, or you can make it stop (press CTRL + C)." variables "In the previous section, I
redirection is, the command for the output redirection is, the error redirect 2>, and the Append redirection >>, which will be described in more detail later.
6) Pipe character
The pipe character "|" has been mentioned earlier, leaving the result of the previous command running to the following command.
7) Operation control.
When you run a process, you can pause it (press ctrl+z), and then use the FG command to restore it, using the BG command to
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.