Practical 1

Aim : Introduction to basic linux commands to create a file , directory , copying files , changing to a directory , moving , removing , coming out of a directory , displaying a present working directory (mkdir,cp,mv,cd,pwd)
- Create a file in linux : “touch “ command is the easiest way to create new, empty file.it also used to change the timestamps (ie dates and time of the most recent access and modification)on existing files and directories.
- “mkdir” command creates a new directories in your file system.
- “cp” is a linux command to copy files and directories .
- “cd” the cd command also known as chdir(change directory)is a command line OS shell command used to change the current working directory in operating system .
- “mv” move mv is used to move one or more files or directories from one place to another iin files system.it is also used for renames.
- “rm” this command is used to delete file from directory.
- “cd ..” the coming out to directory this used for back to the directory by one step.
- “pwd” present working directory it shows your current working directory.
Practical 2
Aim : Introduction to ls (listing file) and ls-l(long listing) command.
“ls” (listing) is a linux shell command that lists directory contents of files and directories.
“ls-l” (long listing) this is command will only display the files but if you want your
Files to be displayed in a long list format then you can use –l comman
Practical 3
Aim : Introduction to pipe and grep command.
- Pipe : A pipe is a form of redirection (transfer of standard output to some other destination) that is used in linux and other unix like operating system to send the output of one command/program/process to another command/program/process for further processing.
Pipe is used to combine two or more command and in this the output of one command act as input to another command .
- Grep: The grep filter searches a files for a particular pattern of character ,and Diplay all lines that contain that pattern. The pattern that is searched in the files is reffered to as the regular expression(grep stands for globally search for regular expression and print out).
Practical 4:
Aim : Creation of tree structure with respective directories and sub directories with files.
To create a new directory with multiple subdirectories you only need to type the following command at the prompt and press Enter
mkdir –p dir1/{sub1,sub2,sub3}
mkdir –p dir2/{sub4,sub5}
Practical 5:
Aim: File creation with the help of cat command.
“cat” (concatenate) it is used to create a file or multiple file and provide view of multiple files in single command.
Practical 6:
Aim : Removing files and directories with the help of rm and rmdir.
- “rm” it is used to remove a file from system.
- “rmdir” it is used to remove a directory from the system
Practical 7:
Aim : Changing permission of files chmod command.
“chmod” (to change access permission,change mode) chmod changes the permission of each given file according to mode,whetre mode describes the permission to modify.mode can be specified with octal number or with letter.
Read by owner only.
Read by group only.
Read by anyone.
Practical 8:
Aim : Displaying or filtering the files according to the requirement by using grep command.
First create the following demo_file that will be used in the examples below to demonstrate grep command.
$ cat demo_file
THIS LINE IS THE 1ST UPPER CASE LINE IN THIS FILE.
this line is the 1st lower case line in this file.
This Line Has All Its First Character Of The Word With Upper Case.
Two lines above this line is empty.
And this is the last line.
The basic usage of grep command is to search for a specific string in the specified file as shown below.
Syntax: grep "literal_string" filename
Post a Comment