0% found this document useful (0 votes)
0 views6 pages

Os Exp2

The document is a lab assignment detailing basic UNIX commands performed by a student named Divyanshu Jain. It includes commands for displaying system information, user details, calendars, time formats, and directory management. Each command is accompanied by an explanation of its function and purpose.

Uploaded by

divyanshujain176
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)
0 views6 pages

Os Exp2

The document is a lab assignment detailing basic UNIX commands performed by a student named Divyanshu Jain. It includes commands for displaying system information, user details, calendars, time formats, and directory management. Each command is accompanied by an explanation of its function and purpose.

Uploaded by

divyanshujain176
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/ 6

Student Name : Divyanshu Jain

Enrollment No. – BT23GCS175


Section : B2

Lab Assignment 02 : Basic UNIX Commands

Q1. Obtain the following results


1. To Print the name of Operating System:
2. To Print the login name:
3. To Print the host name:

Command used:
1. uname -o
2. logname
3. uname –n

Explanation:

1. The uname command shows the operating system of the system.


2. The logname command outputs the user's login name.
3. Using the uname command with the -n option displays the machine's
hostname.

Output:
Q2. Find out the users who are currently logged in and find the particular user too.
Command used:
1. whoami
2. finger username

Explanation:
1. The whoami command shows the current user's login name.
The who command lists all users who are currently logged in, along with their
login details, such as the terminal and login time.

2. The finger username command provides information about a specific user.

Output:

Q3. Display the calendar for


1. Jan 2000
2. Feb 1999
3. 7th 8th and 9th month of the year 2000
4. For the Current Month
5. Current Date Day Abbreviation, Month Abbreviation along with year

Command used:
1. cal 01 2000
2. cal 02 1999
3. cal 07 2000
cal 08 2000
cal 09 2000
4. cal
5. date "+%a %b %Y"
Explanation:
The cal command displays the current calendar month and day.

Q4. Display the time in 12-Hour and 24-Hour Notations.


Command used:
1. date "+%I: %M: %S %p"
2. date "+%H: %M: %S"
Explanation:
The date command displays the current system date and time .

Output:

Q5. Display the Current Date and Current Time.


Command used:
1. date
Explanation:
The date command displays the current system date and time .
Output:
Q6. Display the message “GOOD MORNING” in enlarged characters.
Command used:
1. echo “GOOD MORNING”
Explanation:
The echo command displays the given input.
Output:

Q7. Display the name of your home directory.


Command used:
1. echo Home

Explanation:
The echo Home command used to display home directory.
Output:

Q8. Create a directory SAMPLE_NAME under your home directory.


Command used:
mkdir directory_ name

Explanation:
The mkdir SAMPLE_NAME command used to make a new directory with
SAMPLE_NAME .

Output:
Q9. Create a Sub-directory by name TRIAL_NAME under SAMPLE_NAME.
Command used:
mkdir directory_name
Explanation:
The cd command used to change directory to SAMPLE_NAME and then mkdir
TRIAL_NAME command used to make a new directory with TRIAl_NAME
under SAMPLE_NAME .
Output:

Q10. Change to SAMPLE_NAME.


Command used: cd directory_ name
Explanation: The cd command used to change directory to SAMPLE_NAME .

Q11. Change to your home directory.


Command used: cd
Explanation: The cd command used to change directory to home page.

Q12. Change from home directory to TRAIL_NAME by using absolute and relative
pathname.
Command used: cd /home/username/TRIAL_NAME or cd directory_name
Explanation: The cd command used to change directory to SAMPLE_NAME or we can
give absolute path instead of name.

Q13. Remove directory TRAIL_NAME.


Command used: rm -r directory_name
Explanation: The rm -r command is used to remove directory .

Q14. Create a directory TEST_NAME under SAMPLE_NAME using absolute pathname.


Command used: i)mkdir -p /SAMPLE_NAME/TEST_NAME ii)ls /SAMPLE_NAME
Explanation: The mkdir command is used to create a directory
Q15. Using a single command change from current directory to previous directory.
Command Used: cd –
Explanation: cd command: • cd (change directory) command is used to navigate
between directories in the terminal. - (dash) argument: • - (dash) is a special argument
for the cd command, which means "previous directory". •When you run cd -, it takes you
to the directory you were in just before your current directory

Q16. Remove directory TEST_NAME using absolute pathname.


Command used: rm -r /SAMPLE_NAME/TEST_NAME
Explanation: rm command: The rm (remove) command is used to delete files or
directories. -r option: -r stands for recursive. It instructs the rm command to remove
directories and their contents recursively. In other words, it will remove everything
inside the directory specified, not just the specified directory itself, including files and
subdirectories. /SAMPLE_NAME/TEST_NAME:

You might also like