Skip to content

Instantly share code, notes, and snippets.

@dipaish
Last active October 3, 2024 06:39
Show Gist options
  • Save dipaish/5fa1250bf38af1075a15dfdceea0a47e to your computer and use it in GitHub Desktop.
Save dipaish/5fa1250bf38af1075a15dfdceea0a47e to your computer and use it in GitHub Desktop.
Permissions & Ownerships

Permissions and Ownership

Clear the command history stored in the current session

For in-class tasks, you are required to execute the commands as instructed and capture the command history upon completion. To ensure that only the commands executed during the current session are captured, it’s recommended to start each session with a clean history. Use the following command to clear the command history stored in the current session.

# Clear the current session's history
history -c
  1. Execute ls -l in one of your directories that contains some items. Discuss the mode, owner and group of at least 3 of your files or directories.
  2. Discuss on read, write and execute permission with your class mate.
  3. -rw- - - - - - - What does hyphen (-) represent?
  4. Explain the following permission (discuss with your class mate)
    1. -rw- - - - - - -
    2. drwxr-x- - -
    3. -rw-rw-rw-
    4. -rwxr-x- - -
  5. Use octal notation for following permissions (discuss with your class mate)
    1. -rw- - - - - - -
    2. drwxr-x- - -
    3. -rw-rw-rw-
    4. -rwxr-x- - -
  6. View file permissions and ownership for one of your file.
    1. Change the file permission (read and write for the owner, read for group and read for public)
    2. Change the owner of the file to another user that exists in your system.
    3. Change the group ownership for the file to some other group that exists in your system.
  7. View permissions and ownership for one of your directory.
    1. Change the directory permission (read and write for the owner, read and write for group and no permission for public)
    2. Change the owner of the directory to some other user that exists in your system
    3. Change the group ownership of the directory to another group that exists in your system.

After you have done all the above tasks, you will run the following command and create firstname_lastname_T3.txt file in your home directory.

history >firstname_lastname_T3.txt
echo "User: $(whoami), Date and Time: $(date)" >> firstname_lastname_T3.txt

Type explorer.exe . in your terminal and you will see the file firstname_lastname_T3.txt Now drag that file to your repository for third portfolio.

Note: Always, check the contet of the file created to verify it includes every commands that you have executed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment