# diff
example:
# diff <file1> <file2>
# diff -Naur <original> <updated> > patchfile
this command will created a relatively small patch
# patch
example:
# patch <file-need-to-patch> <patchfile>
# cut
example:
# cut -f3 -d: /etc/passwd
# /sbin/ip addr | grep 'inet' | cut -d ' ' -f6 | cut -d / -f1
this command will cut a single piece of information which is IP address from /sbin/ip addr
# head
example
# head /etc/passwd
by default will display first 10 line
# head -n 3 /etc/passwd
will display first 3 line
# tail
example
# tail /etc/passwd
# tail -n 3 /etc/passwd
# tail -f /var/log/messages
this command will keep update the message log until Ctrl + c is pressed
# wc
example
# wc <file>
to count number of lines, words, bytes or character in a file
# sort
sort line
# uniq
remove duplicate line from file
# tr
# tr 'A-Z' 'a-z'
change the upper to smaller and wise visa
No comments:
Post a Comment