1 begin to use linux. 2 background linux is an operating system similar to unix. it runs on many...
TRANSCRIPT
![Page 1: 1 Begin to use Linux. 2 Background Linux is an operating system similar to UNIX. It runs on many different computers and was first released in 1991](https://reader036.vdocument.in/reader036/viewer/2022062519/5697bfbd1a28abf838ca2055/html5/thumbnails/1.jpg)
1
Begin to use Linux
![Page 2: 1 Begin to use Linux. 2 Background Linux is an operating system similar to UNIX. It runs on many different computers and was first released in 1991](https://reader036.vdocument.in/reader036/viewer/2022062519/5697bfbd1a28abf838ca2055/html5/thumbnails/2.jpg)
2
Background Linux is an operating system similar to
UNIX. It runs on many different computers and was first released in 1991.
The source code is opened, that is, available at no cost to anyone who wants to modify it.
There are of different versions of Linux in the market.
Want to learn more? Go to http://www.vbird.org
![Page 3: 1 Begin to use Linux. 2 Background Linux is an operating system similar to UNIX. It runs on many different computers and was first released in 1991](https://reader036.vdocument.in/reader036/viewer/2022062519/5697bfbd1a28abf838ca2055/html5/thumbnails/3.jpg)
3
Packages inside Linux Apache, the most popular web server in the
world. vsftp, very secure file transfer protocol server. Samba, let Linux become a Windows File
Server. SendMail, SMTP server DHCP Server Bind, DNS Server MySQL, PostgresSQL, Database Server iptables – A powerful firewall
![Page 4: 1 Begin to use Linux. 2 Background Linux is an operating system similar to UNIX. It runs on many different computers and was first released in 1991](https://reader036.vdocument.in/reader036/viewer/2022062519/5697bfbd1a28abf838ca2055/html5/thumbnails/4.jpg)
4
Try Linux with Putty Putty is a Remote Shell which can let users
run his own linux shell in a remote site Open Putty in your Windows. Under Host Name type: ictlab.tyict.vtc.edu.hk Protocol MUST use SSH. Click ‘Open’ to open a ssh terminal. Username: your student id Password: your HKID without bracket and
MUST USE UPPER CASE, e.g G123456A
![Page 5: 1 Begin to use Linux. 2 Background Linux is an operating system similar to UNIX. It runs on many different computers and was first released in 1991](https://reader036.vdocument.in/reader036/viewer/2022062519/5697bfbd1a28abf838ca2055/html5/thumbnails/5.jpg)
5
Directories Linux use ‘/’ as directories parser (Windows use ‘\’),
e.g. /home/alan. Files name and Directories name in Linux is case
sensitive. No Drives (A:, C: or D: ) name in Linux, you need to
‘mount’ a floppy or CD-ROM drives to a directories All directories are started from ‘root directory /’ Each user has his/her ‘home directory’. For user
‘alan’, by default, his home directory is ‘/home/alan’.
Home directory for Super User ‘root’ is ‘/root’
![Page 6: 1 Begin to use Linux. 2 Background Linux is an operating system similar to UNIX. It runs on many different computers and was first released in 1991](https://reader036.vdocument.in/reader036/viewer/2022062519/5697bfbd1a28abf838ca2055/html5/thumbnails/6.jpg)
6
Commands to access Directories All commands in Linux is case sensitive cd /etc
Change directory to /etc cd ~
Change to your home directory cd ..
Move to the parent directory of the current directory.
cd - Move back to the previous directory you were in.
![Page 7: 1 Begin to use Linux. 2 Background Linux is an operating system similar to UNIX. It runs on many different computers and was first released in 1991](https://reader036.vdocument.in/reader036/viewer/2022062519/5697bfbd1a28abf838ca2055/html5/thumbnails/7.jpg)
7
Commands to access Directories (2) ls -al
List all files or directories name in long format under current directory
pwd Display current directory's absolute path.
mkdir work Create the directory ‘work’ in the current directory.
mkdir -p work/reports/2001/oct Create the directory work/reports/2001/oct, creating
parent (-p) directories (work, work/reports, work/reports/2001) as required without danger of overwriting existing directories.
![Page 8: 1 Begin to use Linux. 2 Background Linux is an operating system similar to UNIX. It runs on many different computers and was first released in 1991](https://reader036.vdocument.in/reader036/viewer/2022062519/5697bfbd1a28abf838ca2055/html5/thumbnails/8.jpg)
8
Commands to access Files cp a.txt backup/a_bk.txt
Copy the file a.txt across to the directory backup and rename it a_bk.txt.
cp -r a b Copy the directory a into the directory b. The -r means
recursive (i.e. the files and subdirectories contained in the directory, plus the files and subdirectories contained in the subdirectories, and so on).
mv a.txt work/reports Move the file a.txt across to the directory work/reports.
mv a.txt b.txt When you move a file to its current location, you rename
it. In this case the file a.txt is renamed b.txt.
![Page 9: 1 Begin to use Linux. 2 Background Linux is an operating system similar to UNIX. It runs on many different computers and was first released in 1991](https://reader036.vdocument.in/reader036/viewer/2022062519/5697bfbd1a28abf838ca2055/html5/thumbnails/9.jpg)
9
Commands to access Files (2) rm a.txt
Remove the file a.txt. rm -r work/reports
To remove a directory (even an empty one) you need to add -r. Here the directory work/reports is removed.
touch report.txt Create an empty file (in this case report.txt), or if it
already exists, update its access and modification time. less dirs.txt
View the dirs.txt file in the less program, allowing you to view large files, line by line. (Press q to quit.)
![Page 10: 1 Begin to use Linux. 2 Background Linux is an operating system similar to UNIX. It runs on many different computers and was first released in 1991](https://reader036.vdocument.in/reader036/viewer/2022062519/5697bfbd1a28abf838ca2055/html5/thumbnails/10.jpg)
10
Linux Installation Press Enter for the first screen. In each of the following steps, press ‘OK’ to
proceed to the next step. (You can press ‘Tab’ to move your cursor to ‘OK’)
Select ‘English’ for language. Select ‘US’ for keyboard. Select ‘HTTP’ for media. Select ‘DHCP’ for ip address.
![Page 11: 1 Begin to use Linux. 2 Background Linux is an operating system similar to UNIX. It runs on many different computers and was first released in 1991](https://reader036.vdocument.in/reader036/viewer/2022062519/5697bfbd1a28abf838ca2055/html5/thumbnails/11.jpg)
11
Linux Installation (2) In Server name field, enter
ictlab.tyict.vtc.edu.hk In Directory field, enter
/ftp/fedora/linux/core/4/i386/os A graphical screen will comes up. For Language Selection, choose ‘Chinese
(Traditional) For Install Type, choose ‘Custom’
![Page 12: 1 Begin to use Linux. 2 Background Linux is an operating system similar to UNIX. It runs on many different computers and was first released in 1991](https://reader036.vdocument.in/reader036/viewer/2022062519/5697bfbd1a28abf838ca2055/html5/thumbnails/12.jpg)
12
Linux Installation (3) For Disk Partitioning Setup, choose
‘Manually partition with Disk Druid’ WARNING: YOU CANNOT TOUCH /hdc
IN YOUR DISK PARTITION! Create 3 partitions in Druid:
/, file size 10000 /home, file size 10000 Swap, file size 1000
Do not use /hdc! Do not use LVM! For the password, type ‘cmuser’.
![Page 13: 1 Begin to use Linux. 2 Background Linux is an operating system similar to UNIX. It runs on many different computers and was first released in 1991](https://reader036.vdocument.in/reader036/viewer/2022062519/5697bfbd1a28abf838ca2055/html5/thumbnails/13.jpg)
13
Linux Installation (4) For Firewall Configuration, choose:
Enable Firewall Check Remote Login, Web Server and File Transfer
WARNING: Disable SELinux! For Package Group Selection, choose:
Web Server Windows File Server FTP Server DNS Server Network Server
![Page 14: 1 Begin to use Linux. 2 Background Linux is an operating system similar to UNIX. It runs on many different computers and was first released in 1991](https://reader036.vdocument.in/reader036/viewer/2022062519/5697bfbd1a28abf838ca2055/html5/thumbnails/14.jpg)
14
Install Package with RPM Go to http://ictlab.tyict.vtc.edu.hk/~alanpo
and then download the Java Run Time (jre) RPM package to your home directory.
Open a terminal in your desktop Type following command to install (jre):
rpm -Uvh jre*.rpm Upgrades jre or installs the package if no
previous version was found. U for upgrade, v for verbose (so you know what's going on), and h for hash (to show a progress bar).
![Page 15: 1 Begin to use Linux. 2 Background Linux is an operating system similar to UNIX. It runs on many different computers and was first released in 1991](https://reader036.vdocument.in/reader036/viewer/2022062519/5697bfbd1a28abf838ca2055/html5/thumbnails/15.jpg)
15
More about RPM rpm -q jre
Query RPM database, to display version of X-Chat installed. Useful for discovering if you have something installed.
rpm -qa | sort | less To display all (-a) RPMs installed, in alphabetic
order, and in the less program. rpm -e jre
Uninstall (erase) the package webmin.
![Page 16: 1 Begin to use Linux. 2 Background Linux is an operating system similar to UNIX. It runs on many different computers and was first released in 1991](https://reader036.vdocument.in/reader036/viewer/2022062519/5697bfbd1a28abf838ca2055/html5/thumbnails/16.jpg)
16
Users Management in Linux
![Page 17: 1 Begin to use Linux. 2 Background Linux is an operating system similar to UNIX. It runs on many different computers and was first released in 1991](https://reader036.vdocument.in/reader036/viewer/2022062519/5697bfbd1a28abf838ca2055/html5/thumbnails/17.jpg)
17
root All Linux distributions setup a special
account called ‘root’ during installation. The ‘root’ account gives you access to
everything. If your shell prompt ends with a hash/number-
sign (#) you're logged-in as root. Normal user is a dollar-sign ($)
![Page 18: 1 Begin to use Linux. 2 Background Linux is an operating system similar to UNIX. It runs on many different computers and was first released in 1991](https://reader036.vdocument.in/reader036/viewer/2022062519/5697bfbd1a28abf838ca2055/html5/thumbnails/18.jpg)
18
Create a new user Only ‘root’ can create and remove user
accounts. useradd alan
Add a new user alan His home directory will be /home/alan
passwd alan Give this new account a password
finger alan List the user information of alan
![Page 19: 1 Begin to use Linux. 2 Background Linux is an operating system similar to UNIX. It runs on many different computers and was first released in 1991](https://reader036.vdocument.in/reader036/viewer/2022062519/5697bfbd1a28abf838ca2055/html5/thumbnails/19.jpg)
19
Remove a user userdel alan
Remove user alan userdel -r alan
Remove user alan and ALL THE FILES in his home directory
![Page 20: 1 Begin to use Linux. 2 Background Linux is an operating system similar to UNIX. It runs on many different computers and was first released in 1991](https://reader036.vdocument.in/reader036/viewer/2022062519/5697bfbd1a28abf838ca2055/html5/thumbnails/20.jpg)
20
su - substitute user The su command allows you to temporarily
become another user, until you press Ctrl+D to logout.
su Become root but you need to submit root’s
password su - alan
Become alan.
![Page 21: 1 Begin to use Linux. 2 Background Linux is an operating system similar to UNIX. It runs on many different computers and was first released in 1991](https://reader036.vdocument.in/reader036/viewer/2022062519/5697bfbd1a28abf838ca2055/html5/thumbnails/21.jpg)
21
Group Management (2) Arrange a GROUP of users can easily to
apply some common policies to them. Every user belongs to at least one group, their
login group - given the same name as their user account.
groupadd students This will create the students group.
usermod -G students john Add user john to the group students.
![Page 22: 1 Begin to use Linux. 2 Background Linux is an operating system similar to UNIX. It runs on many different computers and was first released in 1991](https://reader036.vdocument.in/reader036/viewer/2022062519/5697bfbd1a28abf838ca2055/html5/thumbnails/22.jpg)
22
Group Management (3) less /etc/group
Show all groups and their members. groupmod –n students tn_students
Rename a group groupdel tn_students
Remove the group tn_students groups
Display groups you belong to. groups john
Display groups john belongs to.
![Page 23: 1 Begin to use Linux. 2 Background Linux is an operating system similar to UNIX. It runs on many different computers and was first released in 1991](https://reader036.vdocument.in/reader036/viewer/2022062519/5697bfbd1a28abf838ca2055/html5/thumbnails/23.jpg)
23
Access Rights Three kinds of Access Rights:
r – read, w – write, x – execute Three kinds of people to access files:
owner, group, others To display the owner and group a file belongs to,
enter ‘ls -l’ : -rw-rw-r-- 1 john tyict 1076 Nov 20 16:50 report.txt
First column (-rw-rw-r--) is Access Right Third column (john) is owner Fourth column (tyict) is group
![Page 24: 1 Begin to use Linux. 2 Background Linux is an operating system similar to UNIX. It runs on many different computers and was first released in 1991](https://reader036.vdocument.in/reader036/viewer/2022062519/5697bfbd1a28abf838ca2055/html5/thumbnails/24.jpg)
24
Access Right (2) Here is the break of -rw-rw-r--:
Type: - for normal files, d for directories and l for Symbolic link
For owner rw-, he/she can read, write but cannot execute the file
For group rw-, same as owner For others r--, he/she can read but cannot write or
execute the file
Type Owner Group Others
- rw- rw- r--
![Page 25: 1 Begin to use Linux. 2 Background Linux is an operating system similar to UNIX. It runs on many different computers and was first released in 1991](https://reader036.vdocument.in/reader036/viewer/2022062519/5697bfbd1a28abf838ca2055/html5/thumbnails/25.jpg)
25
Change Access Right chown john report.txt
Change owner of file report.txt, to john. chown -R john .
Change owner of all files and subdirectories (i.e. -R for recursively) in the current (.) directory, to john.
chgrp tn_stundents report.txt Change group of file report.txt, to tn_stundents.
chgrp -R tn_stundents . Change group of all files and subdirectories (i.e. -R for
recursively) in the current (.) directory, to john.
![Page 26: 1 Begin to use Linux. 2 Background Linux is an operating system similar to UNIX. It runs on many different computers and was first released in 1991](https://reader036.vdocument.in/reader036/viewer/2022062519/5697bfbd1a28abf838ca2055/html5/thumbnails/26.jpg)
26
Change Access Right (2) chmod a+rw report.txt
Give all users read and write permission.
chmod go-wx report.txt Remove write and execute
permission (-wx) from report.txt for group and others (go).
For
u user (owner)
g group
o others
a all
![Page 27: 1 Begin to use Linux. 2 Background Linux is an operating system similar to UNIX. It runs on many different computers and was first released in 1991](https://reader036.vdocument.in/reader036/viewer/2022062519/5697bfbd1a28abf838ca2055/html5/thumbnails/27.jpg)
27
Change Access Right (3) Permissions can also be set in octal (base 8),
where read permission is a four, write is two, and execute is one. These you add up separately for user, group and other for between 000 (---------) and 777 (rwxrwxrwx), like so: