Question

fc command

Asked by: t_kaur

plz. tell me the functionality of fc command?

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2003-01-28 at 22:36:59ID20486754
Tags

command

Topic

Operating Systems Miscellaneous

Participating Experts
4
Points
20
Comments
4

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Help needed with the "fc" command
    Hello, Can someone explain how to use the “fc” command in DOS to compare two files? My aim is to determine whether two files are truly identical, i.e. to verify whether or not one of the copies has been corrupted or has minor errors. I have wiindows XP. The “fc help” instru...
  2. FC-to-SATA disk array performance throughput with mult…
    We're building a SAN with SATA disks (disk arrays have FC interface, disks inside it at SATA). Some SATA disk array vendors claim performance of 150MB/sec (sequential reads from RAID50, I guess) but we observe it to be much smaller (at best half that number). 1. Performance ...
  3. FC 5 - Access SMB folder on Desktop using command pr…
    I am using Windows XP and I am running Fedora Core 5 within VMWare 5.0. I have created a shared folder in Windows, and in the Fedora Core 5 I chooose Click on File>Connect To Server and I choose Service Type as "Windows Share", and filled in other configuration....
  4. How do I Move a Dell EMC FC 4500 San to a different se…
    I Have a Dell FC 4500 San and it looks as if we might have bought it second hand off of Noah, Its old and Massive and a waste of rack space, but I still have some respect for it and I would like to keep it running just for the IT Departments storage. What I do want to get rid...
  5. FC HBA IO bandwidth
    Hello Experts Can you guide how to calculate, for a FC 4GB PCI-X 2.0 Single Channel Port HBA with 8 of 73GB 15K RAID 10 disks, how can we calculate the maximum transfer rate attainable, read and write? If more similar HBAs are added, will the transfer rate be proportional? (...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: cempashaPosted on 2003-01-28 at 23:00:40ID: 7835642

FC or file compare is used to compare two files against each other. Once completed FC will return lines which differ between the two files. If no lines differ you will receive a message indicating no differences encountered.


you can view all the commands by typing

fc /?
on the dos command.

SYNTAX

Compares two files or sets of files and displays the differences between them.

FC [/A] [/C] [/L] [/LBn] [/N] [/T] [/W] [/nnnn] [drive1:][path1]filename1 [drive2:][path2]filename2

FC /B [drive1:][path1]filename1 [drive2:][path2]filename2

/A  Displays only first and last lines for each set of differences.
/B Performs a binary comparison.
/C Disregards the case of letters.
/L Compares files as ASCII text.
/LBn Sets the maximum consecutive mismatches to the specified number of lines.
/N Displays the line numbers on an ASCII comparison.
/T Does not expand tabs to spaces.
/W Compresses white space (tabs and spaces) for comparison.
/nnnn Specifies the number of consecutive lines that must match after a mismatch.

EXAMPLES

fc c:\autoexec.bat c:\config.sys = This would give you a listing on the config.sys and the autoexec.bat.
fc c:\autoexec.bat c:\config.sys /b = Giving you the files in binary and then listing which file is longer.

hope this helps

 

by: ShadowWarrior111Posted on 2003-01-29 at 00:10:49ID: 7835910

Btw, there is also fc command in solaris by the name fc. Fc in unix is used to list or edits and reexecutes command previously entered to an interactive sh.
For more info, type man fc

 

by: ranjan01Posted on 2003-01-29 at 02:52:03ID: 7836597

HI

PLEASE FOLLOW THIS PROCEDURE CARFULLY
To edit a previous command line use the shell command fc (fix command) command.

   fc -e editor -lnr first last

This will open the commands from the history list as specified in the range first to last. When you exit from the editor the command(s) will be run.



fc [ -r ] [ -e Editor ] [ First [ Last ] ]


To Generate a Listing of Previously Entered Commands
fc -l [ -n ] [ -r ] [ First [ Last ] ]


To Reexecute a Previously Entered Command
fc -s [ Old=New ] [ First ]


Description
The fc command displays the contents of your command history file or invokes an editor to modify and reexecutes commands previously entered in the shell.

The command history file lists commands by number. The first number in the list is selected arbitrarily. The relationship of a number to its command does not change except when the user logs in and no other process is accessing the list. In that case, the system resets the numbering to start the oldest retained command at 1.

If the numbers in the command history file reach a limit greater than the value of the HISTSIZE environment variable or 32767, whichever is greater, the shell wraps to 1. Despite this optional number wrapping, the fc command maintains the time-ordering sequence of the commands. For example, if three commands in sequence are given the numbers 32766, 32767, and 1 (wrapped), command 32767 is still considered previous to command 1.

The commands in the history file can be displayed using the -l (lowercase L) flag. When the -l flag is not specified and commands are edited using the -e Editor flag, the resulting lines are entered at the end of the history file and then reexecuted by the shell (the fc -e Editor command is not entered into the command history list). If the editor returns a non-zero exit status, this suppresses entry in the history file and command reexecution.

Any command-line variable assignments or redirection operators used with the fc command again invoke the previous command, suppressing standard error for both the fc command and the previous command. For example:

fc -s -- -1 2>/dev/null
Flags
-e Editor Edits commands using the specified editor. The Editor parameter should be a command name. The command is located using the PATH environment variable. The value in the FCEDIT environment variable is used as a default when the -e flag is not specified. If the FCEDIT environment variable is null or unset, the ed editor is used.
-l (lowercase L) Lists the commands in your history file. No editor is invoked to modify them. The commands are written in the sequence indicated by the First and Last parameters, as affected by the -r flag, with each command preceded by the command number.
-n Suppresses command numbers when used with the -l flag.
-r Reverses the order of the commands listed (when used with the -l flag) or reverses the order of the commands edited (when the -l flag is not specified).
-s Reexecutes a command without invoking an editor. If the First parameter is not also specified, the -s flag reexecutes the previous command.

Parameters
First or Last Selects the commands to list or edit. The number of previous commands that can be accessed is determined by the value of the HISTSIZE environment variable. The First and Last parameters must have one of the following values: [+] Number Represents a specific command number. Command numbers can be displayed with the -l flag. A + (plus sign) is the default.
-Number Represents a command that was previously executed, specified by the number of commands to back up in the history list. For example, -1 indicates the immediately previous command.
String Indicates the most recently entered command that begins with the specified string. If the Old=New parameter is specified without the -s flag, the string from the First parameter cannot contain an embedded = (equal sign).

When using the -s flag, omission of the First parameter causes the previous command to be used.
 

When the -s flag is not specified, the following rules apply:

When using the -l flag, omission of the Last parameter causes a default to the previous command.
When using the -r, -n, and -e flags, omission of the Last parameter causes a default to the First parameter.
If both the First and Last parameters are omitted, the previous 16 commands are listed or the previous single command is edited (depending on whether or not the -l flag is used).
If both the First and Last parameters are present, all commands are listed (when the -l flag is specified ) or edited (when the -l flag is not specified). Editing multiple commands is accomplished by presenting to the editor all the commands at one time, each command starting on a new line. If the First parameter represents a newer command than the Last parameter, the commands are listed or edited in reverse sequence. This is equivalent to using the -r flag. For example, the following commands on the first line are equivalent to the corresponding commands on the second line:
fc  -r  10  20           fc      30  40
fc      20  10           fc  -r  40  30
When a range of commands is used, it is not an error to specify First or Last values that are not in the history list. The fc command substitutes the value representing the oldest or newest command in the list, as appropriate. For example, if there are only ten commands in the history list, numbered 1 to 10, the commands:
fc  -l
fc  1   99
list and edit, respectively, all ten commands.
Old=New In commands to be reexecuted, replaces the fist occurrence of the old string with the new string.

Environment Variables
The following environment variables affect the execution of the fc command:

FCEDIT When expanded by the shell, determines the default value for the -e editor variable. If the FCEDIT environment variable is null or is not set, the ed editor is the default.
HISTFILE Determines the path name of the command history file. If the HISTFILE environment variable is not set, the shell may attempt to access or create the .sh_history file in the user's home directory.
HISTSIZE Determines a decimal number representing the limit to the number of previous commands that are accessible. If this variable is not set, a default value of128 is used.

Exit Status
The following exit values are returned:

0 Successful completion of the listing.
>0 An error occurred.

Otherwise, the exit status is that of the commands executed by the fc command.

Examples
To invoke the editor defined by the FCEDIT environment variable on the most recent command (the default editor is /usr/bin/ed), enter:
fc
The command is executed when you finish editing.
To list the previous two commands that were executed, enter:
fc -l -2
To find the command that starts with cc , change foo to bar , and display and execute the command, enter:
fc -s foo=bar cc
Files
/usr/bin/ksh Contains the Korn shell fc built-in command.
/usr/bin/fc Contains the fc command.

 

by: RenotsPosted on 2003-07-19 at 19:57:12ID: 8960436

t_kaur,

No comment has been added lately (171 days), so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question
is:

to be PAQ'd, with points forfeited.

Please leave any comments here within the next SEVEN days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Renots
EE Cleanup Volunteer

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...