Unix File Commands

1) cat

2) cp

3) mv

4) rm

cat command: cat command is used for various purposes.

1) Creating the new file

2) Display content of the file

3) Concatinating more than one file

4) Appending data to the existing file

5) Copying many files in to one single file.


$cat [Filename]

* File name should be upto 255 characters.


1) Creating the new file:

$cat >paypal.txt





2) Dispay data in the file:

$cat < paypal.txt


$cat paypal.txt

* both are same

3) Concatenation of files:

$cat paypal.txt google.txt

* this command displays all the data in two files which are paypal.txt&


4) Copying data from many file to single file:

$cat paypal.txt google.txt >amazon.txt

ls : Used for listing /display all the files in the curreny directory.

cp command: This command used for

1) copy contents from a file to another file(source->destination)

2)copy files from one directory to another directory.


$ cp


$ cp paypal.txt google.txt

mv command:

1) Used for renaming a file(changing name of the file)

2) Renaming a directory

3) Moves files from one directory to another directory


$mv paypal.txt funpal.txt --> renaming a file

$mv chennai hyd --> renaming a directory

$mv google.txt hyd -->here the file google moves to hyd directory

** Note: If we use cp command duplicate files will be crated

If we use mv command file will be moved to target location(no duplicates)

rm command: used for delete/removing a file/directory.


$ rm google.txt --> it delets file directly without confirmation

$ rm -i google.txt -->deletes file with confirmation

$rm -r hyd

* here this commands removes hyd directory eventhou its having sub directories&files.

* But rmdir command removes directory when it should be empty.

* -r is recursive