Go Back   TechArena Community > Software > Operating Systems
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Cat command function on Linux

Operating Systems


Reply
 
Thread Tools Search this Thread
  #1  
Old 26-05-2011
Member
 
Join Date: May 2011
Posts: 377
Cat command function on Linux
  

I was just going through some commands and utilities in Linux study material. I got an sample of cat command which confused me what is the actual work of the same. I tried passing on the command and found nothing out of that. I am doubtful whether the same is useful or not. How to use this one and what are the benefit of the same. Does there can be any kind of system crash due to this if I misconfiguration it. Thanks in advance.

Reply With Quote
  #2  
Old 26-05-2011
mv mv is offline
Member
 
Join Date: May 2008
Posts: 681
Re: Cat command function on Linux

There is a handy utility that allows you to keep short lists, grouping and at the same time, you show a little power of your Red Hat Linux. This utility is called cat, short for concatenate, which means attach files sequentially. But cat can also make a quick demonstration of two important terms: standard input and standard output. The standard input and standard output direct input and output (often referred to as E / S) to the user. If a program reads from standard input, it will by default from the keyboard. If a program writes to standard output, by default it will write to the screen.
Reply With Quote
  #3  
Old 26-05-2011
Member
 
Join Date: Nov 2009
Posts: 787
Re: Cat command function on Linux

Start cat to see its meaning. At the shell prompt, enter: cat. The cursor goes to a blank line. Now enter this: hello world. Then press Enter. Your screen will look as follows: [Newuser @ localhost newuser] $ cat/ hello world / hello world. Then type Cat to exit, simply move the cursor on a blank line by pressing Enter, then press the Ctrl and D together. This is just an basic sample of linux for the cat command.
Reply With Quote
  #4  
Old 26-05-2011
Member
 
Join Date: Apr 2009
Posts: 990
Re: Cat command function on Linux

The cat command lists the contents of zero or more files. The output is sent to standard output. The options allow cat to make it a useful diagnostic tool. The actual syntax to run this command is - cat [options] [files]. When called with no options and no file name, the cat command again to standard output which is typed on standard input. A common mistake is to forget the file name and then you might wonder why the system had crashed.
Reply With Quote
  #5  
Old 26-05-2011
Member
 
Join Date: May 2008
Posts: 2,676
Re: Cat command function on Linux

An interesting use of cat is to list multiple small files on a page. For example, to print the files f1, f2 and f3 on one page, you can use the command : cat f1 f2 f3 | lpr. There is however no indication of where one ends a file and the next begins. You can use - several times on the command line to direct cat to read from standard input. There is a much to be done in this and for an elaborate explanation you will need to refer more web resources.
Reply With Quote
  #6  
Old 27-05-2011
Member
 
Join Date: May 2008
Posts: 1,020
Re: Cat command function on Linux

The command cat will display the contents of an entire file on the screen (for example, type cat filename.txt). If the file is fairly long, it will quickly scroll through the screen altogether. To avoid this, use the command cat filename.txt | less. Using the pipe (|) and the less command together displays the file you page by page. You can then use the arrow keys to move from one page to another. Redirection means causing the shell to change what is considered standard input or the place where it will stop the standard output.
Reply With Quote
Reply

  TechArena Community > Software > Operating Systems
Tags: , , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Cat command function on Linux"
Thread Thread Starter Forum Replies Last Post
Command to set function of HPET & Bcedit in Windows 7 Ankit Pawar Operating Systems 3 19-05-2012 05:36 PM
How to use linux dd command Rubeen Operating Systems 5 02-04-2010 10:59 AM
uname command in linux Linux-Us Operating Systems 4 12-03-2010 10:57 PM
Linux history command and fc command Alkesh jain Operating Systems 3 26-05-2009 07:53 PM
System pause function for linux - Empty Shell - Operating Systems 2 16-05-2009 06:30 PM


All times are GMT +5.5. The time now is 03:43 PM.