File Manipulation Commands
Unix
File Manipulation Commands:
ls : gives you a list of files and directories
Cat : used to display, append and overwrite files information
Cat file1 → display files information
Cat >> file1 → used to append or add information to the files
Cat > file1 → overwrite or add information to the files
mv : renaming the file
Mv file1 file2 → file1 renamed to file2
cp : copy information from one file to other
cp file3 file7 → copies the information file3 to file7, even the destination file7 does not exist, it creates a file
Cp file3 file1 → copies the information from file3 to file1 if file1 exists, it overwrites information to the file1
rm - removes files or directories
diff : tells difference in order to make files identical
a : add
c : change
d : delete
> → indicates second file
Before options(a,c,d) indiactes line number of file1 and after option indicates file2
Above ex → in order to make test1 and test2 files identical. Need to following operations
1c1
< Andhra Pradesh
---
Tamilnadu
- need to change andhra pradesh value present in file1 with Tamilnadu present in file2
2a3
> Kasmir
- Need to add Kashmir value present in second line to the file1 after second line
nl : displays file information along number of lines
nl file1
touch : creates empty files with 0 size, following ex creates file7
Ex : following example file 8 creates file with specified time(yymmddhhmmss) not with file creation time
Comments
Post a Comment