Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

1. List all files and directories in your current working directory.

2. Change the permissions of a file named "my_file.txt" to allow read and write
access for the owner only.

3. Create a new directory named "my_folder" in your home directory.

4. Copy a file named "data.txt" from the "/tmp" directory to your current working
directory.

5. Display the contents of a file named "my_file.txt" on the terminal.

6. Rename a file named "old_file.txt" to "new_file.txt".


7. Delete a directory named "my_folder" and all its contents.

8. Find all files with the extension ".txt" in the current directory and its
subdirectories.

9. Display the current date and time on the terminal.

10.Create an empty file named "new_file.txt" in your current working


directory.

11.Change the current directory to "/var/log" and list all files and directories
within it.
12. Move a file named "old_file.txt" from the current directory to a directory
named "archive" within your home directory.

13.Count the number of lines in a file named "data.txt" located in the current
directory.

14.Display the current working directory on the terminal.

15.Search for files in the current directory that contain the word "important" in
their names.

16.Change the owner of a file named "my_file.txt" to a user named "john".

17.Display the contents of a file named "README.md" using a pager


program like "less" or "more".
18.Create a new empty file named "empty.txt" and set its permissions to
be readable and writable by all users.

TASK-2
1. Create a new user for each office. For example, you could create a user
called "techy" for the Kathmandu office, a user called "lads" for the Butwal
office, and a user called "private" for the Mustang office.

2. Add each user to the "company" group.

3. Change the password for each user.


4. Switch to each user one by one using the "su - username" command.
Private:

Lads:

Techy:

5. Create a file in each user's home directory with a unique name and write the
name of the continent the user is representing inside the file. For example,
you could create a file called "techy.txt" in the "techy" user's home directory
and write "Hey this is it" inside the file using redirection.
6.Verify that each user has only read and write permissions for their
respective file.

7.Change the ownership of the file to another user and verify it.

8.Remove the user "techy" from the group and verify it.

You might also like