0% found this document useful (0 votes)
7 views

Practical 4- DOS and LINUX Basic Commands

The document provides a comprehensive overview of basic DOS and Linux commands, detailing their functions and syntax. It covers internal DOS commands like CLS, DATE, TIME, COPY, and various Linux commands for file and directory management, including pwd, mkdir, and rm. Additionally, it highlights the differences in command usage between DOS and Linux, emphasizing Linux's case sensitivity and command-line interface capabilities.

Uploaded by

ajkt0611
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Practical 4- DOS and LINUX Basic Commands

The document provides a comprehensive overview of basic DOS and Linux commands, detailing their functions and syntax. It covers internal DOS commands like CLS, DATE, TIME, COPY, and various Linux commands for file and directory management, including pwd, mkdir, and rm. Additionally, it highlights the differences in command usage between DOS and Linux, emphasizing Linux's case sensitivity and command-line interface capabilities.

Uploaded by

ajkt0611
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Practical No.

a) To study and implement basic DOS commands.


b) To study and implement basic LINUX commands.

a) Internal Dos Commands and its Uses

CLS COMMAND
This is an Internal dos command which is used to clear the output on the screen obtained when
executing any basic dos commands.
These commands clear all the text from the screen and show the user a Command prompt.
(Syntax)
C:\>cls (Press Enter)

DATE COMMAND
The date command is an internal basic dos command which is used to display or change the
current date of the system in the format of mm/dd/yy.
(Syntax)
C:\>date (Press Enter)

TIME COMMAND
The time command is used to display or change the current time of the Computer system.
The format which is used by the time command is HH:MM: SS::CC. Where HH stands for
hours of the day in 24-hour format, MM for minutes, SS For seconds, and CC For hundreds of
a second.
(Syntax)
C:\> Time (Press Enter)

COPY CON COMMAND


This is a very important internal dos command which is used to create text files.
The filename used while creating a file using this basic dos command consists of a primary
name and an extension which is separated by a dot or commonly called a period.
While creating a File there are some rules, a primary file name must not be greater than 8
characters and the extension must be not greater than 3 characters.
The filename can consist of digits and special symbols such as 0 to 9 or @ # % etc.
(Syntax)
C:\>copy con abc.com (Press Enter)
Everybody wants to go to heaven but nobody wants to die.

To save the file use CTRL+Z OR F6 OR to cancel use CTRL+C from the keyboard.

TYPE COMMAND
Type command is used to view the content of the file.
(Syntax)
C:\>type abc.com (Press Enter)
Everybody wants to go to heaven but nobody wants to die.
If the content of the file is large and cannot be entirely viewed on the display device use the
following MS Dos command.
(Syntax)
C:\> type abc.com |more (Press Enter)

RENAME COMMAND
This Basic Dos Command is used for renaming an existing file or directory.
(Syntax)
C:\>Ren (old file name) (new file name) (Press Enter)
For Example, you have a file name abc.com and want to change the file name to computer.xyz.
Use the below command.
C:\>Ren abc.com computer.xyx(Press Enter)
Ok now if you need to change the name and extension of files in a group. you need to use
wildcards as given below
C:\>Ren *.com *.abc (Press Enter)
Here all the .com extension files will be renamed to .abc

COPY
Copy is a Basic internal dos command which is used to copy files from one location to another.
While using copy command you have to specify the path or address of the file and the location
where you
need to copy that file.
Do not forget to mention the address of the file and the destination where you need to copy it.
(Syntax)
C:\> Copy d:\abc.com E: (Press Enter)
Using wild cards you can copy each and every file present in a directory for example if you
need to copy files that are present in d:\songs to e:\newsongs use the following command.
C:\Copy D:\songs\*.* E:\newsongs (Press Enter)
You can use the switches present in the copy command to know the various switches using the
below mentioned MS-Dos command.
C:\>copy/? (Press Enter)
The Various Switches are
Source:: specifies the file and files to be copied
• /A:: Indicates an ASCII text file
• /B:: Indicates a Binary file Destination:: Specifies the directory and /or filename for the new
file.
• /V:: Verifies that new files are written correctly
• /Y:: Suppresses prompting to confirm you want to overwrite an existing destination file.
• /-Y:: Causes prompting to confirm you want to overwrite an existing destination file.
DELETE
Del is a Basic internal dos command which is used to delete the specifically mentioned files.
(Syntax)
C:\del abc.com (Press Enter)
To delete files in a group use wild cards.
C:\>del * .abc (Press Enter)
In the above command, all the files which have an extension .abc will be deleted.

DIR COMMAND
DIR Command Is used to display all the files and directories along with the filename, extension,
creation date, and modified date.
(Syntax)
C:\>Dir (Press Enter)
Switches Used in DIR Command
• /P:: uses to display the result in page-wise format c:\dir/p
• /W:: It Displays the result in widthwise format c:\dir/w
• /A:: is used to display files or directories with specific Attributes
• /O:: It is used to display a list in sorted order

MD COMMAND
MD or MKDIR command is an internal dos command which is used to create directories and
subdirectories.
(Syntax)
C:\>md (directory name) (Press Enter)
For example, if you need to create a directory named movies follow the below dos command.
C:\> MD movies (Press Enter)

