Files : -
Part – 1: - (Creating File)
Q) How to create a file ?
Ans - $ cat > <FileName><Enter – Key>
<Enter contents you want to enter in the file>
<Enter contents you want to enter in the file><Enter
– Key>
<Ctrl>Key + d - letter key
Where > is called “Single Redirection Operator”
$
Q) How to create a zero byte file ?
Ans - $ touch <File_Name>
Example - $ touch f1
Q) How to create multiple zero byte files ?
$ touch <1st File Name> <2nd
File Name> <3rd File Name><Enter – key>
Example - $ touch f1 f2 f3 f4
Q) How to add some content in file f1 ?
Ans - $ cat >> f1<Enter – Key>
<Contents to be added in this file>
<Contents to be added in this file><Enter – Key>
<Ctrl>Key + d – letter key
$
Q) How to append or add content of file f2 in file f1 ?
Ans - $ cat f2 >> f1<Enter – Key>
Where >> is called "Double Redirection Operator”
Q) How to create a file f1 with the content of files f2 and
f3 ?
Ans - $ cat f2 f3 > f1<Enter – Key>
Q) How to add the content of files f2 and f3 in the end of
content of file f1 ?
Ans - $ cat f2 f3 >> f1<Enter – Key>
Part – 2 (Removing Files)
Q) How to remove a file ?
Ans - $ rm <File Name><Enter – Key>
Q) How to remove a file forcefully ?
Ans - $ rm –f <File Name><Enter – Key>
Where f - forcefully
Q) How to delete a file with asking confirmation about
deletion ?
Ans - $ rm –i <File Name><Enter – Key>
Where i – interactively
No comments:
Post a Comment