👏

英語でlinux commandメモ

2020/10/04に公開

sleep

Sleep command is used to delay for a fixed amount of time during the execution of any script. When the coder needs to pause the execution of any command for the particular purpose then this command is used with the particular time value.

https://linuxhint.com/sleep_command_linux/

bg

https://www.geeksforgeeks.org/bg-command-in-linux-with-examples/

https://www.geeksforgeeks.org/bg-command-in-linux-with-examples/

top

About Process

-20 ~ 19 (40 level)

the smaller number is the pgreater priority.

there is a higher priority or lower priority.

nice

This article talks about the nice command in Linux. In Linux, each process has a nice value granted to it. This value influences the scheduling of processes and thereby determining the amount of CPU to spent on each one of them. “The more the nice value, the less the supposed priority”. This ultimately means that the more the process is nice, the more it allows other processes to get CPU.

https://www.linuxfordevices.com/tutorials/linux/nice-command-in-linux

nice -n 5 sleep 20

// the new priority will be 5

https://www.tecmint.com/set-linux-process-priority-using-nice-and-renice-commands/

https://www.atmarkit.co.jp/ait/articles/1708/10/news008.html

real time priority

real time priority 1-99というのがある。

https://www.it-swarm-ja.tech/ja/linux/linuxで最も優先度が高いリアルタイムの優先度/942608515/

https://qiita.com/rarul/items/88d3e803d8456f50db01

delayed execution of command

cron demon

crontab is used for manage the task.

These timings decide which program at which time must be started by the cron

at

at command waits its input from the standart input.

cronとatの違い

cron command is used to schedule the task daily at the same
time repeatedly.
"at" command is used to schedule the task only once i.e to
run only one time.

https://www.learnpick.in/questions/details/9017/what-is-difference-between-at-and-cron#:~:text=CRON is for running task,00)%20a%20job%20is%20started.

コマンドを終了させる方法

log off

nohup

no hangup command

Nohup (stands for no hangup) is a command that ignores the HUP signal. You might be wondering what the HUP signal is. It is basically a signal that is delivered to a process when its associated shell is terminated. Usually, when we log out, then all the running programs and processes are hangup or stopped. If we want to continue running the process even after logout or disconnection from the current shell, we can use the nohup command. It makes the processes immune to HUP signals in order to make the program run even after log out. With nohup, you will no longer need to login for a long time just to wait for the process to be completed.

https://linuxhint.com/how_to_use_nohup_linux/

Apostrophes in command line

https://askubuntu.com/questions/229937/meaning-of-apostrophe-in-terminal-commands

入力と出力のRedirection

Redirectionとはなんぞや

Redirection is a feature in Linux such that when executing a command, you can change the standard input/output devices. The basic workflow of any Linux command is that it takes an input and give an output.
The standard input (stdin) device is the keyboard.
The standard output (stdout) device is the screen.

https://www.guru99.com/linux-redirection.html

stdin(0), stdout(1), stderr(2)

stdin, stdout, and stderr are three data streams created when you launch a Linux command. You can use them to tell if your scripts are being piped or redirected. We show you how.

https://www.howtogeek.com/435903/what-are-stdin-stdout-and-stderr-on-linux/

いい加減覚えよう。 command > /dev/null 2>&1の意味

Output Redirectionについて

">" creates a new file with output, and ">>" appends output to the end of the file.

https://www.gnu.org/software/bash/manual/html_node/Redirections.html

"2>": command 2> file1 executes command, directing the standard error stream to file1.
"2>>": file1 executes command, directing the standard error stream to the end of the file1.

Input Redirection

The "< input.txt" part of the command line connects the file input.txt to the program which then uses it as input in place of the keyboard. As with input redirection, this is a feature of the command line interface, not a feature specific to Java.

Notice that all the program's output is sent to the monitor, including the (now useless) prompt.

https://chortle.ccsu.edu/java5/Notes/chap22/ch22_2.html

Filters

A filter takes the standard input, does something useful with it, and then returns it as a standard output

https://www.linux.com/news/pipes-and-filters/

operator symbol: |

ex. word count

tee

The tee command in UNIX is a command line utility for copying standard input to standard output. It supports writing whatever it is given from standard input to standard output and optional writing to one or more files. The command is named after T splitter used in plumbing.

https://shapeshed.com/unix-tee/

https://eng-entrance.com/linux-command-tee

tr

The tr command in UNIX is a command line utility for translating or deleting characters.

https://www.geeksforgeeks.org/tr-command-in-unix-linux-with-examples/

tr (short for translate) is a useful command line utility that translates and/or deletes characters from stdin input, and writes to stdout.

https://www.tecmint.com/tr-command-examples-in-linux/

cut

The cut command in UNIX is a command for cutting out the sections from each line of files and writing the result to standard output.

https://www.geeksforgeeks.org/cut-command-linux-examples/

-cと-fを抑える。

grep

https://www.geeksforgeeks.org/grep-command-in-unixlinux/

egrep

extended grep

fgrep

fixed grep

sort

後で書く

uniq

後で書く

wc

後で書く

Discussion