Exp 3
Exp 3
1. The cp command:
cp - copy files and directories
This command is used to create a duplicate of a file, a set of files or a
directory The cp command copies both text and binary files
Syntax:
$cp source-file/directory destination-file/directory
Examples:
i) $cp file1 file2
ii) $cp dir1/file1 dir1/file2
2) The ls command:
ls - list directory contents
This command lists the contents in a directory.
Syntax:
$ls
Example:
$ls
Grep, short for “global regular expression print”, is a command used for
searching and matching text patterns in files contained in the regular
expressions.
Use the grep command whenever you need to search for specific text
patterns within files. It’s particularly useful for:
To search for a specific string in multiple files, use a wildcard to specify the
files. You can also list multiple files explicitly:
To invert the search and display lines that do not match the pattern, use the
-v option: