algorithms (22) Design Patterns (20) java (19) linux (14) Snippet (13) service mix (6) soa (4)



Some more linux Commands

file:  give the type of the file , which is determined using the extension of the file.

[trainee@localhost purna]$ file *
as:     directory
f2:     empty
f3:     ASCII text
f4:     ASCII text
f5:     ASCII text


WC: gives the word count in a file or some stream of data.

c=character count

l = line count

L = length of the longest line

w= word count

split:  split a file into many parts , the default is 1000 lines but you can use –l option and specify number of lines.

[trainee@localhost purna]$ split -l 5 f5
[trainee@localhost purna]$ ls
as  f3  f5      g1  xaa  xac  xae  xag  xai
f2  f4  fruits  g2  xab  xad  xaf  xah  xaj

splits f5 file to many files like

xaa  xac  xae  xag  xai
xab  xad  xaf  xah  xaj

cmp:  check if two files are same

when they are equal there is no output

else it looks like this

[trainee@localhost purna]$ cmp xaa xab
xaa xab differ: byte 1, line 1
[trainee@localhost purna]$ cmp -l xaa xab
1  40  61
2  40  70
4  40  61
5  40  71

No comments:

Post a Comment

Search 24 Bytes