Command | Permission | Operations | Description |
chmod(symbolic codes) | |||
u /g /o /a users/group/others/all | r / w / x (read/write/execute) | + / - / = add/remove/assign | change the access permissions on a file. |
chmod u/g/o/a file.ext | chmod u/g/o/a+r file.ext | added read permission to file.ext | |
chmod u/g/o/a+w file.ext | added write permission to file.ext | ||
chmod u/g/o/a+x file.ext | added execute permission to file.txt. | ||
chmod u/g/o/a+rwx file.ext | added all permissions at once to file.ext | ||
chmod (numeric, octal representation) | |||
Octal numbers | Binary value & text equivalent | Example | Description |
binary equivalent (r,w,x) for (owner, group, and others) | |||
0 | 000 _ _ _ | chmod 000 file.ext | all types of access are denied. |
1 | 001 _ _ x | chmod 111 file.ext | execute access is allowed to u+g+o. |
2 | 010 _ w _ | chmod 222 file.ext | write access is allowed to u+g+o. |
3 | 011 _ w x | chmod 333 file.ext | write and execute access is allowed to u+g+o. |
4 | 100 r _ _ | chmod 444 file.ext | read access is allowed to u+g+o. |
5 | 101 r _ x | chmod 555 file.ext | read & execute access is allowed to u+g+o. |
6 | 110 r w _ | chmod 666 file.ext | read & write access is allowed to u+g+o. |
7 | 111 r w x | chmod 777 file.ext | all types of access are allowed to u+g+o. |
Some Other examples | |||
Command | Description | Command | Description |
chmod 123 file.ext | execute is given to user. write is given to group, and write and execute is given to others. | chmod 640 file.ext | read & write is given to user. read is given to group, and no permission is given to others. |
chmod 345 file.ext | write & execute is given to user, read is given to group, and read & execute is given to others. | chmod 526 file.ext | read & execute is given to user, write is given to group, and read and write is given to others. |
Command | Example | Description |
history | history | displays all commands used previously in the terminal. |
cat >> | cat >> file1.ext | used to append or add content to an already existing file. |
head -n ( n=[1...∞] ) | head -3 file1.ext | displays starting 'n' lines from the file |
tail -n ( n=[1...∞]) | tail -3 file1.ext | displays bottom 'n' lines from the file |
diff | diff file1.ext file2.ext | shows the differences in 2 files |
Thank you so much for reading
Follow me on LinkedIn to see interesting posts like this : )