Weitere ähnliche Inhalte
Ähnlich wie Linux commands tutorial
Ähnlich wie Linux commands tutorial (20)
Kürzlich hochgeladen (20)
Linux commands tutorial
- 1. Commands used in Linux Operating System
Objectives
In this lesson, you will learn to:
Create a directory using the mkdir command
Delete a directory using the rmdir command
List the contents of a directory using the ls command
Copy a file using the cp command
Move and renaming a file using the mv command
Delete a file using the rm command
Displaying the page content using more command
©NIIT Linux/Lesson 2/Slide 1 of 17
- 2. Commands used in Linux Operating System
Objectives (contd:)
Using Wildcard characters
Use man command to get online help
Functions of an Editor
Create and Edit documents using the vi editor
©NIIT Linux/Lesson 2/Slide 2 of 17
- 3. Commands used in Linux Operating System
Directory Commands in Linux
Identifying the Current Directory Path
The pwd (print working directory) command is used
to display the full path name of the current
directory
Changing the Current Directory
The cd (change directory) command changes the
current directory to the directory specified
Creating a Directory
The mkdir (make directory) command is used to
create directories
©NIIT Linux/Lesson 2/Slide 3 of 17
- 4. Commands used in Linux Operating System
Directory Commands in Linux (contd.)
Removing a Directory
The rmdir (remove directory) command removes
the directory specified
Listing the Contents of a Directory
The ls command is used to display the names of
the files and sub-directories in a directory
©NIIT Linux/Lesson 2/Slide 4 of 17
- 5. Commands used in Linux Operating System
File Commands in Linux
The cat (concatenate) command displays the
contents of the specified file
Copying Files
The cp (copy) command duplicates the contents of
the source file into a target file
cp [options] source file/s destination
directory/file
Removing Files
The rm (remove) command is used to delete files
or directories
rm [options] file/s
©NIIT Linux/Lesson 2/Slide 5 of 17
- 6. Commands used in Linux Operating System
File Commands in Linux (contd.)
Moving and Renaming Files
The mv (move) command is used to move a file or
directory from one location to another or to change
its name
mv [option] source destination
Displaying the Contents Page–Wise
The more command is used to display data one
screen-full at a time. While viewing a file using the
more command, once you have scrolled down, you
cannot move up
more [options] filename
©NIIT Linux/Lesson 2/Slide 6 of 17
- 7. Commands used in Linux Operating System
File Commands in Linux (contd.)
Displaying the Contents Page–Wise (contd.)
The less command is similar to the more
command except that you can scroll upwards also
while viewing the contents of a file
less [options] filename
Wildcard Characters
The shell offers the facility to perform an operation on
a set of files by the use of certain special characters in
the command in place of the actual file names
©NIIT Linux/Lesson 2/Slide 7 of 17
- 8. Commands used in Linux Operating System
File Commands in Linux (contd.)
Wildcard Characters (contd.)
The * Wildcard
The * wildcard is interpreted as a string of none,
one, or more characters
The ? Wildcard
The ? wildcard matches exactly one occurrence of
any character
The [ ] Wildcard
The [ ] wildcard can be used to restrict the
characters to be matched
©NIIT Linux/Lesson 2/Slide 8 of 17
- 9. Commands used in Linux Operating System
Getting Online Help
The man command is used to get online help to a
user about the various options for any command in
Linux
man command name
©NIIT Linux/Lesson 2/Slide 9 of 17
- 10. Commands used in Linux Operating System
Editors
A text editor is used to create and manage text files
and documents. An editor is an application software
that is usually bundled with an operating system (OS).
Functions of an Editor
Create a file
Open an existing file
Copy and Paste text
Search for text
Handle a large amount of data
©NIIT Linux/Lesson 2/Slide 10 of 17
- 11. Commands used in Linux Operating System
The vi Editor
The vi editor is a visual editor used to create and edit
text files, documents, and programs. In Red Hat Linux,
vi is a symbolic link to the vim editor, which is an
improved version of the vi editor.
Getting Started with vi
The vi editor is invoked by giving the following
command at the Linux prompt:
® vi filename Enter
©NIIT Linux/Lesson 2/Slide 11 of 17
- 12. Commands used in Linux Operating System
Editors
A text editor is used to create and manage text files
and documents. An editor is an application software
that is usually bundled with an operating system (OS).
Functions of an Editor
Create a file
Open an existing file
Copy and Paste text
Search for text
Handle a large amount of data
©NIIT Linux/Lesson 2/Slide 12 of 17
- 13. Commands used in Linux Operating System
The vi Editor
The vi editor is a visual editor used to create and edit
text files, documents, and programs. In Red Hat Linux,
vi is a symbolic link to the vim editor, which is an
improved version of the vi editor.
Getting Started with vi
The vi editor is invoked by giving the following
command at the Linux prompt:
® vi filename Enter
©NIIT Linux/Lesson 2/Slide 13 of 17
- 14. Commands used in Linux Operating System
Vi Editor(contd:)
You can use the following commands to exit vi editor
:x
ZZ
:q!
©NIIT Linux/Lesson 2/Slide 14 of 17
- 15. Commands used in Linux Operating System
Summary
In this lesson, you learned that:
some of the common directory commands used in
Linux are:
• pwd
• cd
• mkdir
• rmdir
• ls
©NIIT Linux/Lesson 2/Slide 15 of 17
- 16. Commands used in Linux Operating System
Summary (contd.)
some of the common file commands used in Linux
are:
• Cat
• Cp
• Rm
• Mv
• More
• less
The shell offers the facility to perform an operation on a set
of files by using the wildcard pattern.
©NIIT Linux/Lesson 2/Slide 16 of 17
- 17. Commands used in Linux Operating System
Summary (contd.)
Some of the commonly used wildcard characters are:
• ? – Matches one character in a file
• * - Matches zero, one, or more than one character in a
file name
• [ ] – Matches one character from the enclosed list
The man command is used to get online help to a
user about the various options for any command in
Linux
The vi editor is used to create and edit documents
©NIIT Linux/Lesson 2/Slide 17 of 17