Академический Документы
Профессиональный Документы
Культура Документы
– Software
* Knows the installation process ( install and configure the UNIX 0S)
* To configure, install or uninstall applications (create the filesystem
* Know how to setup scheduled jobs (monitor system resource usage)
* Manage file integrity
* Create a file system: tuning up, compress file, extension
* Two Types of Files
▪ Logical Partition
▪ LVM
* Setup quota under specific users
– Users and Group Accounts
* Create and modify users and groups
* Customize user accounts
* Setup specific users that can have admin privileges
* In Module 3
Root is always used
/home/unixuser
/root
$ - user
# - root
MoDULE 2: Installation
• 3 Types of Partition
– Primary
* Has a limit number of partitions inside a single hard disk
* Maximum is 4
– Extended
* Also a primary type but can contain sub-partitions, multiple partitions
* For instance: 2 primary but 1 extended
* Also considered a primary partition type
– Logical
* Sub partitions of an extended type partition
* If extended is deleted, then logical partitions will be deleted
* Always start sda, start at partition 5
• /dev/sda
– Means primary partition of disk
– Can be configure under SATA/SCSI
• /dev/sad1
– Means first partition disk of a (sda)
• Acronyms
– SATA (sta) : serial advance technology attachment
– PATA (hda) : parallel advance technology attachment
UNIX_2 Page 1
– PATA (hda) : parallel advance technology attachment
* It much preferable since faster since it is parallel
– SCSI: small computer system interface
* A serial cable, can manage multiple hard disk drives
– The SATA is advantage than PATA since malaki ung space
• Examples:
– Give the device filename 3rd primary partition of 2nd PATA disk
*
– Give the device filename 5th logical partition of 3rd SATA
UNIX_2 Page 2
▪ -c -> Comments
▪ -d -> home directory
▪ -s -> shell
▪ -g -> GID
▪ -D
Views the default settings
▪ -m
/etc/skel
◊ List of files sometimes hidden, whenever you add the content of the /etc/skel directory
will be in to the home directory of the newly added user.
– usermod [option argument]
* Modifying an existing account
* It uses the same option of useradd except -m
* It can change id of the one user
– userdel [option]
* Option:
▪ -r -> remove
Removes, including the home directory
▪ -rf -> removes forcefully
– passwd username
* Changes the password
• Commands for group administration
– groupadd [-g groupID] groupname
* -p -> password
– groupmod [-g groupID] groupname
– groupdel groupname
• vipw
– Shortcut to vi editor /etc/passwd
– Checks if tama ung syntax
– Safer to use
• pwck
– Check syntax errors in /etc/passwd
– Checks also the /shadow
• grpch
– Checks syntax errors in /etc/group
– Checks also in /gshadow
• /etc/default/useradd
– Edits the setting in vi
• chage [-option] unixuser (OTHER COMMAND)
– Allows to view the password expiration
– If account expires, it is locked out
– If password expires, it is only the password not the entire account.
– Option:
* -l
▪ Views the password expiration
* -M
▪ Maximum day, it reached the password is really expired.
* -m
▪ Minimum day, warning lng
* -E
▪ Account expires, date
• Examples:
1) Creates a username user1 with UID=1234, home directory=/dir1/user1 and contents of skel copied to
user1
First. Create the home directory: mkdir /dir
Second. Add the user by command: useradd -u 1234 -d /dir1/user1 -m user1
Third. Add the password by command: passwd user1
2) Change primary group name of user1 to group123
First. Create group: groupadd -g 12345 group123
Second. usermod -g 12345 user1
UNIX_2 Page 3
Second. usermod -g 12345 user1
Third. To check su user1, then id
3) Create a user name user2 with UID=1235, shell = /bin/sh without using user add
First. vi /etc/passwd, goes to the last line (shift+G) and copy the last (yy then go to newline then
paste)
Second. user1:x:1234:12345:/dir1/user1:
Use P to paste after the cursor
user2:x:1235:12345:/home/user2:/bin/bash
Third. vi /etc/shadow (for password), goes to the last line (shift+G) and copy the last (yy then go to
newline then paste)
Fourth. mkdir /home/user2
Fifth. To change ownership: chown user2 /home/user2
UNIX_2 Page 4
▪ For user
Whatever users are equal to USER, it will reflect the commands of USER
▪ For Commands
Should always be an absolute path name
▪ Example:
Hi host1=(ALL) /usr1/sbin/useradd, /usr1/sbin/usermod
▪ List of aliases
User_Alias: for username
Cmnd_Alias
Host_Alias
Runas_Alias: for user
Format: Alis aliasname = value
• Examples:
1) Using aliases, allow commands chgr and chown to be executed by user1 and user2
First. User_Alias USERS=user1,user2
Second. Cmnd_Alias COMMANDS=/bin/chgrp,/bin/chown
Third. USERS ALL=(ALL) NOPASSWD:COMMANDS
* sudo !! -
▪ Executes the previous commands, only in bash
* The order doesn't matter
UNIX_2 Page 5
Reloads the configurations placed inside the inittab file
Exclusive for redhat machine
/etc/inittabl
◊ Initialization can be edited here
◊ id:runlevel:action:process
* It runs at runlevel 1,2, and 3
* id01:123:wait:/sbin/rc2.d/crond
▪ dmesg
Display the kernel loading messages during bootup
▪ /var/log/syslog
Checks the system during bootup and dmesg
MODULE7: Boatloader
• 2 types of Loader
– LILO (Linux Loader)
– GRUB (Grand Unified Boot Loader)
– Main configuration file
* /boot/grub/grub.cfg
▪ It is not recommended to edit, instead use this /etc/default/grub
Since its reflected
Icheck nya muna ung ginalaw mo, pag may mali hindi gagalawin
▪ Use update-grub to check the /boot/grub/grub.cfg
* To display the timeout
▪ GRUB_TIMEOUT_QUIET=false
* To edit boot load
▪ GRUB_TIMEOUT=1O - this is counted in seconds
▪ fdisk block_device_filename_of_disk
Take not, it is not the partition but the disk: /dev/sda
Create a partition using the method of whole diskThis set of commands make you go
to the fdisk prompt.
First. fdsik /dev/sda
Second. m , means in shows the list of the command (You are now in fdisk prompt
UNIX_2 Page 6
Second. m , means in shows the list of the command (You are now in fdisk prompt
and removed in from Linux command)
Third. p , means information of the partition table (It is recommended to always
check the partition table in every command you make)
This set of commands help create a new primary partition
First. n means new
Second. p for primary if mistake has been made, press ctrl-C to go back to Linux
command
Third. Enter
1st. Partition number: 3 or enter-default
2nd. First Section (_ - _, default _ ): 42973184 (Just look at the previous
primary disk at copy but at the last number plus 1)
3rd. Last sector (per section, per size ): +1G (Always add +)
Fourth. p to check if has been created,
This set of commands to delete:
First. d :3 to delete
Second. p to check
This set of commands for ways of quitting in the fdisk command prompt.
First. q means quit without saving
Second. w means quit with save
How to reflect (means see it apply)
– Init 6 reboot
– partprobe (Creating a file system)
First. partprobe
Second. mkdir /newfs (optional, since pwede existing)
Third. mkfs -t [file system type] 'partition name'
mkfs -t ext4 /dev/sda3
Now have a file system ,create the mounting point (This is done by dynamic access)
First. mount [partition] [directory]
mount /dev/sda3 /newfs
Associate partition with the file system
No link with partition and file system, if there's no mount
For verification:
First. mount -v
Second. df -h to be it human readable
Third. cat /etc/mtab
mtab - files containing mounted when performing unmount
Fourth. touch /newfs/file1
Fifth. cd /newfs
Sixth. ls -l
▪ fsck - assumed corrupted files are in lost+found (a directory created
every files in file system
For unmounting
– Rules in Unmounting
* Processing running or using the fs should be terminated
* No users even root should be currently using the file system as its PWD
* Every files in mountpoint is hidden and un-accessible and needs to be unmount
to be accessible
First. unmount
Even though nag umount, nakatago sya sa / ung file
Check
touch /newfs/file2
df -h /newfs
Second. umount /newfs /dev/sda3
Now have a file system ,create the mounting point (This is done by static access)
– Fstab file
Partition Mountp Fs Mount Dump can Pass fsckorder 0 if will not
device oint type options either be 0 perform a file system, the
* filename or 1 higher the value, the higher
priority
/dev/sda3 /newfs Ext4 Defaults 0 0
UNIX_2 Page 7
/dev/sda3 /newfs Ext4 Defaults 0 0
First. vi /etc/fstab
1st. Shift g and shift a then enter
2nd. /dev/sda3 /newfs ext4 defaults 0 0 (enter this in the newline)
Either go to first or second
First. mount -a
Will perform mounting filesystem on fstab
Pag wala sa fstab hindi nya ipeperform (check)
Second. mount /newfs (for specific)
Checks fstab and hahanapin nya, checks the /dev/sda3
Third. mount -v
Fourth. Init 6
Fifth. mount -v | grep sda3 - to check if mounted
▪ Example:
Create a 2 GB partition using /dev/sda3 with statically mounted on filesystem1
First. fdisk /dev/sda
Second. p
Third. Enter
Fourth. n
Fifth. Can either be 'enter' only or
1st. p for primary
2nd. l for logical
Sixth. Partition number: 3
Seventh. First sector: 42973184
Eighth. Last sectior: +2G
Ninth. p
Tenth. w
Eleventh. partprobe
Twelfth. mkdir /newfs
Thirteenth. mkfs -t ext4 /dev/sda3
Fourteenth. vi /etc/fstab
1st. Shift g and shift a then enter
2nd. /dev/sda3 /newfs ext4 defaults 0 0
Fifteenth. mount -a or mount /newfs
UNIX_2 Page 8
* Contains documentation or manual pages
13) Proc
* Special type filesystem, has mounpoint on its own and separated partition even when not during
installation
* Are critical,
* All related to processor, motherboard
14) Root
* Home directory of administrator
15) Run
* Similar with the /sys
* Obsolete filesystem
* Commonly uses in other types of linux, that separates the file sys
* Kernel is placed here
* Is a partner of sys
* Mas importante ung na kay sys
16) Sbin
* Binaris that can executed by administrator or root
17) Var
* Log file
▪ Contains a series of messages informs you what happening in your system
▪ /var/log/system - main system file
▪ /var/spool - queues for hardware
18) Srv
* Created by users for the company
19) Tmp
* World writetable file
* Anyone can access and edit it
• Static
– Cdrom
– Boot
– Opt
– Dev
– Lib
– Media
– Mnt
– Lib64
– Sys
– Run
– Usr
– Sbin
– Bin
– Lost + found
UNIX_2 Page 9
number of files you can create (ls –i /home/unixuser)
1. They are hardlinks
2. Files can have the same inode, and created by hardlinks
c. Inode mapping
▪ Related to directory entry
• File system types
1. Ext2
– Second extend file system
– Incapable of recovering from a sudden shutdown of pc
2. Ext3
– Resolves the problem of ext2
– Introduces a file system online journal,
* Snapshots of what you are doing
* Can easily be recovered once the system goes back up
* Online journal, most stable state and status
– Disadvantage, unable to handle very large files and large capacity
3. Ext4
– Resolves the problem of ext3
– Handle capacity more than 32 tB capacity storage, and more than 1 TB files
4. Reiser FS
– (reiser fs)
– Best use to handle if files that are so many but sizes are so small
* By making the metadata are compact, not to consume that is allotted for the user data
* Superblocks are too many, nagiging fragmentation
* Easier to perform defragmentation
5. HPFS (high performance file system)
– hfs
– Hpux (hp)
6. VXFS (Ventas File System)
– Use if solaris
– vxfs
7. ISO 9660
– File system type of cd
– iso966
8. MDOS
– Microsoft disk operating system
– msdos
9. NTFS
– Removable flash drive
– New technolog file system
10. FAT file allocation table
11. Joliet
– Cd
– (joliet)
12. ZFS (zettabyte file system )
– Exclusive for Solaris file system
UNIX_2 Page 10
• 2 types of numeric information
– Major [num]
* Kernel driver [num]
* Fixed
– Minor [num]
– Physical location of the device
– How to view major and minor
First. cd /dev
Second. ls -l | head
– 0XAABBC
* AA - Interface card [num]
* BB - SCSI target address (Bawat raid na connected dun sa interface card natin)
* CC - LUN (logical unit numbers)
UNIX_2 Page 11
* Relevant information of the part port
* Mod example: remove parport and then install again
First. rmmod lp ppdev parport pc (uninstall dependencies)
Second. rmmod parport
* Ways to install devices files by modules
First. modinfo lp
Second. msmod /lib
-use TAB to complete error
Error kasi hind pa install ung parport
Third. mod info parport
Fourth. ins mod /lib
Fifth. Go to Second
* Easier way
First. modprobe lp (automatic installation of the independent and other)
If lp is installed, then parport will also be installed as well.
If reboot, the system will automatically install it
UNIX_2 Page 12