Showing posts with label solaris. Show all posts
Showing posts with label solaris. Show all posts

Sunday, May 17, 2020

Let's Learn "cat" the most frequently used Linux command line utilities.

cat is short for concatenate and is one of the most frequently used Linux command line utilities. It is often used to read and print files, as well as for simply viewing file contents. To view a file, use the following command:

1
$ cat <filename>

For example, cat readme.txt will display the contents of readme.txt on the terminal. However, the main purpose of cat is often to combine (concatenate) multiple files together. You can perform the actions listed in the table using cat.

The tac command (cat spelled backwards) prints the lines of a file in reverse order. Each line remains the same, but the order of lines is inverted. The syntax of tac is exactly the same as for cat, as in:

1
2
$ tac file
$ tac file1 file2 > newfile
CommandUsage
cat file1 file2Concatenate multiple files and display the output; i.e. the entire content of the first file is followed by that of the second file
cat file1 file2 > newfileCombine multiple files and save the output into a new file
cat file >> existingfileAppend a file to the end of an existing file
cat > fileAny subsequent lines typed will go into the file, until Ctrl-D is typed
cat >> fileAny subsequent lines are appended to the file, until Ctrl-D is typed






Featured Post

Managing CA Certificates on Red Hat Linux 9: Understanding update-ca-trust extract

  Managing CA Certificates on RHEL9 RHEL8 OracleLinux9 OracleLinux8 In today's digital landscape, securing communications and verifying ...