Professional Documents
Culture Documents
2
Linux Directory Structure
3
Linux Directory Structure
6
Linux Permissions
• Each file in Linux has three sets of permissions. The first set is
‘Owner’ which is the set that applies to the owner of the file.
• This is typically the person who created the file but it can be
changed (more on that later)
• The next set is ‘Group’, which is the set that applies to a user who
isn’t the Owner but is in the Group that owns the file. This can
also be changed.
• The last set is ‘Everyone’, which is the set of permissions that
applies to anyone that isn’t the Owner and isn’t in the matching
Group
7
Linux Permissions – The Long Way
• You may also hear people talk about setting permissions to ‘755’,
for example. This is a shorthand way of expressing permissions.
• Many people struggle with how to calculate this, but it’s actually
quite simple. You’ll need to know your binary though.
• Each set of permissions is represented by one digit, so the Owner
is 7, the Group is 5 and Everyone is 5
• 7 in binary is 111. Notice that there are three digits in binary and
there are three permissions, rwx. Each binary digit represents one
of the permissions. A 1 means that permission is enabled, a 0
means it is disabled.
9
Linux Permissions – The Short Way (2)
10
Linux Permissions – The Short Way (3)
11
Linux Permissions – The Shorter Way
12
Linux – Package Managers
13
Linux – apt-get
• With apt-get the ‘update’ parameter updates the list of software packages
and their versions
• sudo apt-get update
• The ‘upgrade’ parameter will upgrade your installed software packages
automatically
• sudo apt-get upgrade
• The ‘dist-upgrade’ parameter will upgrade your operating system to a newer
version
• sudo apt-get dist-upgrade
• The ‘install’ parameter will install new software
• sudo apt-get install nano
• The ‘remove’ parameter will uninstall software
• sudo apt-get remove nano
14
Linux – yum
• With yum the ‘update’ parameter upgrades your installed software packages automatically
• sudo yum update (updates all packages)
Or
• sudo yum update nano (updates the specified package)
• The ‘install’ parameter installs new software
• sudo yum install nano
• The ‘remove’ parameter uninstalls software
• sudo yum remove nano
15
Linux – dpkg
16
Linux Services
List all services in Ubuntu
service --status-all
Use Systemd to Start/Stop/Restart Services in Ubuntu
The Syntax is:
sudo systemctl [action] [service name]
To start a service:
sudo systemctl stop ufw
To stop a service:
sudo systemctl start ufw
To restart a service:
sudo systemctl restart ufw
17
Linux Services(2)
Start/Stop/Restart Services with service command on
Ubuntu
To stop a service:
To stop a service:
18
Linux Services(3)
Using Init scripts to manage services on Ubuntu
To start a service:
/etc/init.d/ufw start
To stop a service:
/etc/init.d/ufw stop
To stop a service:
/etc/init.d/ufw restart
/etc/init.d/ufw status
19
Linux Services(4)
20
K a b u l Po l y t e c h n i c U n i v e r s i t y
Thank You!
Questions?
@Zabehullah Nasiri