英語でlinux commandメモ
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.
bg
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.
nice -n 5 sleep 20
// the new priority will be 5
real time priority
real time priority 1-99というのがある。
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.
Apostrophes in command line
入力と出力の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.
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.
いい加減覚えよう。 command > /dev/null 2>&1
の意味
Output Redirectionについて
">" creates a new file with output, and ">>" appends output to the end of the file.
"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.
Filters
A filter takes the standard input, does something useful with it, and then returns it as a standard output
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.
tr
The tr command in UNIX is a command line utility for translating or deleting characters.
tr (short for translate) is a useful command line utility that translates and/or deletes characters from stdin input, and writes to stdout.
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.
-cと-fを抑える。
grep
egrep
extended grep
fgrep
fixed grep
sort
後で書く
uniq
後で書く
wc
後で書く
Discussion