Search This Blog

Wednesday, 20 July 2016

LINUX PARTITIONING AND FORMATING IN LINUX SHELL

Linux Partitioning and Formatting in filesystems for Disk Use the following Commands


pi@rasberrypia ~$ fdisk
pi@rasberrypia ~$ man fidsk
pi@rasberrypia ~$ sudo fdisk -l
pi@rasberrypia ~$ sudo fdisk /dev/sda
Command (m for help):m

Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty dos partition table
p print the partition table
q quit without saving changes
s create a new empty sunlabel
t change a partitions systems id
u change display / entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)

User the above options to create new partition in /dev/sda
After creating partitions to the drive use w to write changes made to disk

To Format Use the following commands

pi@rasberrypia ~$ sudo mkfs -t ext4 /dev/sda1

 ext 4 linux file system

User the following commands to mount the partition

pi@rasberrypia ~$ cd to /mnt

pi@rasberrypia  /mnt$

pi@rasberrypia  /mnt$ sudo mkdir part1 part2

now mount drives to these created directories

pi@rasberrypia /mnt$ sudo mount /dev/sda1 /mnt/part1

now it by going to the part1 directory and creating a file

pi@rasberrypia  /mnt$ cd part1

pi@rasberrypia  /mnt/part1$ sudo touch test1

pi@rasberrypia  /mnt/part1$ ls -la

to unmount use the following commands

pi@rasberrypia /mnt/part1$ sudo umount /dev/sda1

to Format a Fat32 created Disk Partition Use the following commands

pi@rasberrypia ~$ sudo mkfs apt-get install dostools

Format disk partition sda1 in Fat32 file system Use the following command

pi@rasberrypia ~$ sudo mkfs -t vfat /dev/sda1

we can also make partitions to disk using graphical user interface

sudo apt-get update

sudo apt-get install gparted

run

sudo gparted























Monday, 11 July 2016

LINUX PARTITIONING COMMANDS

To Partition a drive in linux use the following commands,

1. fdisk

use ' man fdisk ' to find about the format of this command

2. sudo fdisk -l

This will give you information about the disc.

3. To change partitions on the drive to make it a native linux type partition from FAT to linux type

goto

sudo fdisk /dev/sda

we are going to work with sda main device

command line will come type m to check options

to print partition tables on this drive type p

to change first delete the windows partition

press d to delete it

to verify type p

now create the new linux type partition type n

now type p to make it primary

now type the size of the partition

type +4G

type p to verifty the partition

now enter n

type also primary this will be primary partition

type partition no.

and default size of the partition if you dont want to or dont have anymore size left

now type p to verify

now type w to alter the partition

sudo fdisk -l

now we will see two partition

now to make file system ext4

use mkfs command

now type

sudo mkfs -t ext4 /dev/sda1

this will format the file system

now do the same for sda2 partition

sudo mkfs -t ext4 /dev/sda2

now we need to mount them

change to /mnt directory

cd /mnt

make two directories name them part01 and part02

sudo mkdir part01 part02

mount sda1 and sda2

for super use root use

sudo mount /dev/sda1 /mnt/part1

for specific user pi

sudo mount -o gid=pi, uid=pi /dev/sda1 /mnt/part1

for second one

sudo mount /dev/sda2 /mnt/part2

to create a file in part 1

cd part1

sudo touch test1

to check

ls -la

this show a file is created in part1 partition

to unmount a partition use

sudo unmount /dev/sda1

sudo unmount /dev/sda2

this will unmount the partition for super user root




















Sunday, 3 July 2016

LINUX FILE SYSTEM AND COMMAND LINE UNDERSTANDING

Unix Command Line Interface

To get around Unix / Linux file system we use the following commands.
But first look at the following Linux file structure,

most files in Linux are stored in directory hierarchy shown here,

                                        root       /
                                                     |
                ----------------------------------------------------------
                 home       usr            etc        bin            var          
                    |              |                 |                            |
                   Pi            bin             X11                     log



for example we have command line,

pi@raspberrypi ~ $  

home directory is

/home/pi

to find home directory use     whoami

to find present working directory use     pwd

to get back to home folder use teldar key    cd ~

to change directory use      cd /   (forward slash)  to goto root directory

to change to etc use    cd /etc

etc  store many of the system configuration files

to see the contents of etc use "  ls  "   list command

list command has certain options

ls -a  list all system files including the hidden files

ls -l will list all files length wise in a directory

ls -p will show a slash after directory so we can easily distinguish a file

from a directory

ls --color will show the types of files via color

to combine more than one option we can use " ls -lap"  option this will

combine all the previous option in one command

to take us back one directory use command " cd . . "

to take us back two directories use command " cd .. / .. "

single dot represent one current directory "  cd . "

to list the root directory component use

to root then type   ls  list command

/bin

this root folder is for commands and binaries

/sbin

sbin is for systems and admin commands

/usr

has usr related stuff it also has its own usr/bin and usr/sbin folder

/var

/var stands for variable it also has var/log folder

/home

is user directory

/mnt

this is for mount this for mounting any external drive we can even mount

folders

/dev

device interfaces for any hardware

/lib

this for programs and libraries

To make a directory
===============

use mkdir dir1

To remove a directory
=================

use rmdir dir1

this will throw an error if their is some file in the directory

but if you know what you are doing then you can do the following,

to create file in the directory use touch command

