The Linux operators and separators commands

0

The Linux operators and separators commands

Semicolon (;):

The semicolon is used to separate two or more commands on a single line. The commands are executed one after the other, regardless of whether the previous command succeeds or fails.

cd Documents; ls -l

Double Ampersand (&&):

The double ampersand is used to execute the second command only if the first command succeeds. If the first command fails, the second command is not executed.

Copy code
cd Documents && ls -l

Double Pipe (||):

The double pipe is used to execute the second command only if the first command fails. If the first command succeeds, the second command is not executed.

cd Documents || ls -l

Ampersand (&):

The ampersand is used to run a command in the background. The command is executed in the background and the shell prompt returns immediately, allowing you to continue using the command line.

sleep 10 &

Pipe (|):

The pipe is used to redirect the output of one command to another command. The output of the first command is sent to the input of the second command.

ls | grep filename

Redirection Operators (<, >, >>):

These operators are used to redirect the input or output of a command to a file. The < operator is used to redirect input from a file, the > operator is used to redirect output to a file (overwriting any existing content), and the >> operator is used to redirect output to a file (appending to any existing content).

command > output.txt
profile
이곳은 Fola Flor 의 메모 창고입니다. 깃허브, 트위터, 기술 블로그 링크가 이 문장 바로 아래에 있습니다.

0개의 댓글