2.9.5. Creating a File¶
Linux for Programmers and Users, Section 3.13.
Files may be created in several ways. The easiest is perhaps with the cat command.
$ cat > myfile
This is an example of how to use the cat command to add
plain text to a file.
<Ctrl-d>
Others ways to create a text file are to use a text editor such as vi or nano. If we are content with an empty file, the touch command also creates a file.
2.9.6. Viewing the Contents of Files¶
Three programs often used to view the contents of files: cat, more, and less. The later two are also refered to as pagers because they display the contents of a long file in a screen-by-screen manner. See also Viewing Contents of Text Files.
-
cat Concatenate FILE(s), or standard input, to standard output.
- SYNOPSIS
- cat [OPTION] [FILE] …
-
-n,--number¶ number all output lines.
-
-s,--squeece-blank¶ never more than one single blank line
-
-t¶ equivalent to -vT
-
-T,--show-tabs¶ display TAB characters as ^I
-
-v,--show-nonprinting¶ use ^ and M- notation, except for TAB to display nonprinting characters