cut -d: -f1 /etc/passwd
The permissions can be changed using the chmod
keyword. The syntax for the command is:
chmod <flags> <permissions> <filename>
flags
are the additional options users can set.permissions
define if the user can read, write, or execute the file. They can be represented using symbolic or octal numbers.filename
is the name of the file whose permission is to be changed.
chmod u=rwx,g=r,o=r file**
where:
- r gives read permissions
- w gives write permissions
- x gives execute permissions
The same command can be run using octal notation:
chmod 744 file
Each digit represents the sum of the permissions allowed:
- 4 → read permission
- 2 → write permission
- 1 → execute permission
- 0 → no permission
The sum of these permissions are used to represent each type of author.
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1
set -euo pipefail
-e
: Exit immediately if a command exits with a non-zero status.
-u
: If you try to access an undefined variable, that is an error.
-o pipefail
: If any command in a pipeline returns a non-zero exit code, the return code of the entire pipeline is the exit code of the last failed command.
dpkg --print-architecture
An alternative is to use
uname -m
, however, this returnsaarch64
rather thanarm64
for Apple M1 Silicon