You are smart to check what the commands do, before executing them. But,
they are pretty safe - they don't do anything irreversible. :)
Actually, originally I made a mistake, as the last command should be 'chmod
600 ~/.gnupg/*', not 'chmod 500 ~/.gnupg/*' (my previous post is corrected
now).
Commands beginning with 'sudo' are for doing something with admin/super
privileges.
Commands like 'chown -R mampir: DIRECTORY' are for making a DIRECTORY and
everything in it belong to the user 'mampir'. The ':' after 'mampir' is for
making everything also belong the primary usergroup of 'mampir', which is
what you want 99% of the time. '$USERNAME' can be written in place of
'mampir', so everything will become owned by the user executing the command,
no matter what his username is.
'chmod 700 DIRECTORY' makes a directory only accessible by you. '7' stands
for the permissions: 4 (read) + 2 (write) + 1 (execute), so you can read,
write in and execute a file/directory:
4 + 2 + 1 = 7
The two '0' digits are for setting permission on users belonging to your
group and for all other users on your system. They are '0' so everything is
disallowed for them.
'chmod 600 DIRECTORY/* makes all files within DIRECTORY accessible only by
you:
4 (read) + 2 (write) = 6 (read-write)
While directories need to be 'executable' for to be used, most files don't,
so that's why it's '600', not '700'. The '*' means 'everything'.