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

0% found this document useful (0 votes)
8 views7 pages

Shresth OS Assignment

Uploaded by

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

Shresth OS Assignment

Uploaded by

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

SHRESTH DWIVEDI ROLL NO.

- 60 MCA I SEC - D

Problem Statement 1: Explore, Execute and Analyze general purpose Linux


Commands.
1.1 Use a command to list all files, including hidden ones, in the current working directory.
1.2 Show the full path of your current working directory.
1.3 Create a new directory called MyFolder.
1.4 Change the current directory to MyFolder.
1.5 Delete the directory MyFolder.
1.6 Copy file1.txt to create file2.txt.
1.7 Rename file2.txt to file3.txt.
1.8 Delete file3.txt.
1.9 Use a command to display system information, such as kernel name and version.
1.10 Create an empty file named test.txt.
1.11 Clear the terminal screen.
1.12 List all currently running processes.
1.13 Search for the word "Linux" in the file example.txt.
1.14 Use a command to display "Welcome to Linux" on the terminal.
1.15 Display the disk usage of all mounted file systems.
1.16 Use a command to count lines, words, and characters in test.txt.
1.17 Display the current user name.
1.18 Command to sort the output of file in reverse order.

Objective: The objective of Linux commands is to provide users with the ability to
interact with and manage the operating system through a command-line interface.
Each Linux command performs a specific task, and when combined, they allow users
to Manage Files and Directories, Control Processes, Access System Information, File
Permissions and Ownership, Networking, Package Management, Automation and
Scripting and System Administration.

1
SHRESTH DWIVEDI ROLL NO. - 60 MCA I SEC - D

1.1 Use a command to list all files, including hidden ones, in the current working directory.

Command: ls -a
Description: The ls command in Linux is used to list the contents of a directory,
showing the files and subdirectories within it.
Output:

1.2 Show the full path of your current working directory.


Command: pwd
Description: The pwd command in Linux stands for Print Working Directory. It is used to
display the full path of the current working directory in the terminal. This command helps
users understand their current location within the filesystem.
Output:

1.3 Create a new directory called MyFolder.

Command: mkdir shresth


Description: The mkdir command in Linux is used to create new directories.

Output:

2
SHRESTH DWIVEDI ROLL NO. - 60 MCA I SEC - D

1.4 Change the current directory to MyFolder.

Command: cd shresth
Description: The cd command in Linux is used to change the current directory in the
command- line interface. It allows you to navigate between directories in the filesystem.

Output:

1.5 Delete the directory MyFolder.

Command: rm -d Shresth
Description: The rm command in Linux is used to remove files or directories. It is a
powerful command that can delete both individual files and entire directories, including their
contents.
Output:

1.6 Copy file1.txt to create file2.txt.


Command: cp hello.txt shresth.txt
Description: The cp command in Linux is used to copy files and directories from one
location to another. It allows you to create duplicate copies of files or directories.

Output:

3
SHRESTH DWIVEDI ROLL NO. - 60 MCA I SEC - D

1.7 Rename file2.txt to file3.txt.


Command: mv Shresth.txt Dwivedi.txt
Description: The mv command in Linux is used to move or rename files and directories.
It allows you to transfer files or directories from one location to another or rename them.

Output:

1.8 Delete file3.txt.


Command: rm Dwivedi.txt
Description: The rm command in Linux is used to remove files. It is a powerful
command that can delete both individual files and entire directories, including their
contents

Output:

1.9 Use a command to display system information, such as kernel name and version.
Command: uname -a
Description: The command uname -a provides a comprehensive overview of your
system's kernel and other information. It outputs details such as the kernel name, version,
and machine architecture.

Output:

4
SHRESTH DWIVEDI ROLL NO. - 60 MCA I SEC - D

1.10 Create an empty file named test.txt.


Command: touch flower.txt
Description: The touch command in Linux is used to create empty files or update the
timestamps of existing files.
Output:

1.11 Clear the terminal screen.


Command: clear
Description: The clear command in Linux is used to clear the terminal screen. When you
run this command, it removes all the content currently displayed in the terminal window
and leaves you with a clean prompt.

Output:

1.12 List all currently running processes.


Command: ps -e
Description: The ps command in Linux is used to display information about currently
running processes. It provides details such as process IDs, user information, and resource
usage.
Output:

5
SHRESTH DWIVEDI ROLL NO. - 60 MCA I SEC - D

1.13 Search for the word "Linux" in the file example.txt.


Command: cat hello.txt | grep “JARVISH”
Description: The grep command in Linux is used to search for specific patterns within files
or output streams. It prints lines that match a given pattern, making it a powerful tool for
searching and filtering text.

Output:

1.14 Use a command to display "Welcome to Linux" on the terminal.


Command: echo "Welcome to Linux"
Description: The echo command in Linux is used to display a line of text or the value of a
variable to the terminal. It is commonly used in shell scripts and for simple output purposes.

Output:

1.15 Display the disk usage of all mounted file systems.


Command: df
Description: The df command in Linux is used to display information about disk space
usage on mounted filesystems. It shows how much disk space is used and available on each
filesystem.
Output:

1.16 Use a command to count lines, words, and characters in test.txt.

6
SHRESTH DWIVEDI ROLL NO. - 60 MCA I SEC - D

Command: wc -w hello.txt
Description: The wc command in Linux is used to count lines, words, and characters in
files or input streams. It provides a simple way to get these counts and is commonly used in
text processing tasks.

Output:

1.17 Display the current user name.


Command: whoami
Description: The whoami command in Linux is used to display the current username of the
user who is logged in and executing the command.

Output:

1.18 Command to sort the output of file in reverse order.

Command: sort -r flower.txt


Description: The sort command in Linux is used to sort lines of text files in various ways, including
lexicographically, numerically, or by specific fields.
Output:

You might also like