[go: up one dir, main page]

0% found this document useful (0 votes)
7 views3 pages

Linux Practical Assignment Answers

Uploaded by

kachariyaaadarsh
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)
7 views3 pages

Linux Practical Assignment Answers

Uploaded by

kachariyaaadarsh
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/ 3

Linux Practical Assignment Answers

1. Display the current working directory

Command: pwd

2. Create a directory named BCA_Linux

Command: mkdir BCA_Linux

3. Move into the BCA_Linux directory

Command: cd BCA_Linux

4. Inside BCA_Linux, create two subdirectories: Notes and Assignments

Command: mkdir Notes Assignments

5. List the contents of BCA_Linux with file type indicators

Command: ls -F

6. Remove the Assignments directory

Command: rmdir Assignments

8. Display the directory structure using the tree command

Command: tree

9. Create an empty file called unit2.txt

Command: touch unit2.txt

10. Add the line "Welcome to Linux" to unit2.txt

Command: echo "Welcome to Linux" > unit2.txt

11. Copy unit2.txt to a new file named backup.txt

Command: cp unit2.txt backup.txt

12. Rename unit2.txt to unit2_commands.txt

Command: mv unit2.txt unit2_commands.txt

13. Remove the file backup.txt

Command: rm backup.txt

13. Display the current system date


Command: date

14. Show your current username

Command: whoami

15. Display all logged-in users

Command: who

16. Clear the screen using a command

Command: clear

17. Print "Linux is fun!" using echo

Command: echo "Linux is fun!"

18. Create the following directory structure in one line

Command: mkdir -p Projects/Java Projects/Python/Flask

19. List only hidden files and directories in the current folder

Command: ls -d .*

20. Navigate to your home directory from anywhere using one command

Command: cd ~

21. List all files and directories sorted by modification time

Command: ls -lt

22. List only directories (not files) in the current location

Command: ls -d */

23. Create 3 empty files: a.txt, b.txt, and c.txt in a single line

Command: touch a.txt b.txt c.txt

24. Append the content of b.txt to a.txt without deleting b.txt

Command: cat b.txt >> a.txt

25. Move all files starting with "log" to the Logs folder

Command: mv log* Logs/

26. Merge contents of all .txt files into combined.txt


Command: cat *.txt > combined.txt

You might also like