cat
Today We are going to take a look at the cat command and its types.It's a universal command and can be used in many ways.In the first example , you can use it to display the contents of a file.
Example:
cat file01.txt
concatenate
You can also use cat to concatenate multiple files into a single bigger file.Try the commands below one by one
Example:
echo one > part1
echo two > part2
echo three > part3
cat part1 part2 part3
cat all
Here the echo command returns the input given that is one and this command is saved in part 1 file and the same for part2 and part3. This is then concatenated together using cat command and displayed using cat all
Createfiles
The cat command can also be used to create a file and allows you to write until you use ctrl+d which will send an EOF(End Of File) command and save the file.
Example:
cat > file86.txt
Copyfiles
The same cat command can also be used to copy a file.
Example:
cat file86.txt > file95.txt
tac
This is the reverse of the cat display command which will display the contents of the file in reverse order.
Example:
tac file86.txt
Wrapping up
This will be all the commands for today.We will be going more into arguements and control operators next time. Have fun learning
Top comments (0)