Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
18 views11 pages

Experiment No 1

The document outlines an experiment aimed at studying and implementing various Linux commands through a command-line interface. It covers directory commands, file commands, user commands, filter commands, utility commands, and networking commands, providing syntax and usage for each. The conclusion emphasizes the successful study and implementation of these commands.
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)
18 views11 pages

Experiment No 1

The document outlines an experiment aimed at studying and implementing various Linux commands through a command-line interface. It covers directory commands, file commands, user commands, filter commands, utility commands, and networking commands, providing syntax and usage for each. The conclusion emphasizes the successful study and implementation of these commands.
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/ 11

Experiment No.

AIM: To Study and implement Linux commands

THEORY:

The Linux command is a utility of the Linux operating system. 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 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:

pwd

Output:

2. mkdir Command

The mkdir command is used to create a new directory under any directory.

mkdir <directory name>

Output:
3. rmdir Command

The rmdir command is used to delete a directory.

Syntax:

rmdir <directory name>

Output:

4. ls Command

The ls command is used to display a list of content of a directory.

Syntax:

ls

Output:

5. cd Command

The cd command is used to change the current directory.

Syntax:

cd <directory name>

Output:
Linux File Commands

1. touch Command

The touch command is used to create empty files. We can create multiple empty files by
executing it once.

Syntax:

touch <file name>


touch <file1> <file2> ....

Output:

2. 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:

cat [OPTION]... [FILE]..

To create a file, execute it as follows:

cat > <file name>


// Enter file content

Press "CTRL+ D" keys to save the file. To display the content of the file, execute it as
follows:

cat <file name>

Output:
3. rm Command

The rm command is used to remove a file.

Syntax:

rm <file name>

Output:

4. cp Command

The cp command is used to copy a file or directory.

Syntax:

To copy in the same directory:

cp <existing file name> <new file name>

To copy in a different directory:

Output:

5. mv Command

The mv command is used to move a file or a directory form one location to another location.

Syntax:

mv <file name> <directory path>

Output:
Linux File Content Commands

1. touch Command

The touch command is used to create empty files. We can create multiple empty files by
executing it once.

Syntax:

touch <file name>


touch <file1> <file2> ....

Output:

2. 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:

cat [OPTION]... [FILE]..

To create a file, execute it as follows:

cat > <file name>


// Enter file content

Press "CTRL+ D" keys to save the file. To display the content of the file, execute it as
follows:

cat <file name>

Output:
Linux User Commands

1. su Command

The su command provides administrative access to another user. In other words, it allows
access of the Linux shell to another user.

Syntax:

su <user name>

Output:

2. id Command

The id command is used to display the user ID (UID) and group ID (GID).

Syntax:

id

Output:
Linux Filter Commands

1. cat Command

The cat command is also used as a filter. To filter a file, it is used inside pipes.

Syntax:

cat <fileName> | cat or tac | cat or tac |. . .

Output:

2. cut Command

The cut command is used to select a specific column of a file. The '-d' option is used as a
delimiter, and it can be a space (' '), a slash (/), a hyphen (-), or anything else. And, the '-f'
option is used to specify a column number.

Syntax:

cut -d(delimiter) -f(columnNumber) <fileName>

Output:
Linux Utility Commands

1. 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:

find . -name "*.pdf"

Output:

2. locate Command

The locate command is used to search a file by file name. It is quite similar to find command;
the difference is that it is a background process. It searches the file in the database, whereas
the find command searches in the file system. It is faster than the find command. To find the
file with the locates command, keep your database updated.

Syntax:

locate <file name>

Output:
3. date Command

The date command is used to display date, time, time zone, and more.

Syntax:

date

Output:
Linux Networking Command

1. 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:

ip a or ip addr

Output:

2. ssh Command

Linux ssh command is used to create a remote connection through the ssh protocol.

Syntax:

ssh user_name@host(IP/Domain_name)</p>

3. mail Command

The mail command is used to send emails from the command line.

Syntax:

mail -s "Subject" <recipient address>

Output:
4. 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:

ping <destination>

Output:

5. 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:

host <domain name> or <ip address>

Output:

CONCLUSION: In this way we have Studied and implement Linux commands.

You might also like