Linux processes, pipelines, and redirects

Source: Internet
Author: User

1.shell has used the fork and exec system calls to execute an external command.

2. In the Linux system, three files are automatically opened by the kernel, stdin, stdout, stderr, respectively.

3. Properties-related commands for the process:

View the properties of a process PS [options]

Monitor the active state of the CPU in real time and control the process top commands interactively

Show usage of physical and swap Partitions free command (not real-time) want to continuously monitor free-s 10

4.kill command:

The KILL command sends a signal to the specified process, and the operating system implements the signal to operate on the specified process.

Kill [-signal_number] Proc-list

Command Kill-l returns the number of all signals and a list of names

The default signal, which represents the terminating process

5. Control of processes and operations:

You need to perform some work on Linux that takes a long time to complete, and when you do it, you want to do some other work, and then you put the command in the background to execute it, by adding & after the command.

A job is a process that does not run in the foreground and is only available on the associated terminal.

Use FG command to transfer background process to foreground execution, FG [%jobid]

Using the BG command bar, the foreground is suspended to the background to continue execution, Bg[%jobid]

Show all pending and background process job numbers using the jobs command, jobs [option] [%jobid]

6.linux Daemon:

Any program that executes in the background can be called a daemon, such as LPD, SMTPD, httpd, inetd

7.linux timed Job scheduling:

The Crond daemon periodically checks to see if there are any jobs to be executed, and executes automatically if there are jobs that need to be executed. The Crond daemon checks to see if there is a crontab file in the/var/spool/cron directory with the same name as the user name, checks the execution time listed in it, and submits the execution command at the appropriate time.
The crontab command is used to create, edit, and delete crontab files, and each user can have a crontab file to hold the dispatch information, run any shell script or command with it, and run it once a time.

crontab [-u user]-E (-l,-r)

Crontab Crontabname

Each entry (line) in the Crontab file represents a specific time to run the job, in the following format:

Minute hour day Month weekday command

The AT command allows the user to submit a job to the Crond daemon to run at a later time.

At-f at.sh 12:30

8. Use the operator in the command line:

Command1;command2--Sequential execution of commands

command1&command2&--Concurrent execution of commands (i.e. each command is executed in the background)

Commond1&&command2--Only the previous command executes successfully and the latter command executes

command1| | Command2--As long as one command succeeds, the subsequent command will not execute.

Command1|command2--connect the standard output of the Command1 to the COMMAND2 standard input

9.linux system startup, shutdown, and process hierarchies:

View the hierarchical relationship of the process, with the PS-EF command and the Pstree command.

Shut down the Linux system with the shutdown or halt command.

10. Input and Output redirection:

Command < filename

Command > FileName-redirect may overwrite the file, with command >> filename to avoid, add the output to the end of the file.

By using file descriptors, standard input and standard output in bash, Poxis shell can be used separately 0<, 1>, 2> operator redirect, grep "Joson" Students 1> output.out 2> OUTP Ut.err

Note: In the parsing of the shell command line, the redirect operation is done in left-to-right order,

Sort 0< students 1> students.sort 2> Students.err

Sort 2>students.err 0< Students 1> students.sort The difference between the two

Cat Ch1 CH2 CH3 1>ch.out.err 2>&1

The cat ch1 CH2 CH3 2> Ch.out.err 1>&2 indicates that both the standard output and the error output are in one file.

Linux processes, pipelines, and redirects

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.