Skip to content

Commit 9ed9250

Browse files
committed
explain permission columns with tabs
modified: docs/hpc/13_tutorial_intro_shell_hpc/06_scripts_variables_loops.mdx
1 parent 043f5d0 commit 9ed9250

File tree

1 file changed

+53
-48
lines changed

1 file changed

+53
-48
lines changed

docs/hpc/13_tutorial_intro_shell_hpc/06_scripts_variables_loops.mdx

Lines changed: 53 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import { Smile } from "lucide-react";
2+
import Tabs from '@theme/Tabs';
3+
import TabItem from '@theme/TabItem';
24

35
# Scripts, variables, and loops
46

@@ -63,53 +65,56 @@ drwxrwxr-x 2 yourUsername tc001 4096 Jan 16 19:16 fastq
6365

6466
That’s a huge amount of output: a full listing of everything in the directory. Let’s see if we can understand what each field of a given row represents, working from the left to right.
6567

66-
### Column 1: File/Directory Permissions
67-
This column contains a block of subcolumns that define the permissions for a file or directory given in each row. The permissions are shown for three user types to perform three actions each.
68-
69-
The user types are:
70-
- user (`u`): This refers to your permissions for this file/directory.
71-
- group (`g`): This refers to the permissions for people in the same group as this file/directory. You will see the group in the 4th column.
72-
- other (`o`): This refers to the permissions for all other users.
73-
74-
The actions are:
75-
- read (`r`): This refers to the permission to read this file.
76-
- write (`w`): This refers to the permission to write to this file.
77-
- execute (`x`): This refers to the permission to execute this file.
78-
79-
The following table show what each of the subcolumns refer to and their possible values:
80-
81-
| directory | user read | user write | user execute | group read | group write | group execute | other read | other write | other execute |
82-
| ---------- | ---------- | ---------- | ------------ | ---------- | ----------- | ------------- | ---------- | ----------- | ------------- |
83-
| `d` or `-` | `r` or `-` | `w` or `-` | `x` or `-` | `r` or `-` | `w` or `-` | `x` or `-` | `r` or `-` | `w` or `-` | `x` or `-` |
84-
85-
If there is a `-` in the directory column, the row refers to a file. If it contains a `d`, the row refers to a directory. The following columns behave in a similar manner. If they contain a `-`, the associated action is not allowed for the associated user type.
86-
87-
### Column 2: References
88-
This counts the number of references (hard links) to the item (file, folder, symbolic link or “shortcut”).
89-
90-
### Column 3: Owner
91-
This is the username of the user who owns the file.
92-
:::note
93-
Their permissions are indicated in the first permissions block of three after the directory column
94-
:::
95-
96-
### Column 4: Group
97-
Each user has a primary group and is optionally a member of other groups. When a user creates a file, it is normally associated with the user’s primary group. At NYU HPC, all users are in a group named ‘users’, so group permission has little meaning.
98-
:::note
99-
Other members of this group have the permissions in the second block of three after the directory column
100-
:::
101-
102-
### Column 5: Size of item
103-
This is the number of bytes in a file, or the number of filesystem blocks occupied by the contents of a folder.
104-
:::note
105-
We can use the `-h` option here to get a human-readable file size in megabytes, gigabytes, etc.
106-
:::
107-
108-
### Column 6: Time last modified
109-
This is the last time the file was modified.
110-
111-
### Column 7: Filename
112-
This is the name of the file/directory.
68+
::::info[What each column of the output above means:]
69+
<Tabs>
70+
<TabItem value="column1" label="File/Directory Permissions">
71+
This column contains a block of subcolumns that define the permissions for a file or directory given in each row. The permissions are shown for three user types to perform three actions each.
72+
73+
The user types are:
74+
- user (`u`): This refers to your permissions for this file/directory.
75+
- group (`g`): This refers to the permissions for people in the same group as this file/directory. You will see the group in the 4th column.
76+
- other (`o`): This refers to the permissions for all other users.
77+
78+
The actions are:
79+
- read (`r`): This refers to the permission to read this file.
80+
- write (`w`): This refers to the permission to write to this file.
81+
- execute (`x`): This refers to the permission to execute this file.
82+
83+
The following table show what each of the subcolumns refer to and their possible values:
84+
85+
| directory | user read | user write | user execute | group read | group write | group execute | other read | other write | other execute |
86+
| ---------- | ---------- | ---------- | ------------ | ---------- | ----------- | ------------- | ---------- | ----------- | ------------- |
87+
| `d` or `-` | `r` or `-` | `w` or `-` | `x` or `-` | `r` or `-` | `w` or `-` | `x` or `-` | `r` or `-` | `w` or `-` | `x` or `-` |
88+
89+
If there is a `-` in the directory column, the row refers to a file. If it contains a `d`, the row refers to a directory. The following columns behave in a similar manner. If they contain a `-`, the associated action is not allowed for the associated user type.
90+
</TabItem>
91+
<TabItem value="column2" label="References">
92+
This counts the number of references (hard links) to the item (file, folder, symbolic link or “shortcut”).
93+
</TabItem>
94+
<TabItem value="column3" label="Owner">
95+
This is the username of the user who owns the file.
96+
:::tip
97+
Their permissions are indicated in the first permissions block of three after the directory column
98+
:::
99+
</TabItem>
100+
<TabItem value="column4" label="Group">
101+
Each user has a primary group and is optionally a member of other groups. When a user creates a file, it is normally associated with the user’s primary group. At NYU HPC, all users are in a group named ‘users’, so group permission has little meaning.
102+
::: tip
103+
Other members of this group have the permissions in the second block of three after the directory column
104+
:::
105+
</TabItem>
106+
<TabItem value="column5" label="Size of item">
107+
This is the number of bytes in a file, or the number of filesystem blocks occupied by the contents of a folder.
108+
We can use the `-h` option here to get a human-readable file size in megabytes, gigabytes, etc.
109+
</TabItem>
110+
<TabItem value="column6" label="Time last modified">
111+
This is the last time the file was modified.
112+
</TabItem>
113+
<TabItem value="column7" label="Filename">
114+
This is the name of the file/directory.
115+
</TabItem>
116+
</Tabs>
117+
::::
113118

114119
## Changing Permissions
115120
As previously mentioned, in Unix a file has three basic permissions, each of which can be set for three types of user. Those three permission also have a numeric value:
@@ -390,4 +395,4 @@ We want all permissions, so: 4 (read) + 2 (write) + 1 (execute) = 7 for user (fi
390395
:::tip[Key Points]
391396
- A shell script is just a list of bash commands in a text file.
392397
- To make a shell script file executable, run `chmod +x script.sh`.
393-
:::
398+
:::

0 commit comments

Comments
 (0)