Skip to content
Technology News Information & Jobs

Technology News Information & Jobs

Ubuntu Tutorials, Ubuntu How To , Linux Tips, Tech Jobs

  • Work with US
  • Search Jobs
  • Post a Job
  • Contact Us
  • Ubuntu
    • Ubuntu 18.04
  • Ubuntu 20.04
  • Ubuntu 22.04
  • Themes
  • Linux
  • Laptops
  • Tutorials
  • Job Dashboard
  • Toggle search form
Basic Cat Command Examples In Linux

15 Basic Cat Command Examples In Linux

Posted on March 15, 2023 By admin No Comments on 15 Basic Cat Command Examples In Linux

15 Basic Cat Command Examples In Linux

The cat is short for the “concatenate“ command. It is mostly used in file management tasks like creating single or multiple files, viewing the content of a file, concatenating files, etc.

15 Basic Cat Command Examples In Linux

1. Cat Command To Display The Content Of  A File:

Run the following cat command that displays the contents of a file. In the following command, you can see the content of the file named filename.txt

Cat filename.txt

2. Cat Command To Display The Content Of  Two Files:

Run the following cat command that displays the contents of two files.

cat file1.txt file2.txt

3. Cat Command To Create A New File:

This command creates a new file named “file_name.txt” and allows you to enter text into it.

cat > file_name.txt

Press Ctrl+D to save and exit.

4. Cat Command To Appends The Contents Of One File To Another File:

The following cat command appends the contents of “file_name.txt” to the end of “file2_name.txt”.

cat file_name.txt >> file2_name.txt

5. Cat Command To Display The Contents Of One File That Matches The Search Term:

Run the following cat command to display the contents of “filename.txt” that match the search term “search_term”.

cat filename.txt | grep "search_term"

6. Cat Command To Display The Contents Of File With Line Numbers:

This cat command displays the contents of “filename.txt” with line numbers.

cat -n filename.txt

7. Cat Command To Display The Contents Of the File for nonblank lines.

The following cat command displays the contents of “filename.txt” with line numbers, but only for non-blank lines.

cat -b filename.txt

8. Cat Command To Display The Contents Of File for with multiple blank lines compressed into a single blank line

Run the following cat command in your terminal to display the contents of “filename.txt” with multiple blank lines compressed into a single blank line.

cat -s filename.txt

9. Cat Command To Display The Contents Of File with tabs represented as ^I.

Open your terminal and run the following command to display the contents of “filename.txt” with tabs represented as ^I.

cat -T filename.txt

10. Cat Command To Enter Commands via the terminal to the file

Run the following cat command to enter commands into the terminal that will be processed as if they were entered from a file named “file.txt”.

cat < filename.txt

11. Cat Command To displays the contents of the file with a $ symbol at the end of each line.

Run the following cat command that displays the contents of “filename.txt” with a $ symbol at the end of each line.

READ More Relevant Stuff:  Best Linux Operating Systems For Beginners In 2019

cat -E filename.txt

12. Cat Command To displays the contents of all files in the current directory that start with “file” and end with “.txt”.

Run the following command to display the contents of all files in the current directory that start with “filename” and end with “.txt”.

cat filename*.txt

13. Cat Command To displays the contents of file with non-printable characters represented as ^X.

This following cat command displays the contents of “filename.txt” with non-printable characters represented as ^X.

cat -v filename.txt

14. Cat Command To empties the contents of file.

Run the following cat  command to empty the contents of the file.

cat /dev/null > filename.txt:

15. Cat Command To display the version of the cat command.

The following cat command displays the version of the cat command.

cat --version
How To Ubuntu, Linux, Linux Commands Tags:linux, Linux command

Post navigation

Previous Post: Fedora Linux 38 Beta Released
Next Post: How To Transfer Existing Steam Game From One PC To Another Over A LAN

Related Posts

