<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="https://script.spoken-tutorial.org/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://script.spoken-tutorial.org/index.php?action=history&amp;feed=atom&amp;title=Linux%2FC2%2FWorking-with-Regular-Files%2FEnglish</id>
		<title>Linux/C2/Working-with-Regular-Files/English - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://script.spoken-tutorial.org/index.php?action=history&amp;feed=atom&amp;title=Linux%2FC2%2FWorking-with-Regular-Files%2FEnglish"/>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php?title=Linux/C2/Working-with-Regular-Files/English&amp;action=history"/>
		<updated>2026-04-04T05:26:21Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.23.17</generator>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php?title=Linux/C2/Working-with-Regular-Files/English&amp;diff=11357&amp;oldid=prev</id>
		<title>PoojaMoolya at 07:16, 17 June 2014</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php?title=Linux/C2/Working-with-Regular-Files/English&amp;diff=11357&amp;oldid=prev"/>
				<updated>2014-06-17T07:16:23Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 07:16, 17 June 2014&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 9:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 9:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{| style=&amp;quot;border-spacing:0;&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{| style=&amp;quot;border-spacing:0;&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;| style=&amp;quot;border-top:0.035cm solid #000000;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| &amp;lt;center&amp;gt;'''Visual &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Clue&lt;/del&gt;'''&amp;lt;/center&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;| style=&amp;quot;border-top:0.035cm solid #000000;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| &amp;lt;center&amp;gt;'''Visual &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Cue&lt;/ins&gt;'''&amp;lt;/center&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;| style=&amp;quot;border:0.035cm solid #000000;padding:0.097cm;&amp;quot;| &amp;lt;center&amp;gt;'''Narration'''&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;| style=&amp;quot;border:0.035cm solid #000000;padding:0.097cm;&amp;quot;| &amp;lt;center&amp;gt;'''Narration'''&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>PoojaMoolya</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php?title=Linux/C2/Working-with-Regular-Files/English&amp;diff=201&amp;oldid=prev</id>
		<title>Chandrika: Created page with ''''Title of script''':''' Working with regular files in Linux'''  '''Author: Anirban Roy Choudhury'''  '''Keywords: Files,directories,copy, move, remove,compare'''   Presentation…'</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php?title=Linux/C2/Working-with-Regular-Files/English&amp;diff=201&amp;oldid=prev"/>
				<updated>2012-11-27T12:30:59Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;#039;&amp;#039;&amp;#039;&amp;#039;Title of script&amp;#039;&amp;#039;&amp;#039;:&amp;#039;&amp;#039;&amp;#039; Working with regular files in Linux&amp;#039;&amp;#039;&amp;#039;  &amp;#039;&amp;#039;&amp;#039;Author: Anirban Roy Choudhury&amp;#039;&amp;#039;&amp;#039;  &amp;#039;&amp;#039;&amp;#039;Keywords: Files,directories,copy, move, remove,compare&amp;#039;&amp;#039;&amp;#039;   Presentation…&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;'''Title of script''':''' Working with regular files in Linux'''&lt;br /&gt;
&lt;br /&gt;
'''Author: Anirban Roy Choudhury'''&lt;br /&gt;
&lt;br /&gt;
'''Keywords: Files,directories,copy, move, remove,compare'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Presentation and Attachments: [[File:working_with_regular_files_attachment.zip]]&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;border-spacing:0;&amp;quot;&lt;br /&gt;
| style=&amp;quot;border-top:0.035cm solid #000000;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| &amp;lt;center&amp;gt;'''Visual Clue'''&amp;lt;/center&amp;gt;&lt;br /&gt;
| style=&amp;quot;border:0.035cm solid #000000;padding:0.097cm;&amp;quot;| &amp;lt;center&amp;gt;'''Narration'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:none;padding:0.0382in;&amp;quot;| Display Slide 1&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:0.0139in solid #000000;padding:0.0382in;&amp;quot;| Welcome to this spoken tutorial on working with regular files in Linux.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:none;padding:0.0382in;&amp;quot;| Display Slide 2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Hover the mouse over the link&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:0.0139in solid #000000;padding:0.0382in;&amp;quot;| Files and directories together form the Linux File System. In a previous spoken tutorial we have already seen how to work with directories. You can find the tutorial &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
http://spoken-tutorial.org/wiki/index.php/Linux_Spoken_Tutorial/Basic_Level_Tutorial_Set/File_System&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In this tutorial we will see how to handle regular files.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:none;padding:0.0382in;&amp;quot;| Display Slide 3&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Hover the mouse over the link&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:0.0139in solid #000000;padding:0.0382in;&amp;quot;| We have already seen in another tutorial how we can create a file using cat command. For details see &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
http://spoken-tutorial.org/wiki/index.php/Linux_Spoken_Tutorial/Basic_Level_Tutorial_Set/General_Purpose_Utilities_in_Linux.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:none;padding:0.0382in;&amp;quot;| Display Slide 4&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:0.0139in solid #000000;padding:0.0382in;&amp;quot;| Let us see how to copy a file from one place to another. For this we have the cp command.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Let us see how the command is used&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;cp [OPTION]... &amp;lt;/nowiki&amp;gt;SOURCE DEST &lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;cp [OPTION]... SOURCE... DIRECTORY &amp;lt;/nowiki&amp;gt; &lt;br /&gt;
&lt;br /&gt;
it copies SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:none;padding:0.0382in;&amp;quot;| Open a terminal and type&lt;br /&gt;
&lt;br /&gt;
cd /home/anirban/arc/&lt;br /&gt;
&lt;br /&gt;
'''$ cat test1'''&lt;br /&gt;
&lt;br /&gt;
'''$ cp test1 test2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Type&lt;br /&gt;
&lt;br /&gt;
'''$ cat test2'''&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:0.0139in solid #000000;padding:0.0382in;&amp;quot;| Let us see an Eg.&lt;br /&gt;
&lt;br /&gt;
We already have a file named test1 in /home/anirban/arc/&lt;br /&gt;
&lt;br /&gt;
Open a terminal and type&lt;br /&gt;
&lt;br /&gt;
'''$ cat test1'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now type&lt;br /&gt;
&lt;br /&gt;
'''$ cp test1 test2'''&lt;br /&gt;
&lt;br /&gt;
Here the file test1 present in the current directory is copied to another file test2 also in the current directory. If test2 doesn't exist it would be first created and then the content of test1 will be copied to it.&lt;br /&gt;
&lt;br /&gt;
If it exists then it would be silently overwritten.To see type&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''$ cat test2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:none;padding:0.0382in;&amp;quot;| type&lt;br /&gt;
&lt;br /&gt;
'''$ cp /home/anirban/arc/test1 /home/anirban/test2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
type&lt;br /&gt;
&lt;br /&gt;
'''$ ls /home/anirban'''&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:0.0139in solid #000000;padding:0.0382in;&amp;quot;| You can copy files from and to different directories as well.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
type&lt;br /&gt;
&lt;br /&gt;
$ cp /home/anirban/arc/test1 /home/anirban/test2&lt;br /&gt;
&lt;br /&gt;
This will copy the file test1 from /home/anirban/arc/ to /home/anirban with a new name test2&lt;br /&gt;
&lt;br /&gt;
as we can see &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:none;padding:0.0382in;&amp;quot;| Type&lt;br /&gt;
&lt;br /&gt;
'''$ cp /home/anirban/arc/test1 /home/anirban/'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
type&lt;br /&gt;
&lt;br /&gt;
'''$ ls /home/anirban'''&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:0.0139in solid #000000;padding:0.0382in;&amp;quot;| Now if you want the file to have the same name in the destination directory, you may not even mention it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Type '''$ cp /home/anirban/arc/test1 /home/anirban/'''&lt;br /&gt;
&lt;br /&gt;
This will again copy the file test1 present in the /home/anirban/arc/ directory to /home/anirban to a file whose name will also be test1.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:none;padding:0.0382in;&amp;quot;| Type&lt;br /&gt;
&lt;br /&gt;
'''$ cp test1 test2 test3 /home/anirban/testdir '''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
type&lt;br /&gt;
&lt;br /&gt;
'''$ ls /home/anirban/testdir'''&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:0.0139in solid #000000;padding:0.0382in;&amp;quot;| Another instance when we donot need to give the destination file name is when we want to copy multiple files.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Type '''$ cp test1 test2 test3 /home/anirban/testdir '''&lt;br /&gt;
&lt;br /&gt;
This will copy all the three files test1,test2 and test3 to the directory /home/anirban/testdir without changing their names.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:none;padding:0.0382in;&amp;quot;| &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Type $ cd ..'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Type $ cp testdir/ test'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Type $ cp -R testdir/ test '''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Type '''&lt;br /&gt;
&lt;br /&gt;
'''$ ls '''&lt;br /&gt;
&lt;br /&gt;
'''$ ls test'''&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:0.0139in solid #000000;padding:0.0382in;&amp;quot;| There are many options that go with cp. Here we will see only the most important of them. &lt;br /&gt;
&lt;br /&gt;
Among the options -R is a important one. It causes recursive copying of an entire directory structure.&lt;br /&gt;
&lt;br /&gt;
Normally we cannot copy a directory with files directly with cp. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But using the -R option we can.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
One interesting feature is that if test does not exist it would be created as a copy of testdir directory but if test already exists testdir would be created as a subdirectory of test.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:none;padding:0.0382in;&amp;quot;| Display Slide 5&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:0.0139in solid #000000;padding:0.0382in;&amp;quot;| We have seen that if a file is copied to another file that already exists the existing file is overwritten.&lt;br /&gt;
&lt;br /&gt;
Now what if we inadvertently overwrite an important file?&lt;br /&gt;
&lt;br /&gt;
To prevent anything like this to occur, we can use the -b option. This makes a backup of each exiting destination file. &lt;br /&gt;
&lt;br /&gt;
We can also use the -i(interactive)option, this always warns us before overwriting any destination file.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:none;padding:0.0382in;&amp;quot;| Display Slide 6&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:0.0139in solid #000000;padding:0.0382in;&amp;quot;| Now let us see how the mv command works. This is used for moving files. Now how is that useful?&lt;br /&gt;
&lt;br /&gt;
It has two major uses.&lt;br /&gt;
&lt;br /&gt;
Rename a file or directory&lt;br /&gt;
&lt;br /&gt;
Moves a group of files to a different directory. &lt;br /&gt;
&lt;br /&gt;
mv is very similar to cp which we have already seen. So let us quickly see how mv can be used.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:none;padding:0.0382in;&amp;quot;| Open a terminal and&lt;br /&gt;
&lt;br /&gt;
Type''' $ mv test1 test2'''&lt;br /&gt;
&lt;br /&gt;
(Now again create test1)&lt;br /&gt;
&lt;br /&gt;
Type''' $ mv -i test1 test2'''&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:0.0139in solid #000000;padding:0.0382in;&amp;quot;| Open a terminal and type''' $ mv test1 test2'''&lt;br /&gt;
&lt;br /&gt;
This will rename the file named test1 as test2. If test2 already existed then it would be overwritten silently.&lt;br /&gt;
&lt;br /&gt;
Using the -i option will again ask before overwriting an existing file.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:none;padding:0.0382in;&amp;quot;| Type&lt;br /&gt;
&lt;br /&gt;
'''$ mv abc.txt pop.txt push.txt /home/anirban/testdir'''&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:0.0139in solid #000000;padding:0.0382in;&amp;quot;| Like cp we can use mv with multiple files but in that case the destination should be a directory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will move the 3 files named abc, pop and push from the current directory to the directory /home/anirban/testdir&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:none;padding:0.0382in;&amp;quot;| Display Slide 7&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:0.0139in solid #000000;padding:0.0382in;&amp;quot;| The -b or –backup option is present with mv command also and it will backup every file in the destination before it is overwritten.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:none;padding:0.0382in;&amp;quot;| Display Slide 8&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:0.0139in solid #000000;padding:0.0382in;&amp;quot;| The next command we will see is the rm command. This command is used for deleting files.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:none;padding:0.0382in;&amp;quot;| Open a terminal and type&lt;br /&gt;
&lt;br /&gt;
'''$ ls testdir'''&lt;br /&gt;
&lt;br /&gt;
'''$ rm testdir/faq.txt '''&lt;br /&gt;
&lt;br /&gt;
'''$ ls testdir'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''$ ls'''&lt;br /&gt;
&lt;br /&gt;
'''$ rm abc1 abc2'''&lt;br /&gt;
&lt;br /&gt;
'''$ ls'''&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:0.0139in solid #000000;padding:0.0382in;&amp;quot;| Open a terminal and type&lt;br /&gt;
&lt;br /&gt;
$ rm /testdir/faq.txt &lt;br /&gt;
&lt;br /&gt;
This command will remove the faq.txt file from the /testdir directory.&lt;br /&gt;
&lt;br /&gt;
We can use it with multiple files also. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will remove both the files abc1 and abc2&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:none;padding:0.0382in;&amp;quot;| Display Slide 8&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Switch back to terminal&lt;br /&gt;
&lt;br /&gt;
'''$ ls'''&lt;br /&gt;
&lt;br /&gt;
'''$ rm -rf testdir'''&lt;br /&gt;
&lt;br /&gt;
'''$ ls'''&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:0.0139in solid #000000;padding:0.0382in;&amp;quot;| Sometimes a file is write protected,using rm will not delete the file then. In this case we need the -f option which is used to force delete such files.&lt;br /&gt;
&lt;br /&gt;
The other very common option is the -r option. Now where is this useful.&lt;br /&gt;
&lt;br /&gt;
rm command is not normally used for deleting files, for that we have the rmdir command.But rmdir normally deletes a directory when it is empty. What if we want to delete a directory having a number of files and subdirectories inside. We combine the -r and -f option.&lt;br /&gt;
$ rm -rf testdir this will delete the directory testdir along with all its subdirectories and files recursively.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:none;padding:0.0382in;&amp;quot;| Display Slide 9&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:0.0139in solid #000000;padding:0.0382in;&amp;quot;| Sometimes we need to check whether two files are same. If they are same then we may delete one of them. Also we may want to see whether a file has changed since the last version. For these and many other purposes we can use the cmp command.&lt;br /&gt;
&lt;br /&gt;
It compares two files byte by byte.&lt;br /&gt;
&lt;br /&gt;
If two files have exactly same content then there would be no message. Only the prompt will be printed. If there are differences then the location of the first mismatch will be printed on the terminal.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:none;padding:0.0382in;&amp;quot;| '''Type'''&lt;br /&gt;
&lt;br /&gt;
'''cat &amp;gt; sample1''' &lt;br /&gt;
&lt;br /&gt;
This is a Linux file to test the cmp command&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;nowiki&amp;gt;[Ctrl d]&amp;lt;/nowiki&amp;gt;'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Type'''&lt;br /&gt;
&lt;br /&gt;
'''cat &amp;gt; sample3'''&lt;br /&gt;
&lt;br /&gt;
This is a Unix file to test the cmp command&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;nowiki&amp;gt;[Ctrl d]&amp;lt;/nowiki&amp;gt;'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Type'''&lt;br /&gt;
&lt;br /&gt;
'''$ cmp sample1 sample2 '''&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:0.0139in solid #000000;padding:0.0382in;&amp;quot;| Let us open a terminal window and see how cmp works. We make two sample files named sample1 and sample2 using the cat command . &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
One contains the text “This is a Linux file to test the cmp command” &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
while the other contains the text “This is a Unix file to test the cmp command.”&lt;br /&gt;
&lt;br /&gt;
Open the terminal and type&lt;br /&gt;
&lt;br /&gt;
'''$ cmp sample1 sample2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now we apply the cmp command on these two files.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can see how the difference between the first difference between the files is pointed out.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:none;padding:0.0382in;&amp;quot;| '''Type'''&lt;br /&gt;
&lt;br /&gt;
'''$ cat sample3 '''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''$ wc sample3 '''&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:0.0139in solid #000000;padding:0.0382in;&amp;quot;| The next command we will see is the wc command.&lt;br /&gt;
&lt;br /&gt;
This command is used for counting the number of characters, words and lines in a file.&lt;br /&gt;
&lt;br /&gt;
We have created a file named sample3 that contains the following content&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The command points out that the file has 5 lines, 67 words and 381 characters.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:none;padding:0.0382in;&amp;quot;| Display Slide 10&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:0.0139in solid #000000;padding:0.0382in;&amp;quot;| These were some of the commands that help us to work with files. There are many more commands. Moreover each of the command that we saw has many other options. I encourage you to see more about them using the man command.The best way of learning commands is to use them again and again.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This brings me to the end of this tutorial. Spoken Tutorial Project is a part of the Talk to a Teacher project, supported by the National Mission on Education through ICT, MHRD, Government of India. This project is co-ordinated by http://spoken-tutorial.org.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
More information on the same is available at the following link [http://spoken-tutorial.org/NMEICT-Intro http://spoken-tutorial.org/NMEICT-Intro] This is Anirban signing off . Thanks for joining.&lt;br /&gt;
&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Chandrika</name></author>	</entry>

	</feed>