Architecture of Linux operating system
The architecture of Linux is composed of kernel, shell and application programs that is
software.
HARDWARE: physical parts of a computer, such as central processing unit (CPU), monitor,
mouse, keyboard, hard disk and other connected devices to CPU.
KERNEL: A kernel is a computer program and is the central, core part of an operating
system. It manages the operations of the computer and the hardware, most notably
memory and CPU time. It is an integral part of any operating system.
SHELL: Shell is an environment in which we can run our commands, programs, and
shell scripts. It is a user interface for access to an operating system's services. (User interface
program execution, file system manipulation, input/output operations, communication, resource
allocation, error detection, security, and protection)
The diagram of kernel shell user relationship is as below:
THE KERNEL
1. Kernel is core (main) part of
Linux operating system.
2. It is collection of routine
communicate with hardware
directly.
3. It loads into memory when
Linux is booted.
4. Kernel provides support to
user programs through
system call.
5. Kernel manages Computer
memory, schedules process,
decides priorities of processes
and performs other tasks.
6. Kernel does lot of work even if
no application software is running.
7. Hence kernel open called as application software gateway to the computer resources.
8. Kernel is represented by /boot/vmlinuz.
Shell
1. Shell is interface between user and kernel.
2. It is outer part of operating system.
3. A shell is a user interface for access to an operating system's services Shell is an
environment in which we can run our commands, programs, software and
shell scripts.
4. Computers do not have any inherent capability of translating commands into
actions, it is done by shell.
5. There can be many shells in action - one shell for each user who logged in.
How Shell works?
When we enter commands through the keyboard, it gathers input from
you and executes programs based on that input. When a program finishes
executing, it displays that program's output. OR the shell thoroughly examines
the keyboard input for special characters. If it finds any, it rebuilds a simplified
command-line, and finally communicate with the Kernel to see that the
command is executed.
To know the running shell, use echo $SHELL command in terminal.
Application programs/software
An application, or application program, is a software program that runs on your
computer. It is excited by user. Some inbuilt application programs in Linux are
terminal, Firefox browser, Libre office.
System calls
There are over a thousand commands available in Linux operating
system. These all commands use a function to communicate with kernel - and
it is called as system call.
System call is the interface between a process and an operating system
or System calls are the only entry points into the kernel system.
Ex. 1) a typical Linux writes a file with write system call. Same system
call can access both a file and device.
2) Open system call opens both file and device. These system calls are
built into kernel. And interaction through the system calls represents and
efficient means of communication with operating system.
Basic Linux Commands
1. ls - The most frequently used command in Linux to list directories.
2. pwd - Print working directory command in Linux
3. cd - Linux command to navigate through directories.
4. mkdir - Command used to create directories in Linux.
5. mv - Move or rename files in Linux.
6. cp - Similar usage as mv but for copying files in Linux
7. rm - Delete files or directories
8. touch - Create blank/empty files
9. cat - Display file contents on the terminal
10. cat>file -delete existing none added new content
11. cat>>file – add content along with existing one (append)
12. vi- to crate file and add the content
13. :wq!- to save the file and quit
14. :q! – quit the file without save
15. :set number – to enable numbers
16. clear - Clear the terminal display
17. echo - Print any text that follows the command
18. ex: echo “welcome”> file – it will print welcome in to file
19. man - Access manual pages for all Linux commands
20. uname - Linux command to get basic information about the OS
21. whoami - Get the active username
22. tar - Command to extract and compress files in Linux
23. grep - Search for a string within an output
24. head - Return the specified number of lines from the top
25. head -5 <filename> - we can see the first five lines
26. tail - Return the specified number of lines from the bottom
27. tail -2 <filename> we can 2 lines from the bottom
28. diff - Find the difference between two files
29. cmp - Allows you to check if two files are identical
30. comm - Combines the functionality of diff and cmp
31. sort - Linux command to sort the content of a file while outputting
32. export - Export environment variables in Linux
33. zip - Zip files in Linux
34. unzip - Unzip files in Linux
35. tar -xvzf filename --- to untar tar file
36. ssh - Secure Shell command in Linux
37. service - Linux command to start and stop services systemctl start or stop
or status service
38. ps - Display active processes
39. df - Display disk filesystem information
40. sudo xfs_growfs /dev/xvda1 --- we can update increased volume reboot the
system once to update
41. mount - Mount file systems in Linux
42. ls -la – we can see all directories and files along with hidden along with
permisions
43. ls -lrt – we can see only created directories along with permissions
44. chmod - Command to change file permissions ex; chmod 744 <filename>
45. chown - Command for granting ownership of files or folders
46. ifconfig or ip addr - Display network interfaces and IP addresses
47. traceroute - Trace all the network hops to reach the destination
48. wget - Direct download files from the internet
49. iptables - Base firewall for all other firewall utilities to interface with
50. apt, pacman, yum, rpm - Package managers depending on the distro
51. sudo - Command to escalate privileges in Linux
52. cal - View a command-line calendar
53. alias - Create custom shortcuts for your regularly used commands
ex: alias rmd = ‘rm -r’
54. top - View active processes live with their system usage
note : diff between top and ps The command "ps" displays all processes time-
wise. The status of the process is irrelevant to it (running or sleeping). "top"
displays active processes in the top-ordered list.
55. useradd - Add new user ex: useradd user-1 to check the details id user-1
56. usermod -aG user1 user2 ----so here user2 is going to add into user1 group
57. cat /etc/passwd ----to check list of users with group and uid
58. passwd <user> --- to create password for user
59. cat /etc/group --- to list of groups
60. vi /etc/ssh/sshd_config -- to enable password authentication
61. cat etc/ssh/sshd_config ---to read it.
62. service sshd reload or restart –to restart service
63. id root ------to know root user and group status
64. netstat -tulpn | grep LISTEN ---to list port enable
65. ping – to hit any public domain like google
66. yum list installed ----to know the list of installations
67. id root ----- check user and group detail
68. service sshd restart
69. vi /etc/hostname to change hostname
70. tree --- to see folder structure
71. find / -name filename
72. /etc/yum.repos.d/ to check list of repose configured
73. ls -ld directory –we can see directories and permissions
We can add users into sudo permission group
Vi /etc/sudoers and add user details like below
user-1 ALL=(ALL) ALL
so now user-1 able to install any packages with sudo permission
Vi /etc/sudoers.d/90-cloud-init-users #to check ec2 configure details
The ls command in Linux
The ls command is used to list files and directories in the current working directory. This
is going to be one of the most frequently used Linux commands you must know of.
As you can see in the above image, using the command by itself without any arguments
will give us an output with all the files and directories in the directory. The command
offers a lot of flexibility in terms of displaying the data in the output.
Learn more about the ls command (link to full article)
The pwd command in Linux
The pwd command allows you to print the current working directory on your terminal. It’s
a very basic command and solves its purpose very well.
Now, your terminal prompt should usually have the complete directory anyway. But in
case it doesn’t, this can be a quick command to see the directory that you’re in. Another
application of this command is when creating scripts where this command can allow us
to find the directory where the script has been saved.
The cd command in Linux
While working within the terminal, moving around within directories is pretty much a
necessity. The cd command is one of the important Linux commands you must know
and it will help you to navigate through directories. Just type cd followed by directory as
shown below.
root@ubuntu:~# cd <directory path>
Copy
As you can see in the above command, I simply typed cd /etc/ to get into the /etc
directory. We used the pwd command to print the current working directory.
The mkdir command in Linux
The mkdir command allows you to create directories from within the terminal. The
default syntax is mkdir followed by the directory name.
root@ubuntu:~# mkdir <folder name>
Copy
As you can see in the above screenshot, we created the JournalDev directory with just
this simple command.
Learn more about the mkdir command (Link to article)
The cp and mv commands
The cp and mv commands are equivalent to the copy-paste and cut-paste in Windows.
But since Linux doesn’t really have a command for renaming files, we also make use of
the mv command to rename files and folders.
root@ubuntu:~# cp <source> <destination>
Copy
In the above command, we created a copy of the file named Sample. Let’s see how
what happens if we use the mv command in the same manner. For this demonstration,
I’ll delete the Sample-Copy file.
root@ubuntu:~# mv <source> <destination
Copy
In the above case, since we were moving the file within the same directory, it acted as
rename. The file name is now changed.
Learn more about the cp command (Link to article) and mv command (Link to article).
The rm command in Linux
In the previous section, we deleted the Sample-Copy file. The rm command is used to
delete files and folders and is one of the important Linux commands you must know.
root@ubuntu:~# rm <file name>
root@ubuntu:~# rm -r <folder/directory name>
Copy
To delete a directory, you have to add the -r argument to it. Without the -r argument, rm
command won’t delete directories.
The touch command in Linux
To create a new file, the touch command will be used. The touch keyword followed by
the file name will create a file in the current directory.
root@ubuntu:~# touch <file name>
Copy
The cat, echo, and less commands
When you want to output the contents of a file, or print anything to the terminal output,
we make use of the cat or echo commands. Let’s see their basic usage. I’ve added
some text to our New-File that we created earlier.
root@ubuntu:~# cat <file name>
root@ubuntu:~# echo <Text to print on terminal>
Copy
As you can see in the above example, the cat command when used on our “New-File”,
prints the contents of the file. At the same time, when we use echo command, it simply
prints whatever follows after the command.
The less command is used when the output printed by any command is larger than the
screen space and needs scrolling. The less command allows use to break down the
output and scroll through it with the use of the enter or space keys.
The simple way to do this is with the use of the pipe operator (|).
root@ubuntu:~# cat /boot/grub/grub.cfg | less
Copy
Learn more about the echo command(Link to article) and cat command(Link to article).
The man command in Linux
The man command is a very useful Linux command you must know. When working with
Linux, the packages that we download can have a lot of functionality. Knowing it all is
impossible.
The man pages offer a really efficient way to know the functionality of pretty much all
the packages that you can download using the package managers in your Linux distro.
root@ubuntu:~# man <command>
Copy
The uname and whoami commands
The uname and whoami commands allow you to know some basic information which
comes really handy when you work on multiple systems. In general, if you’re working
with a single computer, you won’t really need it as often as someone who is a network
administrator.
Let’s see the output of both the commands and the way we can use these.
root@ubuntu:~# uname -a
Copy
The parameter -a which I’ve supplied to uname, stands for “all”. This prints out the
complete information. If the parameter is not added, all you will get as the output is
“Linux”.
The tar, zip, and unzip commands
The tar command in Linux is used to create and extract archived files in Linux. We can
extract multiple different archive files using the tar command.
To create an archive, we use the -c parameter and to extract an archive, we use the -x
parameter. Let’s see it working.
#Compress
root@ubuntu:~# tar -cvf <archive name> <files seperated by space>
#Extract
root@ubuntu:~# tar -xvf <archive name>
Copy
In the first line, we created an archive named Compress.tar with the New-File and
New-File-Link. In the next command, we have extracted those files from the archive.
Now coming to the zip and unzip commands. Both these commands are very straight
forward. You can use them without any parameters and they’ll work as intended. Let’s
see an example below.
root@ubuntu:~# zip <archive name> <file names separated by space>
root@ubuntu:~# unzip <archive name>
Copy
Since we already have those files in the same directory, the unzip command prompts us
before overwriting those files.
Learn more about the tar command (Link to article) and zip and unzip commands (Link
to article)
The grep command in Linux
If you wish to search for a specific string within an output, the grep command comes
into the picture. We can pipe (|) the output to the grep command and extract the
required string.
root@ubuntu:~# <Any command with output> | grep "<string to find>"
Copy
This was a simple demonstration of the command. Learn more about the grep
command (Link to article)
The head and tail commands
When outputting large files, the head and the tail commands come in handy. I’ve
created a file named “Words” with a lot of words arranged alphabetically in it. The head
command will output the first 10 lines from the file, while the tail command will output
the last 10. This also includes any blank lines and not just lines with text.
root@ubuntu:~# head <file name>
root@ubuntu:~# tail <file name>
Copy
As you can see, the head command showed 10 lines from the top of the file.
The tail command outputted the bottom 10 lines from the file.
Learn more about the tail command(Link to article)
The diff, comm, and cmp commands
Linux offers multiple commands to compare files. The diff, comm, and cmp commands
compare differences and are some of the most useful Linux commands you must know.
Let’s see the default outputs for all the three commands.
root@ubuntu:~# diff <file 1> <file 2>
Copy
As you can see above, I’ve added a small piece of text saying “This line is edited” to the
New-File-Edited file.
root@ubuntu:~# cmp <file 1> <file 2>
Copy
The cmp command only tells use the line number which is different. Not the actual text.
Let’s see what the comm command does.
root@ubuntu:~# comm <file 1> <file2>
Copy
The text that’s aligned to the left is the text that’s only present in file 1. The center-
aligned text is present only in file 2. And the right-aligned text is present in both the files.
By the looks of it, comm command makes the most sense when we’re trying to compare
larger files and would like to see everything arranged together.
The sort command in Linux
The sort command will provide a sorted output of the contents of a file. Let’s use the
sort command without any parameters and see the output.
The basic syntax of the sort command is:
root@ubuntu:~# sort <filename>
Copy
The ssh command in Linux
The ssh command allows us to connect to an external machine on the network with the
use of the ssh protocol. The basic syntax of the ssh command is:
root@ubuntu:~ -->> ssh username@hostname
Copy
Learn more about ssh command(Link to article)
The service command in Linux
The service command in Linux is used for starting and stopping different services within
the operating system. The basic syntax of the command is as below.
root@ubuntu:~ -->> service ssh status
root@ubuntu:~ -->> service ssh stop
root@ubuntu:~ -->> service ssh start
Copy
As you can see in the image, the ssh server is running on our system.
root@ubuntu:~ -->> mount /dev/cdrom /mnt
root@ubuntu:~ -->> df -h
Copy
In the above case, /dev/cdrom is the device that needs to be mounted. Usually, a
mountable device is found inside the /dev folder. /mnt is the destination folder to mount
the device to. You can change it to any folder you want but I’ve used /mnt as it’s pretty
much a system default folder for mounting devices.
To see the mounted devices and get more information about them, we make use of the
df command. Just typing df will give us the data in bytes which is not readable. So we’ll
use the -h parameter to make the data human-readable.
Learn more about the df command(Link to article)
The chmod and chown commands
The chmod and chown commands give us the functionality to change the file
permissions and file ownership are the most important Linux commands you should
know.
The main difference between the functions of the two commands is that the chmod
command allows changing file permissions, while chown allows us to change the file
owners.
The default syntax for both the commands is chmod <parameter>
filename and chown user:group filename
root@ubuntu:~ -->> chmod +x loop.sh
root@ubuntu:~ -->> chmod root:root loop.sh
Copy
In the above example, we’re adding executable permissions to the loop.sh file with
the chmod command. Apart from that, with the chown command, we’ve made it
accessible only by root user and users within the root group.
As you will notice, the root root part is now changed to www-data which is the new
user who has full file ownership.
Learn more about the chmod command(Link to article) and chown command (Link to
article)
The ifconfig and traceroute commands
Moving on to the networking section in Linux, we come across the ifconfig and
traceroute commands which will be frequently used if you manage a network.
The ifconfig command will give you the list of all the network interfaces along with the IP
addresses, MAC addresses and other information about the interface.
root@ubuntu:~ -->> ifconfig
Copy
There are multiple parameters that can be used but we’ll work with the basic command
here.
When working with traceroute, you can simply specify the IP address, the hostname or
the domain name of the endpoint.
root@ubuntu:~ -->> traceroute <destination address>
Copy
Now obviously, localhost is just one hop (which is the network interface itself). You can
try this same command with any other domain name or IP address to see all the routers
that your data packets pass through to reach the destination.
Learn more about the ifconfig command(Link to article)
The wget command in Linux
If you want to download a file from within the terminal, the wget command is one of the
handiest command-line utilities available. This will be one of the important Linux
commands you should know when working with source files.
When you specify the link for download, it has to directly be a link to the file. If the file
cannot be accessed by the wget command, it will simply download the webpage in
HTML format instead of the actual file that you wanted.
Let’s try an example. The basic syntax of the wget command is :
root@ubuntu:~ -->> wget <link to file>
OR
root@ubuntu:~ -->> wget -c <link to file>
The sudo command in Linux
“With great power, comes great responsibility”
This is the quote that’s displayed when a sudo enabled user(sudoer) first makes use of
the sudo command to escalate privileges. This command is equivalent to having logged
in as root (based on what permissions you have as a sudoer).
non-root-user@ubuntu:~# sudo <command you want to run>
Password:
Copy
Just add the word sudo before any command that you need to run with escalated
privileges and that’s it. It’s very simple to use, but can also be an added security risk if a
malicious user gains access to a sudoer.
Learn more about the sudo command (Link to article)
The cal command in Linux
Ever wanted to view the calendar in the terminal? Me neither! But there apparently are
people who wanted it to happen and well here it is.
The cal command displays a well-presented calendar on the terminal. Just enter the
word cal on your terminal prompt.
root@ubuntu:~# cal
root@ubuntu:~# cal May 2019
Copy
Even though I don’t need it, it’s a really cool addition! I’m sure there are people who are
terminal fans and this is a really amazing option for them.
The alias command
Do you have some commands that you run very frequently while using the terminal? It
could be rm -r or ls -l, or it could be something longer like tar -xvzf. This is one of the
productivity-boosting Linux commands you must know.
If you know a command that you run very often, it’s time to create an alias. What’s an
alias? In simple terms, it’s another name for a command that you’ve defined.
root@ubuntu:~# alias lsl="ls -l"
OR
root@ubuntu:~# alias rmd="rm -r"
Copy
Now every time you enter lsl or rmd in the terminal, you’ll receive the output that you’d
have received if you had used the full commands.
The examples here are for really small commands that you can still type by hand every
time. But in some situations where a command has too many arguments that you need
to type, it’s best to create a shorthand version of the same.
Learn more about alias command (LInk to article)
The dd command in Linux
This command was created to convert and copy files from multiple file system formats.
In the current day, the command is simply used to create bootable USB for Linux but
there still are some things important you can do with the command.
For example, if I wanted to back up the entire hard drive as is to another drive, I’ll make
use of the dd command.
root@ubuntu:~# dd if = /dev/sdb of = /dev/sda
Copy
The if and of arguments stand for input file and output file.
The whereis and whatis commands
The names of the commands make it very clear as to their functionality. But let’s
demonstrate their functionality to make things more clear.
The whereis command will output the exact location of any command that you type in
after the whereis command.
root@ubuntu:~# whereis sudo
sudo: /usr/bin/sudo /usr/lib/sudo /usr/share/man/man8/sudo.8.gz
Copy
The whatis command gives us an explanation of what a command actually is. Similar to
the whereis command, you’ll receive the information for any command that you type
after the whatis command.
root@ubuntu:~# whatis sudo
sudo (8) - execute a command as another user
Copy
The top command in Linux
A few sections earlier, we talked about the ps command. You observed that the ps
command will output the active processes and end itself.
The top command is like a CLI version of the task manager in Windows. You get a live
view of the processes and all the information accompanying those processes like
memory usage, CPU usage, etc.
To get the top command, all you need to do is type the word top in your terminal.
The useradd and usermod commands
The useradd or adduser commands are the exact same commands where adduser is
just a symbolic link to the useradd command. This command allows us to create a new
user in Linux.
root@ubuntu:~# useradd JournalDev -d /home/JD
Copy
The above command will create a new user named JournalDev with the home directory
as /home/JD.
The usermod command, on the other hand, is used to modify existing users. You can
modify any value of the user including the groups, the permissions, etc.
For example, if you want to add more groups to the user, you can type in:
root@ubuntu:~# usermod JournalDev -a -G sudo, audio, mysql
Copy
Learn more on how to create and manage users on Linux (Link to article)
The passwd command in Linux
Now that you know how to create new users, let’s also set the password for them.
The passwd command lets you set the password for your own account, or if you have
the permissions, set the password for other accounts.
The command usage is pretty simple:
root@ubuntu:~# passwd
New password:
Copy
If you add the username after passwd, you can set passwords for other users. Enter
the new password twice and you’re done. That’s it! You will have a new password set
for the user!
We can add users into sudo permission group
Vi /etc/sudoers and add user details like below
user-1 ALL=(ALL) ALL
so now user-1 able to install any packages with sudo permission
Vi /etc/sudoers.d/90-cloud-init-users #to check ec2 configure details
Linux File Ownership
Every file and directory on your Unix/Linux system is assigned 3 types of
owners, given below.
User
A user is the owner of the file. By default, the person who created a file
becomes its owner. Hence, a user is also sometimes called an owner.
Group
A user- group can contain multiple users. All users belonging to a group
will have the same Linux group permissions access to the file. Suppose you
have a project where a number of people require access to a file. Instead of
manually assigning permissions to each user, you could add all users to a
group, and assign group permission to file such that only this group
members and no one else can read or modify the files.
Other
Any other user who has access to a file. This person has neither created the
file, nor he belongs to a user group who could own the file. Practically, it
means everybody else. Hence, when you set the permission for others, it is
also referred as set permissions for the world.
Now, the big question arises how does Linux distinguish between these
three user types so that a user ‘A’ cannot affect a file which contains some
other user ‘B’s’ vital information/data. It is like you do not want your
colleague, who works on your linux computer, to view your images. This is
where Permissions set in, and they define user behavior.
Let us understand the Permission system on Linux.
Linux File Permissions
Every file and directory in your UNIX/Linux system has following 3
permissions defined for all the 3 owners discussed above.
Read: This permission give you the authority to open and read a file.
Read permission on a directory gives you the ability to lists its
content.
Write: The write permission gives you the authority to modify the
contents of a file. The write permission on a directory gives you the
authority to add, remove and rename files stored in the directory.
Consider a scenario where you have to write permission on file but
do not have write permission on the directory where the file is stored.
You will be able to modify the file contents. But you will not be able
to rename, move or remove the file from the directory.
Execute: In Windows, an executable program usually has an
extension “.exe” and which you can easily run. In Unix/Linux, you
cannot run a program unless the execute permission is set. If the
execute permission is not set, you might still be able to see/modify
the program code(provided read & write permissions are set), but not
run it.
File
Permissions in Linux/Unix
Let’s see file permissions in Linux with examples:
ls – l on terminal gives
ls - l
Here, we have highlighted ‘-rw-rw-r–‘and this weird looking code is the
one that tells us about the Unix permissions given to the owner, user group
and the world.
Here, the first ‘–‘ implies that we have selected a file.p>
Else, if it were a directory, d would have been shown.
The characters are pretty easy to remember.
r = read permission
w = write permission
x = execute permission
– = no permission
Let us look at it this way.
The first part of the code is ‘rw-‘. This suggests that the owner ‘Home’ can:
Read the file
Write or edit the file
He cannot execute the file since the execute bit is set to ‘-‘.
By design, many Linux distributions like Fedora, CentOS, ubuntu etc. will
add users to a group of the same group name as the user name. Thus, a
user ‘tom’ is added to a group named ‘tom’.
The second part is ‘rw-‘. It for the user group ‘Home’ and group-members
can:
Read the file
Write or edit the file
The third part is for the world which means any user. It says ‘r–‘. This
means the user can only:
Read the file
Changing file/directory permissions in Linux Using
‘chmod’ command
Say you do not want your colleague to see your personal images. This can
be achieved by changing file permissions.
We can use the ‘chmod’ command which stands for ‘change mode’. Using
the command, we can set permissions (read, write, execute) on a
file/directory for the owner, group and the world.
Syntax:
chmod permissions filename
There are 2 ways to use the command
1. Absolute mode
2. Symbolic mode
Absolute(Numeric) Mode in Linux
In this mode, file permissions are not represented as characters but a
three-digit octal number.
The table below gives numbers for all for permissions types.
Number Permission Type Symbol
0 No Permission —
1 Execute –x
2 Write -w-
3 Execute + Write -wx
4 Read r–
5 Read + Execute r-x
6 Read +Write rw-
7 Read + Write +Execute rwx
Let’s see the chmod permissions command in action.
In the above-given terminal window, we have changed the permissions of
the file ‘sample to ‘764’.
‘764’ absolute code says the following:
Owner can read, write and execute
Usergroup can read and write
World can only read
This is shown as ‘-rwxrw-r–
This is how you can change user permissions in Linux on file by assigning
an absolute number.
Symbolic Mode in Linux
In the Absolute mode, you change permissions for all 3 owners. In the
symbolic mode, you can modify permissions of a specific owner. It makes
use of mathematical symbols to modify the Unix file permissions.
Operator Description
+ Adds a permission to a file or directory
– Removes the permission
= Sets the permission and overrides the permissions set earlier.
The various owners are represented as –
User Denotations
u user/owner
g group
o other
a all
We will not be using permissions in numbers like 755 but characters like
rwx. Let’s look into an example
Changing Ownership and Group in Linux
For changing the ownership of a file/directory, you can use the following
command:
chown user filename
In case you want to change the user as well as group for a file or directory
use the command
chown user:group filename
Let’s see this in action
In case you want to change group-owner only, use the command
chgrp group_name filename
‘chgrp’ stands for change group.
Tip
The file /etc/group contains all the groups defined in the system
You can use the command “groups” to find all the groups you are a
member o
You can use the command newgrp to work as a member a group
other than your default group
You cannot have 2 groups owning the same file.
You do not have nested groups in Linux. One group cannot be sub-
group of other
x- eXecuting a directory means Being allowed to “enter” a dir and
gain possible access to sub-dirs
User management:
READ Access:
This means that a user has permission to open a file and view the
contents. In this example all users have read permission.
Write Access:
w (write): This permission allows users to change file details and
content
Execute (x):
Execute permission on files means the right to execute them, if they are
programs. (Files that are not programs should not be given the execute
permission.) For directories, execute permission allows you to enter the
directory (i.e., cd into it), and to access any of its files.
Note: To execute any file along with execute (X) permission read also
required to run the file