[Schoo] LPIC/LinuC (Level 1) Exam Preparation - 5th and 6th - [Learning Record]

linux

It looks like I'll need to use Linux for work, so I'm really looking forward to it. Progress is slow though...

For now, I would like to finish all of Schoo's LPIC courses (up to the 35th).

 

Contents of Part 5

Redirect/Append/Pipeline

You can overwrite the string in the file with string on the left > file name on the right.
$ echo abcd > output
$ cat output
abcd
By the way, add with >>
$ echo abcdefg >> output
$ cat output
abcd
abcdefg
You can also pass strings in a pipeline and process them in subsequent commands.
grep is a search command.
$ ls | grep a
aaasa
example1
hosts.bak
translate
translate2
uniq-sample

Regular expression

Strings can be expressed abstractly using ^ and $. By combining grep, you can search for complex strings.
$ ls | grep ^a
aaasa
$ ls | grep a$
aaasan

Contents of the 6th session

sort command

Sort strings.
-k option How many fields (if sorted numerically, it is determined only by the first digit)
-n option represents a number
-r option Sort in reverse order

uniq command

Command to eliminate duplicates in a string (consecutive duplicates only)
If you want to remove non-consecutive duplicates, use the sort command and pipeline.

translate command

It is necessary to use the standard output with the cat command. String replacement.

diff command

This command is often used to check the differences between files edited with this command. Are there any mistakes?

comment

Copied title and URL