Parrot 5.0 Security OS Released Parrot 5.0 Security OS Released Linux
How To Install Canon Printer Driver In Ubuntu 22.04 LTS How To Install Canon Printer Driver In Ubuntu 22.04 LTS Linux
Install Build Essential Install Build Essential Tools On Ubuntu 22.04 LTS Install Build Essential Tools On Ubuntu 22.04 LTS Linux
open source audio tool 6+ Open Source Audio Editor In 2019 Linux
Best Linux Operating Systems For Beginners In 2019 Best Linux Operating Systems For Beginners In 2019 Linux
Is This The Best Open Source Network Monitoring Tools For 2019There are number of network monitoring tools available in the marketplace. There are many open source, cross platform and premium tools available these days to ease the work process of network administrator. Is This The Best Open Source Network Monitoring Tools For 2020 Linux

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • How To Enable Hibernate in Ubuntu 22.04 LTS May 20, 2024
  • Popular Ubuntu Games: Top 5 Games To Play March 17, 2024
  • WordPress | Your site doesn’t include support for the “generateblocks/container” block GenerateBlocks Plugin February 11, 2024
  • Ubuntu Autoremove Command Debian Autoremove Command February 10, 2024
  • How To Mount Windows 11 Shares on Debian Linux December 7, 2023
  • Anonymous Browsing 101: A Deep Dive Into Residential Proxies November 20, 2023
  • How To Correctly Install Uninstall Linux Ubuntu Nvidia Drivers Fast October 31, 2023
  • Ethical Web Design: The Dos and Don’ts October 28, 2023
  • Understanding the Role of Security Operations Center October 25, 2023
  • The Positive Effects of AI Tools and Online Services on Students Successful Essay-Writing Skills October 3, 2023
  • Linux Wget Examples September 27, 2023

Categories

  • Android
  • Apple
  • Blogs
  • Debian
  • Fix
  • Gadgets
  • Game
  • Google
  • How To Ubuntu
  • Internet
  • Laptops
  • Linux
  • Linux Commands
  • Linux Game
  • Linux Mint
  • News
  • Operating Systems
  • Security
  • Technology
  • Themes
  • Tools
  • Tutorials
  • Ubuntu
  • ubuntu 18.04
  • Ubuntu 20.04
  • Ubuntu 22.04
  • Windows 11
  • Wordpress
  • Search Jobs
  • Post a Job
  • Job Dashboard
  • Contact Us
  • About US
  • Cookie Policy
  • Terms and Conditions
  • Privacy Policy
  • Sitemap
  • Write For US

Tags

android apps centos ChatGPT command Commands Debian deepin Desktop docker Fedora fix game games Gaming gnome google kernel linux linux commands linux kernel Linux laptops Linux Mint Linux themes minecraft NVIDIA Python Raspberry Pi sysadmin themes ubuntu ubuntu 18.04 Ubuntu 18.04 LTS Ubuntu 20.04 ubuntu 20.04 lts Ubuntu 22.04 LTS Ubuntu games Ubuntu kernel ubuntu themes ubuntu tutorial VirtualBox Windows Windows 11 Wine WSL
itsubuntu.com is an Equal Opportunity Employer. For Advertisement, Jobs, Guest posts, and any other thoughts, email us at [email protected]
  • Technical Writer

    • Oak Ridge, TN
    • ZealoTech People
    • Full Time
  • Technical Writer

    • Erie, PA
    • Akkodis
    • Full Time
  • Senior Data Scientist

    • San Francisco, CA (Remote)
    • Integral Ad Science, Inc.
    • Full Time
  • Secret Cleared Technical Writer

    • Greenville, TX
    • Insight Global
    • Full Time
  • Healthcare Technical Writer

    • Orlando, FL
    • Akkodis
    • Full Time
  • Technical Writer

    • Golden, CO
    • SRS Consulting Inc
    • Full Time
  • Science Research Writer – Department of Developmental Neurobiology (Hiring Immediately)

    • Memphis, TN
    • St. Jude Children's Research Hospital
    • Part Time
  • Contract Technical Writer

    • Owensboro, KY
    • Innovative Staff Solutions
    • Full Time

Copyright © 2025 Technology News Information & Jobs.

Powered by PressBook Grid Blogs theme