Results 1 to 6 of 6

Thread: Cat command function on Linux

  1. #1
    Join Date
    May 2011
    Posts
    379

    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.

  2. #2
    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.

  3. #3
    Join Date
    Nov 2009
    Posts
    792

    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.

  4. #4
    Join Date
    Apr 2009
    Posts
    994

    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.

  5. #5
    Join Date
    May 2008
    Posts
    2,680

    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.

  6. #6
    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.

Similar Threads

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

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,502,726.70225 seconds with 17 queries