0% found this document useful (0 votes)
4 views2 pages

Shell Commands for Directory Management

The document provides a lab guide for working with shell commands, including checking user home directories, creating and managing directories, and using git commands. It includes specific command examples for tasks such as creating, moving, renaming, and deleting directories. The guide serves as a practical reference for users to perform basic shell operations.

Uploaded by

crchd1963
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)
4 views2 pages

Shell Commands for Directory Management

The document provides a lab guide for working with shell commands, including checking user home directories, creating and managing directories, and using git commands. It includes specific command examples for tasks such as creating, moving, renaming, and deleting directories. The guide serves as a practical reference for users to perform basic shell operations.

Uploaded by

crchd1963
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

4/9/25, 10:40 AM 04-lab-working-with-shell.

md

Lab - Working with shell


Access Hands-On Labs here Hands-On-Labs

1. To check the home directory for a particular user say bob

$ grep bob /etc/passwd | cut -d ":" -f6

2. To check the home directory for a particular user using built in shell variables

$ echo $HOME

3. In the command echo Welcome, what does the word Welcome represent with respect to the
command?

$ echo Welcome
- Where Welcome is an argument

4. To check git command type

$ type git

5. To create a directory

$ mkdir /home/bob/birds

6. To create directories recursively

$ mkdir -p /home/bob/fish/salmon

7. Create few more directories

$ mkdir -p /home/bob/mammals/elephant
$ mkdir -p /home/bob/mammals/monkey
$ mkdir /home/bob/birds/eagle
$ mkdir -p /home/bob/reptile/snake

[Link] kodekloud/linux-basics-course/docs/02-Working-With-Shell-Part-I/[Link] 1/2


4/9/25, 10:40 AM [Link]

$ mkdir -p /home/bob/reptile/frog
$ mkdir -p /home/bob/amphibian/salamander

8. To move a directory

$ mv /home/bob/reptile/frog /home/bob/amphibian

9. To rename a directory

$ mv /home/bob/reptile/snake /home/bob/reptile/crocodile

10. To delete a directory

$ rm -r /home/bob/reptile

[Link] kodekloud/linux-basics-course/docs/02-Working-With-Shell-Part-I/[Link] 2/2

You might also like