# NOTES - shortcuts that help with coding ###### tags: `General` ## Permissions CHMOD is the command and system call used to change the access permissions of file system objects, sometimes known as modes. ### Checking permissions ```bash= ! ls –l [file_name] ``` :::info :bulb: Example **-rwxrw-r--** 1 hope hopestaff 123 Feb 03 15:36 file.txt Here's what each part of this information means: - The first character represents the file type: "-" for a regular file, "d" for a directory, "l" for a symbolic link. - The next three characters (rwx) represent the permissions for the file's owner: the owner may read from, write to, ore xecute the file. - The next three characters (rw-) represent the permissions for members of the file group. Any member of the file's owning group may read from or write to the file. The final dash is a placeholder; group members do not have permission to execute this file. - The final three (r--) is The permissions for "others" (everyone else). Others may only read this file. ::: ### Using CHMOD * -R Recursive, i.e. include objects in subdirectories. * -v verbose, show objects changed (unchanged objects are not shown). ### file ```bash= ! chmod a+x 777 [filenanme] ``` :::info :bulb: Value meaning * 777 (rwxrwxrwx) No restrictions on permissions. Anybody may do anything. Generally not a desirable setting. * 755 (rwxr-xr-x) The file's owner may read, write, and execute the file. All others may read and execute the file. This setting is common for programs that are used by all users. * 700 (rwx------) The file's owner may read, write, and execute the file. Nobody else has any rights. This setting is useful for programs that only the owner may use and must be kept private from others. * 666 (rw-rw-rw-) All users may read and write the file. * 644 (rw-r--r--) The owner may read and write a file, while all others may only read the file. A common setting for data files that everybody may read, but only the owner may change. * 600 (rw-------) The owner may read and write a file. All others have no rights. A common setting for data files that the owner wants to keep private. Here the digits 7,6,5, and 4 represent the permissions for the user, group, and others, in that order. Each digit is a combination of the numbers 4, 2, 1, and 0: * 4 stands for "read", * 2 stands for "write", * 1 stands for "execute", and * 0 stands for "no permission." So 7 is the combination of permissions 4+2+1 (read, write, and execute), 5 is 4+0+1 (read, no write, and execute), and 4 is 4+0+0 (read, no write, and no execute). ::: ### folder ```bash= ! chmod a+rwx ./[FOLDER NAME] ``` ## Nora's notes on creating a names_list.txt file from the contents of a directory: ``` ls | cat > name_list.txt ``` To make a name_list.txt file of only the subdirectories within a directory (like assembled reads subdirectories) ``` ls -d */ | cut -f1 -d'/' | cat > name_list.txt ```