Linux commands for Word Processing
Using the command line, you can perform various tasks on your computer without using a mouse or touch input. With the help of commands, it is convenient not only to navigate through directories, but also to work with text of any size.
less
is a command for viewing long texts that do not fit on one screen. Used if your terminal does not support text scrolling.
head
/tail - commands that show the beginning or end of the file, respectively. With the
-n flag, the specified number of lines will be shown instead of the default 10. A command like
tail -n 3 file.txt
will display the last three lines of the file file.txt.
grep - performs a pattern search in a file. Be sure to require a template. The command
grep hello file.txt will find file in the file. txt all lines containing the pattern "hello" and display them on the screen. Can be used in conjunction with other commands.
sort
– sorts lines of text according to various criteria. By default, the utility sorts strings alphabetically. With the -r
flag, a command like sort -r file.txt
will sort in reverse order: from Z to A.
wc is a utility for counting the number of words, lines, bytes and words in a file. Without flags, the command prints the number of words, lines, and bytes. With the flag
-w
shows the number of words in the object (line or file).
diff
- shows the differences between two files in a line by line comparison. Moreover, only lines in which differences are found are displayed. Changed lines are marked with the symbol "s", deleted - "d", and new ones - "a".