TOPIC: COMMAND
Command line file comparison in Windows
20th August 2012While UNIX and Linux both have the diff command for comparing the contents of text files, the Windows counterpart was unknown to me until recently. Its name is fc
, and it looks as if the f is for file and c is for comparison, though I cannot confirm that as of now. The usage of that command is not dissimilar to the way that things work with diff. Here is an example command:
fc file1.txt file2.txt > file3.txt
This compares file1.txt with file2.txt and sends the output to file3.txt. Any differences between the two files being compared appear to be more clearly labelled than in the diff output's < and > labels. That verbosity could have its uses, but the existence of the fc
command is stopping envious glances at the diff one for now, just as findstr
is doing the same in comparison with grep
.
UNIX Process Management
1st June 2007Here are a few UNIX commands that I have recently encountered that help with process management and are particularly useful when jobs are running in the background. Here they are:
nohup
It's short for no hang up and stops termination of a job when a user logs off. Another result is that all console messages being directed to a file called nohup.out
in the directory current to the job being run, or in the user's home directory, where write access to the current working directory is unavailable.
ps
This returns a list of processes, their ID's and their statuses. By default, this is for your own processes, but you can look beyond this with the myriad of options that can be passed. For instance, the -U switch allows you to look at a job for other users while the -f one shows more information than the standard call and this even includes the commands submitted to start the ongoing processes.
kill
The name says it all, and it's far quicker than the rigmarole that you have to endure with the Windows task manager; I wonder if there is a command line approach to process termination on Windows.