Administration and OS systems Management

Prepared by Nanjappa S Nagarajashetty Linux

 Developed in 1991 by Linus Torvalds  Used in most of the computers, ranging from super computers to embedded system  Multi user  Multi tasking  sharing  Monolithic kernel  Latest stable version of linux kernel – 2.6.28, released on 24-Dec-2008 Kernel types  Monolithic All OS related code are stuffed in a single module Available as a single file Advantage : Faster functioning

 Micro OS components are isolated and run in their own address space Device drivers, programs and system services run outside kernel memory space Supports modularity Lesser in size Linux Distributions

Linux distributions

Debian, Ubuntu, Linux Mint, Fedora, CentOS, openSUSE, Arch Linux and Gentoo,

Linux Enterprise Server distributions

Red Hat Enterprise Linux and SUSE Applications

 smartphones, Android, which is built on of the Linux kernel,  Largest installed base of all general-purpose operating systems  mainframe computers and virtually all fastest supercomputers  network routers,  facility automation controls,  televisions (Smart TV)  video game consoles,  smartwatches.  Home theater PC  Digital security  System rescue  In space  Education  Mail Servers  File Servers etc...

Linux file system and directory structure File Management Commands  - creating directory mkdir – removing directory and its contents rmdir dirname  – Change directory cd dirpath  – Copying files cp file1 file2  – Moving or renaming files mv oldfile newfile Commands  Help about commands man, pinfo, info (man <>)

 Viewing file’s content <>

 Viewing users, processes – List all Users who am I – List the current user pstree – displays all processes running in the system in format – displays processes owned by the current user

 Changing file permission/owner – changes file permission – changes file owner Commands

 Checking CPU and Memory utilization top

 Viewing the IP-Address Ifconfig

 Listing files in a directory – Lists all files in a directory ls –a – Lists all files (including hidden files) ls –l – Lists files in a directory along with owner information, permission etc Commands halt This command shuts down the operating system, but can only be run by the root user. reboot This command shuts down and restarts the operating system. It also can only be run by root. #reboot [will perform simple reboot] #reboot -f [will perform fast reboot ] 0 This command also shuts down the operating system, and can only be run by root. init 6 This command restart the operating system. It also can only be run by root. Commands man

This command opens the manual page for the command or utility specified. The man utility is a very useful tool. If you are unsure how to use any command, use man to access its manual page. For example, you could enter man ls the shell prompt to learn how to use the ls utility.

#man ls whoami

This command displays the username of the currently logged-in user. netstat

This command displays the status of the network, including current connections, routing tables, etc. Editor Popular text editor Just vi <> at the prompt and hit the enter key. A new file will be opened Type the contents needed and save

To save, press the Esc Key and then press : (colon) w q and then enter To quit with out saving Esc + : + q and then enter Navigation Left - h Down - j Up - k Right- l Top of the screen – H (shift + h) //caps lock will not work Middle of the screen – M (shift + m) Bottom of the screen – L (shift + l) $ - End Key, 0 – Home Key Edit Commands – X, x Copy – yy, yw – P, p Redirection and Pipes

 Redirection - Input redirection < file1 – Content of file 1 is given as input for wc command that counts the no of lines, words and characters in a file

- Output redirection cat file > newfile – Copies file’s content to newfile. Over writes the existing content cat file >> newfile – Appends the new content to the existing content

 Pipes Output of first command is input for the second and so on who | wc –l – Number of lines in the output of who command will be displayed File systems

Linux -

Extended Filesystem - ext2, ext3, ext4

Windows -

FAT16/32 --> File Allocation Table NTFS -> New Technology File System

AIX -

JFS --> Journaled File System or JFS is a 64-bit journaling file system created by IBM.

VMWARE - vmfs --> Virtual Machine File System How to Create, configure and mount a new Linux file system

1) Create one or partitions using fdisk:

fdisk /dev/sdb N (new partition) p (primary partition)

Accept default initial and end blocks if you want to create a single partiton with the whole disk

w ( the information and quit)

2) check the new partition

[root@vmractest3 root]# fdisk -l Disk /dev/sdb: 21.4 GB, 21474836480 bytes 255 heads, 63 sectors/track, 2610 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System /dev/sdb1 1 2610 20964793+ 83 Linux

3) Format the new partition as an ext3 file system type:

/sbin/mkfs -t ext3 /dev/sdb1

4)Assigning a Label with e2label

Once you have created and formated a partition, you should assign it a label using the e2label command. This allows you to add the partition to /etc/fstab using a label instead of using a device path, thereby making the system more robust.

To add a label to a partition, type the following command as root:

/sbin/e2label /dev/s db1 /oradisk

5) Then add the new partition to /etc/fstab, this way it will be mounted at reboot:

To check the label use this command:

[root@vmractest3 root]# /sbin/tune2fs -l /dev/sdb1 | volume

Filesystem volume name: /oradisk

vi /etc/fstab and add the following line:

LABEL=/oradisk /oradisk ext3 defaults 1 2 6) Mount the new file system:

First create the base directory and assign it to the user that will own it

[root@vmractest3 root]# mkdir /oradisk

[root@vmractest3 root]#chown oracle:dba /oradisk

Then mount it

[root@vmractest3 root]# mount /dev/sdb1 /oradisk

And check it

[root@vmractest3 root]# -k

Filesystem 1K-blocks Used Available Use% Mounted on

/dev/sda2 8064304 2181296 5473352 29% /

/dev/sda1 101089 9272 86598 10% /boot

none 513748 0 513748 0% /dev/shm

/dev/sdb1 20635700 32828 19554636 1% /oradisk How to Create, configure and mount a new Window file system