Lab 3
Lab 3
Lab-03
Lab Instructor:
Student Name
Student Roll #
Department
Year/Section
LAB 02 (Manipulating Files and directories)
Manipulating Files
This lesson will introduce you to the following commands:
CNTRL + ALT + T (to open terminal of Ubuntu)
[!characters] Matches any character that is not a member of the set characters
Using wildcards, it is possible to construct very sophisticated selection criteria for filenames.
Here are some examples of patterns and what they match:
You can use wildcards with any command that accepts filename arguments.
cp -i file1 Like above however, since the "-i" (interactive) option is specified, if file2 exists,
file2 the user is prompted before it is overwritten with the contents of file1.
cp file1 dir1 Copy the contents of file1 (into a file named file1) inside of directory dir1.
cp -R dir1 Copy the contents of the directory dir1. If directory dir2 does not exist, it is
dir2 created. Otherwise, it creates a directory named dir1 within directory dir2.
mv
The mv command moves or renames files and directories depending on how it is used. It will
either move one or more files to a different directory, or it will rename a file or directory.
rm
The rm command removes (deletes) files and directories.
touch
Changes file timestamps. It is also an easy way to create empty files. The touch command is
the easiest way to create new, empty files. It is also used to change the timestamps (i.e., dates
and times of the most recent access and modification) on existing files and directories.
man touch:
touch file_name(s).
Cat command:
Cat command is used to create, display and combine two files.
Assignment No 5
1. Write the output and detail of above basic commands with example, after
practically performance.
2. Select tree commands from tree manual and run individually? Write output of
following here.
3. Select ‘touch’ commands from touch manual and run individually? Write output of
above here.
4. Select ‘cat’ commands from touch manual and run individually? Write output of
above here.
5. Explore different Command’s manuals perform practically and write output here.
6. Practically perform all above operations on windows operating system and write
steps and output of performance here.