How to Display the Contents of a File in Unix

Viewing a file in UNIX can help you find and fix errors while also allowing you to see the entire contents at once. UNIX has a few simple commands for viewing a file. Follow the instructions below to display the contents of a file in UNIX.

Things You'll Need

  • Computer
Show More

Instructions

    • 1

      Open your UNIX program and wait for the prompt cursor to appear. There are four different commands that you can use to view a file. Choose the command that works best for your situation.

    • 2

      At the UNIX prompt, type in "cat" followed by the file name you wish to view. If the name of your file is cars, for example, type in "cat cars." Immediately the entire file will scroll on the screen without pausing. This works well for short files that don't scroll off the screen.

    • 3

      At the prompt, type the word "view" followed by the file name to view the file in read-only mode. You cannot edit the file in this mode.

    • 4

      Type the word "more" followed by the file name to view the file page-by-page. The file will pause on every page and will scroll only when you press the "Enter" key. Use the More command to examine a file more thoroughly.

    • 5

      Type the word "less" and follow it by the file name for even greater control in viewing the file. Use the less function when you want to scroll both backwards and fowards within a file. The less function also lets you scroll through a file slowly.

Tips & Warnings

  • Enter all commands in lower case.

Related Searches:

Comments

You May Also Like

  • How to Open a Tar File

    In UNIX and LINUX, TAR refers to the legacy term for tape archiving, or the storage of an entire file system on...

  • How to Look at a Unix File in Hex

    When editing binary data files or executable program files, it is often necessary to use hexadecimal viewer. Standard text editors interpret control...

  • How to Create a Zip File in Unix

    Most Unix systems have historically used GNUzip and compress instead of zip to create compressed file archives. Meanwhile, zip is the most...

  • How to Read PDF Files in Unix

    The Portable Document Format (PDF) is a file format that creates a two dimensional document that has the images, fonts and text...

  • How to Encrypt a File in Unix

    There will be times, as an avid Unix user, that you will want to encrypt a file. A versatile encryption program comes...

  • How to Open a Gz File

    Open a gz file easily by using this step by step guide. This article will show you how to quickly open gz...

  • How to Find Files in Unix

    The Unix find command will locate files and directories with a file system. It can be used in conjunction with other Unix...

  • How to Create a File in Unix

    Creating a file is very easy to do in Unix. Many Unix users make programs that create zero length files on the...

  • How to Compress Files in Unix

    The Unix operating system has multiple commands for file compression. Three of the commands are "compress," "pack" and "gzip." The "compress" and...

  • How to Open a Zip File in Unix

    Opening Zip files in Unix is a multi-step process. Commands entered at the command line in Unix are used to extract zipped...

  • How to Combine PDF Files on Unix

    Unix users typically use the "cat" command to combine two files. However, that will not work with .pdf files. Instead, the open...

  • How to Recover Deleted Files in Unix

    Unix is one of the original computer operating systems, developed in the late 1960s at Bell Labs. There are a number of...

  • How to Transfer Files From Unix to Windows

    Transferring files from Unix to Windows is relatively simple if you have the right software on the Windows system. Unix systems use...

  • How to Extract Zip Files in Unix

    Windows zip files can be extracted in Unix using the unzip command. Unix is a command line based operating system with different...

  • How to View ZIP Files in Unix

    ZIP files are common in the Microsoft Windows world because they provide the ability to compress a number of files into a...

  • How to Find a File Extension in Unix

    All operating systems use file extensions to categorize files based on the types of programs they are used for. For example, in...

  • How to Unzip a ZIP File in Unix

    The ZIP file format is a data compression and archive format. A ZIP file contains one or more files that have been...

Related Ads

Featured