The best UNIX command for files

Unix file commands
Unix file commands

The question I have found in one recent project, that how to get top 2 duplicate records.

Sort file1 |uniqued | head2

What this command does

  • Sorts File
  • Display duplicate records
  • Top 2 duplicate records

The list of total UNIX commands

cat – display or concatenate files

cd – change directory

chmod – change the permissions on a file or directory

compress – compress a file

cp – copy a file

date – display the current date and time

diff – display differences between text files

echo – echo arguments to the standard

output file – determine the type of a file

find – find files of a specified name or type

finger – display information about a user

ftp – file transfer program

grep – searches files for a specified string or expression

kill – kill a process

lpr – print out a file l

s – list names of files in a directory

man – display an on-line manual page

mkdir – make a directory

more – scan through a text file page by page

mv – move or rename files or directories

nice – change the priority at which a job is being run

passwd – change your password ps – list processes

pwd – display the name of your current directory

quota – disk quota and usage

rm – remove files or directories

rmdir – remove a directory

sort – sort and collate lines

talk – talk to another user

wc – display a count of lines, words and characters

Advertisements