Loading presentation...

Present Remotely

Send the link below via email or IM

Copy

Present to your audience

Start remote presentation

  • Invited audience members will follow you as you navigate and present
  • People invited to a presentation do not need a Prezi account
  • This link expires 10 minutes after you close the presentation
  • A maximum of 30 users can follow your presentation
  • Learn more about this feature in our knowledge base article

Do you really want to delete this prezi?

Neither you, nor the coeditors you shared it with will be able to recover it again.

DeleteCancel

Make your likes visible on Facebook?

Connect your Facebook account to Prezi and let your likes appear on your timeline.
You can change this under Settings & Account at any time.

No, thanks

Presentation - Intro to Linux - Tuesday, Week 5

Presentation given at EASV, in SDM on Introduction to Linux (tuesday, week 5 - 2015).
by

Anders Skarby

on 27 January 2015

Comments (0)

Please log in to add your comment.

Report abuse

Transcript of Presentation - Intro to Linux - Tuesday, Week 5

Intro to Linux
Today's plan
Dive into Linux:
On users, groups and permissions
A look at the file system
How-to edit files
Look at bit more at VirtualBox:
Exporting and importing images
Sharing resources (files) between host and guest OS's
Linux is multi-user
A user has an username, id and optionally a home directory
A user is part of one or more groups
When a user is created, a group with his username is created as well
A group has a name and id
Creating a user
Let's create the user
bob
sudo adduser bob
Let's create the group
builders
sudo addgroup builders
sudo usermod -a -G builders bob
Let's add
bob
to the group builders
Removing a user
Let's remove the user
bob
sudo userdel -r bob
Let's remove the group
builders,
from
bob
sudo gpasswd -d bob builders
Let's remove the group
builders,
completly
sudo delgroup builders
Displaying User information
Let's get information about
bob
:
id bob
primary user id
primary group id
all group ids
The terminal
Working with a terminal interface is awesome, because:
it's very expressive
information about the execution of a command is explicitly given
you can copy paste commands, try doing that through a Graphical User Interface
text commands allow for scripting utilities
Information about the User
Is stored in the file /etc/passwd, which can be seen by typing:
cat /etc/passwd
shell-interpreter
home-directory
comment-field, holds meta-data about the user
primary group id (GID)
user id (UID)
password (x means that the password is encrypted, and can be found in the file: /etc/shadow)
username
Information about the Group
Is stored in the file /etc/group, which can be seen by typing:
cat /etc/group
comma separated list of users in group (none here)
group id (GID)
password (again, x marks encrypted password). This can also indicate that password is not used (if password is not in file: /etc/shadow )
name of group
The Linux Filesystem
Everything is a file!
Linux Filesystem Fundementals
The filesystem is a tree, with a single root: '/'
Windows can have multiple drives 'C:', 'D:', 'E:'
Directory separator is a (forward) slash: '/'
Windows uses the backslash: '\'
Path separator is a colon: ':'
Windows uses the semi-colon: ';'
Filesystem structure
Filesystem structure - continued
/bin
/boot
/dev
/etc
/home
/lib
/media
/mnt
/opt
/proc
/root
/sbin
/srv
/tmp
/usr
/var
Essential Linux Commands
List contents of current directory:
A file is a file
A device is a file
A link to somewhere else on the filesystem is a file
Contains essential commands
Contains files related to booting and the kernel
All devices on the system
Configuration files
Home directories for users on the system
System libraries
Ubuntu specific, for auto-mounting USB and CD-ROM
References to mounted filesystems (network, USB, etc.)
Static app packages (when apps doesn't fit into this tree)
Contains info about running processes, the kernel, network etc.
The Home directory for the super user (root)
Like /bin but specifically for system specific executables
Site-specific data served by services on system
Directory for holding temporary files
User space (will contain similar structure to this)
Variable data (like logs, spool files, mail etc.)
The super user
A user named 'root'
Has access to read and write to everything
Be careful, cause 'write to everything' means that you can delete everything as well
To perform something as root, you type:
sudo <command>
where
<command>
should be replaced with the
actual command you want to execute
ls
List contents of a specific directory (eg. /var):
ls /var
See contents of a file (eg. /tmp/somefile.txt):
less /tmp/somefile.txt
You navigate by pressing the arrow keys
'q' exits the utility
'spacebar' moves ahead 1 page
Delete a file (eg. /tmp/somefile.txt):
rm /tmp/somefile.txt
Delete a folder, including all it's contents (eg. /tmp/folder):
rm -rf /tmp/folder
Get help with a command (eg. ls)
man ls
Navigating the Linux Filesystem
Changing to another directory (eg. /tmp):
cd /tmp
Changing to the parent directory (one level up):
cd ..
Changing to the directory you're currently in:
cd .
Really doesn't make sense to do this, but it's good to know that "this directory" is named ',' (dot)
Using the Nano text editor
Open a file for editing (eg. /tmp/somefile.txt):
Assignments
Export the working VirtualBox image you have
Import the image on a class mate's computer
Set up a shared folder, so that you can read files from your computer in Ubuntu
Create a file in the shared folder, containing the text "Hello World"
Create 3 users named 'donny', 'danny' and 'daniel'
Add 'donny' and 'danny' to a group named 'darko' (you need to create it first)
Add 'daniel' to the group named 'dummy' (you need to create this as well)
Create a file named 'test.txt' and assign it to the group 'dummy'
Give write access to the group and read access to others
Try to delete the file 'test.txt' as donny
Now try to delete it as daniel
Remove 'donny' from the 'darko'-group
nano /tmp/somefile.txt
Exit nano:
CTRL + X
Write the file that you've got opened:
CTRL + O
if the file doesn't exist, a new file will be created when saving
Display the help:
CTRL + G
there's also a command bar at the bottom, that's visible at all times.
notice:
^ means the CTRL-key
No, you don't need to complete all, but get as far as you can :)
http://www.binarytides.com/vbox-guest-additions-ubuntu-14-04/
Modifying ownership and permissions of files
We can change ownership, both user and group by typing:
Ownership of files
To display extensive information about the current folder, type:
ls -lha
10 characters:
1 character describes type: '-' for file, 'd' for directory, 'l' for link
Next 9 characters are groups of 3, which contains permissions, on the form:
rwx - 1st is owner's, 2nd is group's, 3rd is "everyone else's" permissions
number of links or directories inside directory
user who is the owner of the directory
group who is the owner of the directory
group who is the owner of the directory
last modified
name of directory
chown bob:builder ./somefile.txt
user
group
We can change permissions by typing:
chmod u=r ./somefile.txt
Or add a permission by typing:
Or remove a permission by typing:
chmod u+r ./somefile.txt
chmod u-r ./somefile.txt
location of file to change ownership for
Full transcript