Basic Linux Tutorial
Introduction – What is it? Why to learn? Linux installation directory structures Boot process Run levels in Linux Desktop Environments Different shells BASH Internal and External Commands Basic Linux Commands Important files and directories in Linux Environmental and Shell Variables Command history in Linux Character classes in Linux Text editors vim nano Searching files Creating new files Viewing File Contents File commands File permissions and ownership WildCards (Globbing) in files File compression Directory commands xargs command in Linux Comparing files Searching patterns using grep command Translating the characters using tr command Extracting data using cut command Stream editing using sed command Data extraction and reporting using awk command Sorting the file or string input uniq command in Linux Difference between grep, tr, cut, sed and awk commands Hardware commands Hard disk and memory space commands Working with Processes Managing Jobs Working with cron jobs Service command in Linux Network commands Managing Users and Groups Other Popular commands Standard streams and Redirection Pipes Package Managers in LinuxFile permissions in linux shell
A file or directory can have below types of permission attributes.- Read (r)
- Write (w)
- Execute(e)


- chmod – change the file permissions
- chown – change the ownership of the file
- chgrp – change the group of the file
chmod command in Linux
chmod command is used to change the permission of a file or directory. There are 2 ways in which we can specify the permission attributes.- symbolic
- numeric
Symbolic file permission
It is very easy to work with symbolic file permissions. Let us say you want to give write permission on abc.txt file to others(o), then you can use below syntax. Here o stands for others. + means we are adding permission. w means we are adding write permission.
chmod o+w abc.txt
If you want to remove write access from others, you can use below syntax. here – means we are removing permission.
chmod o-w abc.txt
Now let us say you want to add write permission for user of the file and at the same time remove execute permission for group. Then you can execute below command.
chmod u+w,g-x abc.txt
Numerical permissions of file
You can also use numerical representation in chmod command. BelowNumber Permission |
7 rwx |
6 rw- |
5 r-x |
4 r– |
3 -wx |
2 -w- |
1 –x |
0 — |
chmod 700 abc.txt
chown command in Linux
chown command is used to change the owner and group of a file. Here is the syntax of chown command
chown <new_user>:<new_group> file
For example – To change owner to paul and group to dev for file “abc.txt”, you can use below command.
chown paul:dev abc.txt
To change the owner and group of all files in a directory, you can use -R option.
chown -R paul:dev /home/project
chgrp command in Linux
chgrp command is used to change the group of a file. Here is the syntax of chgrp command.
chgrp <group_name> file
You can also change the group of files recursively using below syntax.
chgrp -R <group_name> directory
Note that you might need to execute the commands using sudo to avoid error saying operation not permitted.Web development and Automation testing
solutions delivered!!