DevOps, Day - 3

DevOps, Day - 3

Basic Linux commands(Part - 2)

CommandPermissionOperationsDescription
chmod(symbolic codes)
u /g /o /a users/group/others/allr / w / x (read/write/execute)+ / - / = add/remove/assignchange the access permissions on a file.
chmod u/g/o/a file.extchmod u/g/o/a+r file.extadded read permission to file.ext
chmod u/g/o/a+w file.extadded write permission to file.ext
chmod u/g/o/a+x file.extadded execute permission to file.txt.
chmod u/g/o/a+rwx file.extadded all permissions at once to file.ext
chmod (numeric, octal representation)
Octal numbersBinary value & text equivalentExampleDescription
binary equivalent (r,w,x) for (owner, group, and others)
0000 _ _ _chmod 000 file.extall types of access are denied.
1001 _ _ xchmod 111 file.extexecute access is allowed to u+g+o.
2010 _ w _chmod 222 file.extwrite access is allowed to u+g+o.
3011 _ w xchmod 333 file.extwrite and execute access is allowed to u+g+o.
4100 r _ _chmod 444 file.extread access is allowed to u+g+o.
5101 r _ xchmod 555 file.extread & execute access is allowed to u+g+o.
6110 r w _chmod 666 file.extread & write access is allowed to u+g+o.
7111 r w xchmod 777 file.extall types of access are allowed to u+g+o.
Some Other examples
CommandDescriptionCommandDescription
chmod 123 file.extexecute is given to user. write is given to group, and write and execute is given to others.chmod 640 file.extread & write is given to user. read is given to group, and no permission is given to others.
chmod 345 file.extwrite & execute is given to user, read is given to group, and read & execute is given to others.chmod 526 file.extread & execute is given to user, write is given to group, and read and write is given to others.
CommandExampleDescription
historyhistorydisplays all commands used previously in the terminal.
cat >>cat >> file1.extused to append or add content to an already existing file.
head -n ( n=[1...∞] )head -3 file1.extdisplays starting 'n' lines from the file
tail -n ( n=[1...∞])tail -3 file1.extdisplays bottom 'n' lines from the file
diffdiff file1.ext file2.extshows the differences in 2 files

Thank you so much for reading

Follow me on LinkedIn to see interesting posts like this : )

Linkedin