CD OR CHANGE DIRECTORY COMMAND::


CD OR CHDIR is an internal dos command which is used to create a subdirectory or to enter
within a
parent directory.
(Syntax)
C:\>cd movies (Press Enter)
Here in the above example, we can enter into a parent directory named movies by using CD
Command.

CD.. COMMAND
CD.. command is used to change the directory from parent to child.
For Example:
C:\movies>cd.. (Press Enter)

REMOVE DIRECTORY COMMAND::


It is used to remove or erase an empty subdirectory.
(Syntax)
C:\>RD movies (Press Enter)
To use the following command, you should see that the subdirectory should not contain any
files or subdirectories.

VERSION OR VER COMMAND


The Version or Ver command is used to display the version of your operating system.
(Syntax)
C:\> Ver (Press Enter)
b) Linux Commands and its uses
• The Linux command is a utility of the Linux operating system. All basic and advanced
tasks can be done by executing commands. The commands are executed on the Linux
terminal. The terminal is a command-line interface to interact with the system, which
is similar to the command prompt in the Windows OS.
• Commands in Linux are case-sensitive.
• Linux provides a powerful command-line interface compared to other operating
systems such as Windows and MacOS. We can do basic work and advanced work
through its terminal.
• Linux terminal is a user-friendly terminal as it provides various support options. To
open the Linux terminal, press "CTRL + ALT + T" keys together, and execute a
command by pressing the 'ENTER' key.

Linux Directory Commands

1. pwd Command
The pwd command is used to display the location of the current working directory.
Syntax:
1. pwd

Output:

2. mkdir Command
The mkdir command is used to create a new directory under any directory.
Syntax:
1. mkdir <directory name>

Output:

3. rmdir Command
The rmdir command is used to delete a directory.
Syntax:
1. rmdir <directory name>

Output:

4. ls Command
The ls command is used to display a list of content of a directory.
Syntax:
1. ls

Output:

5. cd Command
The cd command is used to change the current directory.
Syntax:
1. cd <directory name>

Output:
Linux File commands

6. touch Command
The touch command is used to create empty files. We can create multiple empty files by
executing it once.
Syntax:
1. touch <file name>
2. touch <file1> <file2> ....
Output:

7. cat Command
The cat command is a multi-purpose utility in the Linux system. It can be used to create a file,
display content of the file, copy the content of one file to another file, and more.
Syntax:
1. cat [OPTION]... [FILE]..
To create a file, execute it as follows:
1. cat > <file name>
2. // Enter file content
Press "CTRL+ D" keys to save the file. To display the content of the file, execute it as follows:
1. cat <file name>
Output:

8. rm Command
The rm command is used to remove a file.
Syntax:
rm <file name>
Output:

9. cp Command
The cp command is used to copy a file or directory.
Syntax:
To copy in the same directory:
1. cp <existing file name> <new file name>
To copy in a different directory:
Output:

10. mv Command
The mv command is used to move a file or a directory form one location to another location.
Syntax:
1. mv <file name> <directory path>
Output:

11. rename Command


The rename command is used to rename files. It is useful for renaming a large group of files.
Syntax:
1. rename 's/old-name/new-name/' files
For example, to convert all the text files into pdf files, execute the below command:
1. rename 's/\.txt$/\.pdf/' *.txt
Output:

Linux File Content Commands


12. head Command
The head command is used to display the content of a file. It displays the first 10 lines of a file.
Syntax:
1. head <file name>
Output:

13. tail Command


The tail command is similar to the head command. The difference between both commands is
that it displays the last ten lines of the file content. It is useful for reading the error message.
Syntax:
1. tail <file name>
Output:

14. tac Command


The tac command is the reverse of cat command, as its name specified. It displays the file
content in reverse order (from the last line).
Syntax:
1. tac <file name>
Output:

Linux Utility Commands

15. find Command


The find command is used to find a particular file within a directory. It also supports various
options to find a file such as byname, by type, by date, and more.
The following symbols are used after the find command:
(.) : For current directory name
(/) : For root
Syntax:
1. find . -name "*.pdf"
Output:

16. date Command


The date command is used to display date, time, time zone, and more.
Syntax:
1. date
Output:
17. cal Command
The cal command is used to display the current month's calendar with the current date
highlighted.
Syntax:
1. cal
Output:
18. exit Command
Linux exit command is used to exit from the current shell. It takes a parameter as a number
and exits the shell with a return of status number.
Syntax:
1. exit
Output:

After pressing the ENTER key, it will exit the terminal.

19. clear Command


Linux clear command is used to clear the terminal screen.
Syntax:
1. clear
Output:

After pressing the ENTER key, it will clear the terminal screen.

Linux Networking Commands

20. ip Command
Linux ip command is an updated version of the ipconfig command. It is used to assign an IP
address, initialize an interface, disable an interface.
Syntax:
1. ip a or ip addr
Output:

21. ping Command


The ping command is used to check the connectivity between two nodes, that is whether the
server is connected. It is a short form of "Packet Internet Groper."
Syntax:
1. ping <destination>
Output:

22. host Command


The host command is used to display the IP address for a given domain name and vice versa.
It performs the DNS lookups for the DNS Query.
Syntax:
1. host <domain name> or <ip address>
Output:

You might also like