Basic Commands Of UNIX – Chapter 1
Lets just discuss about the very basic commands of UNIX.
i will cover this in 3 topics and will keep updating it frequently if i find anything interesting and worth mentioning to add to this page.
Happy learning till then !
Character count in wc command includes spaces, tabs and new line characters.
– Line count only includes the number of lines.
– Word count does not include the spaces, tabs or new line characters.
In Split command, a file gets split by default with 1000 lines each. For eg:
– # Split -252 <filename> command will split the file with 252 lines each.
Csplit command will split the line according to the contents of the file.
– New files created after using csplit command will have default names as xx00, xx01 etc (can be checked using ls –m <filename> command)
To change the prompt while displaying the contents of the file:
– Command used is: # pg –p “end of file — >” line.txt
Cmp command: will compare 2 files and generate first difference between the 2 files in standard output.
Comm command: will compare 2 files stored line by line. It will give 3 column output:
- 1st column: lines unique to first file
- 2nd column: lines unique to second file
- 3rd column: lines common to both the files
1st column will have output from the left with 0 tab. 2nd column will have output printed with 1 tab output difference. 3rd column will have 2 tab output.
Diff command: will compare 2 files line by line and will display the difference in 2 files with lines of difference in standard output, so that the user can make the files similar.
Sdiff command: compare 2 files and displays output in a side by side standard format.
Source: Basics of UNIX by P Sudarshan
Views