touch test

to remove and directory that contains file contents use

rmdir -rf dir1

r and f options

r stands for do the removing recursively drilling down the sub files you want to remove

f stands for force this to happen

Moving and copying files and directories
===============================

Use the cp command to copy

create a file

touch filename1

then use cp to copy one file to second file

cp filename1 filename2

To move a file from one file location to other use

mv filename1 filename2

to copy host files in etc to home/pi use

cp /etc/hosts /home/pi

to rename it use

cp /etc/hosts /home/pi/localhost

cp will work but mv will not work because user pi doesn't have permission

to modify files in etc directory

cp -R dir1 dir2

this will copy everything in this folder and beneath it

If you want to find out man command

man mv

Saturday, 18 June 2016

USEFUL LINUX COMMANDS AND DESCRIPTIONS

Linux Useful commands





LINUX UBUNTU DOMAIN JOINING SOFTWARE APP

Use Domain software tool likewise open to join a Linux system to a Microsoft windows domain. Install likewise open in linux. Use the following Linux commands in interface,

likewise open

open add/remove software tool

mark likewise -open5

likewise-open5-gui

winbind     used for installation

cli

centrify dc

domain example.net                \\this is the domain name

from command terminal

sudo domain-join-cli join example.com

restart domain

sudo /etc/init.d/ likewise-open restart

to leave domain

sudo domain-join-cli leave

client

sudo apt-get install openssh-client
server
sudo apt-get install openssh-server

--------------------------------------------------------------
How to install likewise open in linux use the following commands

sudo apt-get install likewise-open
likewise open package
/usr/bin/domainjoin-cli
sudo domainjoin-cli join example.com administrator
sudo /etc/init.d/likewise-opent restart
to leave
sudo domain-join-cli leave
if client have problem in joining add DNS
/etc/resolv.conf
nameserver 192.168.0.1
sudo add-apt-repository

--------------------------------------


For ip address configuration on interfaces in Linux user the following commands,

sudo vi /etc/network/interfaces
edit
auth0 eth0
      ifadd  eth0 inet static
      address 192.168.5.249
      mask     255.255.255.0
      network 192.168.5.0
      broadcast  192.168.5.255
      gateway 192.168.5.1
sudo vi /etc/resolv.conf

     nameserver 192.168.5.254
     nameserver 8.8.8.8
     nameserver 192.168.7.254

------------------------------------------------------
How to install Open fire collaboration chatting server in Ubuntu Linux


sudo apt-get update
sudo apt-get upgrade
sudo apt-get install python-software-properties
sudo add-apt-get-repository ppa:webupd8team/java
sudo apt-get update
check java version
#java -version
remove openJDK
sudo apt-get remove --purge openjdk*
install java oraclejava7

sudo apt-get install oracle -java7-installer

install Mysql Database server
sudo apt-get install mysql-server
create new MySQL database of openfire
login to mysql server as root
sudo mysql -u root p
create the database
"dbopenfire", add new user "openfire" and add new password "openfirepwd" for user "openfire"

to change root password

mysqladmin -u root -p password
current password
new password
service mysql stop/start

download openfire chatting and communication server software

create database

download openfire
cd /tmp
/tmp#wget http://download.igniterealtime.org/openfire/openfire_3.7.1_all.deb
install
sudo dpkg -i openfire_3.7.1_all.deb
reboot init 6
edit init.d
/etc/init.d/openfire
line 27
replace java-6-sum with java-7-oracle
sudo apt-get install rpl
sudo rpl '6-sun' '7-oracle'
/etc/init.d/openfire
sudo service openfire start
allow ports for openfire
sudo ufw allow 9090/tcp














Friday, 17 June 2016

Remove DHCP Client in Linux Ubuntu

to remove dhcp client use the following

sudo apt-get remove dhcp-client

sudo /etc/init.d/networking restart

to add linux repository

sudo add-apt-repository "deb http://us.archive.ubuntu.com/ubuntu/saucy universe multiverse

sudo add-apt-repository "deb http://us.archive.ubuntu.com/ubuntu/saucy-updates universe multiverse"

we can check

in file

/etc/apt/sources.list

deb http://archive.canonical.com/ubuntu saucy partner deb-src http://archive.canonical.com/ubuntu saucy partner


INSTALL GUI IN LINUX UBUNTU AND ASSIGN STATIC IP ADDRESS

To install GUI in linux ubuntu use the following commands,

sudo apt-get update
sudo apt-get install ubuntu-desktop
sudo apt-get install --no-install-recommends ubuntu-desktop
start x
----------------------------------------------------
sudo apt-get install xubuntu-desktop
sudo apt-get install kubuntu-desktop
-----------------------------------------------------

to chance ip address in ubuntu use the following commands,

sudo vi /etc/network/interfaces

for automatic we can use

auto etho

to assign an ip to interface use

iface etho inet static

address 0.0.0.0  
netmask 0.0.0.0
network 0.0.0.0
boradcast 0.0.0.0
gateway 0.0.0.0


DNS

sudo vi /etc/resolv.conf

on the line name server xx.xx.xx.xx
replace the x with the ip of your name server. you can do,
ifconfig/all to find out what they are.







Linux Partitioning Disk & Formatting commands

Linux Partitioning Disk & Formatting commands fdisk man fdisk pi@rasberrypi ~$ sudo fdisk -l