Skip to content

Instantly share code, notes, and snippets.

@Saurav1823
Created February 2, 2026 05:57
Show Gist options
  • Select an option

  • Save Saurav1823/e5c70fdbe8e58f204414f9314acf2de6 to your computer and use it in GitHub Desktop.

Select an option

Save Saurav1823/e5c70fdbe8e58f204414f9314acf2de6 to your computer and use it in GitHub Desktop.
#CLI DRILL 1
1.Create the main directory and move into it
Command:
mkdir hello
cd hello
Explanation:
This creates a directory named hello and moves inside it.
2.Create directories five, six, and seven
Command:
mkdir five
cd five
mkdir six
cd six
mkdir seven
Explanation:
Created directory named five inside hello, then dir named six inside five, and seven inside six.
3.Move back to the hello directory
Command:
cd ..
cd ..
cd ..
Explanation:
Each cd .. moves one level back .
4.Create directories one, two, three, and four
Command:
mkdir one
cd one
mkdir two
cd two
mkdir three
cd three
mkdir four
Explanation:
Created one and moved inside it , created two inside one and inside two and then created three and moved inside it and in last created four.
5.Return back to hello directory
Command:
cd ..
cd ..
cd ..
cd ..
Explanation:
Moved back 4 time to reach hello directory.
6.Create empty files
Command:
touch hello/five/six/c.txt
touch hello/five/six/seven/error.log
touch hello/one/a.txt
touch hello/one/b.txt
touch hello/one/two/d.txt
touch hello/one/two/three/e.txt
touch hello/one/two/three/four/access.log
Explanation:
Using touch command , created the required file in the required folders , inside six created c.txt , inside seven created error.log , inside one created a.text and b.txt
Inside two created d.txt , inside three created e.txt and in last inside four created access.log
GIVEN TASKS:
1.Delete all files with .log extension
Command:
rm hello/five/six/seven/error.log
rm hello/one/two/three/four/access.log
Explanation:
Used rm command to delete all the .log extension file
2.Add content to a.txt file
Command:
nano hello/one/a.txt
Content added:
Unix is a family of multitasking, multiuser computer operating systems that derive from the original AT&T Unix, development starting in the 1970s at the Bell Labs research center by Ken Thompson, Dennis Ritchie, and others
Explanation:
Using nano command opened the a.txt and then add the given required content to it.
3.Delete the directory named five
Command:
rm -r hello/five
Explanation:
Here used rm -r to delete the directory named five as it is not empty so here rmdir will not work.
4.Rename directory one to uno
Command:
mv hello/one hello/uno
Explanation:
The mv command is used here to rename the directory hello to uno.
5.Move a.txt to the two directory
Command:
mv hello/uno/a.txt hello/uno/two
Explanation:
Moves the file a.txt from the uno directory into the two directory.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment