Step 1:- Install git # yum install git Step 2:- check the git version # git --version Step3:- sign up https://github.com/ or create a...

GIT Basics

Step 1:- Install git
# yum install git

Step 2:- check the git version
# git --version

Step3:- sign up https://github.com/ or create a free account

Step4:- Add your github email and user name to git

# git config --global user.email pranchaldixit321@gmail.com
# git config --global user.name pranchaldixit

Step5:- Add files and folders to git

Step6:- command
        on the terminal go to location of folder/project
# cd /root/Desktop/tools/git/myfolder
# git init
Initialized empty Git repository in /root/Desktop/tools/git/myfolder/.git/
# git status
# ls -al
# git status
# touch test.txt
# git status
# git add test.txt
# git status
# git commit -m "added test.txt"
# git status
# vim test.txt
# touch index.html
# git status
# git add .
# git status
# git commit -m "add index.html, modified test.txt"
# git status
# git remote add origin https://github.com/Pranchaldixit/Repo1.git
# git push -u origin master
# git log

Branching and Merging
===========================
# cd /root/Desktop/tools/git/myfolder
# git branch MyNewBranch
# git checkout MyNewBranch
# touch test2.txt
# git status
# git commit -m "added test2.txt"
# git status
# git commit  -m "added test2.txt"
# git add .
# git commit  -m "added test2.txt"
# git push -u origin MyNewBranch
# git checkout master
# ls -al
# git merge MyNewBranch
# git push -u origin master
# git branch -d MyNewBranch ===========Delete from local Machine
# git push origin --delete MyNewBranch==Delete from Main repo

========================================================================
# mkdir netauto
# cd netauto/
# ls
# vi s1
# ls
# git init
# la
# git config --global user.name "pranchal dixit"
# git config --global user.email "pranchaldixit123@gmail.com"
# git config --list
# git status
# git add s1
# git status
# git commit -m "add file s1"
# git status
# git log
# cp s1 s2
# vi s2
# vi s1
# git status
# git diff
# vi s1
# git diff
# git add .
# git status
# git diff --staged
# git commit -m "add s2 and edit s1"
# git log
# git log -p
# git rm s2
# git status
# git commit
# git log
# vi s1
# git diff
# git status
# git checkout -- s1
# git diff
# git status
# more s1
# vi s1
# git digg
# git diff
# git add s1
# git diff
# git diff --staged
# git status
# git reset HEAD s1
# git status
# git checkout -- s1
# git status
# git log --s2
# git log -- s2
# git checkout 6280 --s2
# git checkout 6280 -- s2
# ls
# git status
# git commit -m "restore s2"
# touch myapp.pyc
# touch logs/log1.log
# mkdir logs
# touch logs/log1.log
# touch logs/log2.log
# git status
# vi .gitignore
# git status
# git add .
# git commit -m "add .gitignore file"

========================================================================

# mkdir net-auto
# cd net-auto/
# ls
# vi s1
# git init
# git add s1
# git commit -m "create s1"
# cp s1 s2
# git add s2
# git commit -m "create s2"
# git log
# git log --all --decorate --oneline --graph
# alias graph="git log --all --decorate --oneline --graph"
# graph
# git branch SDN
# git branch auth
# git branch
# graph
# git checkout SDN
# graph
# vi s1
# git add s1 ; git commit -m "SDN for s1"
# graph
# cat s1
# git checkout auth
# git branch
# cat s1
# git checkout SDN
# cat s1
# git checkout auth
# vi s1
# git status
# commit -a -m "auth for s1"
# git commit -a -m "auth for s1"
# graph
# git status
# git checkout master
# git diff master..SDN
# git merge SND
# git merge SDN
# cat s1
# graph
# git branch --merged
# git branch -d SDN
# git branch -d auth
# git status
# git merge auth
# graph
# git branch --merged
# git branch -d auth
# git checlout -b dev
# git checkout -b dev
# vi s1
# git diff
# git commit -a -m "update S1 VLANS"
# git checkout master
# vi s1
# git commit a -m "update s1"
# git commit -a -m "update s1"
# graph
# git status
# git merge dev
# git status
# git merge --abort
# graph
# git status
# git merge dev
# git status
# vi s1
# git add s1
# git status
# git commit
# graph
# git branch -d dev
# git log
# git checkout 93ed315
# graph
# git checkout master
# graph
# git checkout 93ed315
# graph
# git branch stage
# graph
# git checkout stage
# graph
# git status
# git checkout master
# vi s1
# git status
# git checkout statge
# git checkout stage
# git stash
# git status
# vi s1
# git stash
# git stash list
# git stash list -p
# git stash apply
# git diff
# git commit -a -m "remove auth"
# git stash list
# git stash apply
# git diff
# git stash list
# git stash save "add yellow vlan"
# git stash list
# git stash save "add yellow vlan"
# git stash list


0 coment�rios:

Note: only a member of this blog may post a comment.

Q1:- What is docker ? Ans:- Docker is open source plateform for developers and system engineer to bulid, ship and run distributed applicat...

Docker Basics

Q1:- What is docker ?
Ans:- Docker is open source plateform for developers and system engineer to bulid, ship and run distributed application, whether on physical machine, vm, cloud. Docker is not a Linux container technology like Xen/KVM etc.
Docker provide an additional layer of abstraction and automation of operating system | virtualization on Windowa and Linux

Advantage of using Docker
==========================
Portability- In docker system, an application and its pre-req's/ dependencies can be bundled into a single container/image, which will be independent of host kernel, can be easily ported to different system.

Quik Application Deployment:- As application and it's dependencies can be bulid in single image, it make easy to quickly deploy the app.

Sharing:- you can share Docker Image with other using remote reposittories.

Lightweight:- Docker image very small, they need very low compute and storage...

Easy Maintenance:- Maintenance very quick and easy

Cost saving :- Open source Technology and don't need heavy compute

Docker containers Vs virtual Machine
=======================================

(1) Docker container can be created/deployed vary quickly as compare to virtual machine
(2) Docker container are light weight as compare to virtual machine, being light weight more container can run at same time to host
(3) Docker container make use of resources very effciently, in case of virtual machine capacity is need to be reserved (compute + storage), whereas this is not needed is case of docker container
(4) virtual machine can be migrated across servers when they are running, but docker need to be stoped before migration as there is no hypervisor layer

Docker Terminology
=====================
(1) Image:- Image are templates for the docker container
(2) Container:- Created from docker image and run the actual application
(3) Docker Daemon:- The background service on the host that manages buliding. running the container

Docker installation
====================

# yum install docker
# systemctl status docker
# systemctl start docker
# systemctl enable docker
# docker version==========check version
# docker info=============check details information of docker
# docker search centos====Search Dokcer image on internet

LAB Task
==========

Download Docker Image
# docker pull centos:centos7

To display the list of locally available images, types
#docker images

To test your new image
# docker run centos:centos7

List of docker container
#docker ps -a

checking docker networking
# docker network ls
# docker network inspact [network name]

Check Resource Consumption by running continer#
# docker status

Setting Resource limits for a docker container
# dokcer run it -c 256 -m 300M centos:centos7 /bin/bash

stop/start/Restart Operations
# docker start container ID
# docker stop container ID
# docker restart container ID

Commiting the Docker Container Updates (This command turns your container to an image)
# docker commit container ID

Adding a reposittories/Tag value to a image
# docker tag container ID

Remove/Delete a container
# docker rm container ID

checking the docker container logs
# docker logs container ID
===================================================================================
# docker version
#  docker info
#  docker search centos
#  docker search busybox
#  docker search centos7
#  docker pull centos:centos7
#  docker images
#  docker run centos:centos7 /bin/ping opera.com -c 5
#  docker run centos:centos7 uname -a
#  uname -a
#  docker -ps -a
#  docker ps -a
#  docker run centos:centos7 ifconfig -a
#  docker network ls
#  docker network inspect bridge
#  docker run -it -c 256 -m 300M centos:centos7 /bin/bash
#  docker ps -a
#  docker stop 3f1b22fabd95
#  docker start 3f1b22fabd95
#  docker restart 3f1b22fabd95
#  docker images
#  docker commit 3f1b22fabd95
#  docker images
#  docker tag 58f13433d17b test:demoimage
#  docker images
#  docker rm 58f13433d17b
#  docker ps -a
#  docker rm 64293aa5cc58
#  docker ps -a
#  docker ps -l
# docker run centos:centos7
========================================================================

Q:- Why we use custom Network Subnet for docker networking ?
Ans:- Docker container makes defaults subnet "172.17.0.0/16" for Networking. There may be many scenarios where we can not use default network due to some restrictions or in case subnet aleady use in network.

configure a custome network
=============================
# ip add show docker0
#  docker network ls
#  docker network inspect bridge
#  systemctl stop docker.service
#  systemctl status docker.service
#  ip link set dev docker0 down
#  ipp add show docker0
#  ip add show docker0
#  vim /etc/sysconfig/docker-network =========== And add this line "--bip=10.10.10.10/24"
#  systemctl start docker.service
#  ifconfig
#  ip addr show docker0
#  ip link set dev docker0 up
#  ip addr show docker0
#  brctl show
#  docker network inspect bridge
#  docker images
#  docker ps -a
#  docker run -it docker.io/centos /bin/bash
========================================================================
========================================================================
Docker Image
==============
Docker image can be descreibed as a template with all required configuration. whereas a container is a running instatnce of docker image, Like containers, image are not bound to the states i.e. image does not have states.

There are different images available from the OS/Application vendor along with the custom images from the community.

when working on container a DevOps/Application engineer generally create their own Docker image with all the customization, this enable them to launch a container quickly.

Methods for custom image creation
===================================
Interactive method:
=======================
In this way, you can download the base Docker OS image-> create container-> manually launch a shell->perform the customization-> commit the changes

This process will save your container to Docker image and that image can be stored/disributed

Automated method using Dockerfile
====================================
Dockerfile is text file with the directives/instructions for the image creation. "docker build" command is used to build the image which creates/configure the image automatically by reading the dockerfile. Dockerfile accept the information in the following format


DIRECTIVE              ARGUMENTS

Below are directives we are going to use to dockerfile

FROM:- This directive tell which base image to used to create the custome image, example centos,ubuntu,fedora etc.
RUN:-  This directive is use to define the command to be executed during the image build
ADD:-  This directive is use to define the files/directories to be copied from source to(local server) to the image during the image build
ENTYPOINT:- This directive defines container as executable
CMD:- This directive is use to define the arguments for the ENTYPOINT command
EXPOSE:- This directive defines the network ports on which container will listen

========================================================================
# mkdir -p /app/docker-image
# cd /app/docker-image
# vim Dockerfile

#use latest centos7 image
FROM centos:latest
#add the image maintainer name and email id
MAINTAINER pranchal  email pranchaldixit321@gmail.com
#update the centos image with latest available updates
RUN yum update -y
RUN yum clean all
#install network utilities, such as (ifconfig, netstat, etc)
RUN yum install net-tools -y
#install httpd web server
RUN yum install httpd -y
RUN yum clean all
#copy the index.html file from current directory to image's document root
ADD index.html /var/www/html
#define image to allow listen on port 80
EXPOSE 80
#define command to be excuted when container boots
ENTRYPOINT [ "/usr/sbin/httpd" ]
CMD [ "-D", "FOREGROUND" ]
========================================================================
# vim Dockerfile
Hello this is my first page
========================================================================
# docker build -t pranchal/apache-centos:latest .
#  docker images
#  docker run -it -d -P -h centos-apache f58bca361bb1
#  docker network inspect
#  docker network inspect bridge
#  curl 10.10.10.1:80
#  yum intall links
#  yum intall link
#  yum install link
#  yum install links
#  links 10.10.10.1:80
#  docker ps -a
#  docker exec dfb82490554f uname -a
#  docker exec dfb82490554f ps -eaf |grep httpd
#  ps -eaf |grep httpd
========================================================================

0 coment�rios:

Note: only a member of this blog may post a comment.

1) Create the "LVM" with the name "marvel" by using 21PE's from the volume group "stone". Consider the P...

RHCE-1

1) Create the "LVM" with the name "marvel" by using 21PE's from the volume group "stone". Consider the PE size as "8MB". Mount it on /mnt/secret with filesystem vfat.

solution:

# fdisk -cu /dev/vda

Command (m for help): p

Disk /dev/vda: 6442 MB, 6442450944 bytes
16 heads, 63 sectors/track, 12483 cylinders, total 12582912 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0007d1ac

Device Boot Start End Blocks Id System
/dev/vda1 * 2048 526335 262144 83 Linux
/dev/vda2 526336 9914367 4694016 8e Linux LVM

Command (m for help): n
Command action
e extended
p primary partition (1-4)
e
Partition number (1-4): 3
First sector (9914368-12582911, default 9914368):
Using default value 9914368
Last sector, +sectors or +size{K,M,G} (9914368-12582911, default 12582911):
Using default value 12582911

Command (m for help): n
Command action
l logical (5 or over)
p primary partition (1-4)
l
First sector (9916416-12582911, default 9916416):
Using default value 9916416
Last sector, +sectors or +size{K,M,G} (9916416-12582911, default 12582911): +169M

Command (m for help): p

Disk /dev/vda: 6442 MB, 6442450944 bytes
16 heads, 63 sectors/track, 12483 cylinders, total 12582912 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0007d1ac

Device Boot Start End Blocks Id System
/dev/vda1 * 2048 526335 262144 83 Linux
/dev/vda2 526336 9914367 4694016 8e Linux LVM
/dev/vda3 9914368 12582911 1334272 5 Extended
/dev/vda5 9916416 10262527 173056 83 Linux

Command (m for help): t
Partition number (1-5): 5
Hex code (type L to list codes): 8e
Changed system type of partition 5 to 8e (Linux LVM)

Command (m for help): p

Disk /dev/vda: 6442 MB, 6442450944 bytes
16 heads, 63 sectors/track, 12483 cylinders, total 12582912 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0007d1ac

Device Boot Start End Blocks Id System
/dev/vda1 * 2048 526335 262144 83 Linux
/dev/vda2 526336 9914367 4694016 8e Linux LVM
/dev/vda3 9914368 12582911 1334272 5 Extended
/dev/vda5 9916416 10262527 173056 8e Linux LVM

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.

# reboot

# pvcreate /dev/vda5
# vgcreate -s 8M stone /dev/vda5
# pvs
# vgs
# vgdisplay stone
# lvcreate -L +168M -n marvel stone
# lvs
# lvdisplay /dev/stone/marvel
# mkfs.vfat /dev/stone/marvel
# mkdir /mnt/secret
# vim /etc/fstab
--> append the following entry
/dev/stone/marvel /mnt/secret vfat defaults 0 0
--> save and exit
# mount -a
# df -Th

2) Create a group named "sysadmin"

A user curly and larry should belongs to "stooges" group as a secondary group . A user moe should not have access to interactive shell and he should not be a member of "stooges" group. passwd for all user created should be "jenny".

solution:

# groupadd sysadmin
# groupadd stooges
# useradd curly
# useradd larry
# useradd moe
# gpasswd -M curly,larry stooges
# usermod -s /sbin/nologin moe
# echo "jenny" | passwd --stdin curly
# echo "jenny" | passwd --stdin larry
# echo "jenny" | passwd --stdin moe

3) Create the Directory "/home/manager" with the following characteristics. Group ownership of "/home/manager" should go to "manager" group. The directory should be have full permission for all members off "manager" group but not to any other users accept "root". Files created under "/home/manager" should get the same group ownership is set to the "manager" group.

solution:

# mkdir /home/manager
# groupadd manager
# chgrp -R manager /home/manager
# chmod g+rwx /home/manager
# chmod g+s /home/manager
# touch /home/manager/file1
# ll /home/manager

4) Install the appropriate Kernel from ftp://instructor.example.com/updates. Your machine should boot with updated kernel.

solution:

# cd /etc/yum.repos.d/
# vim kernel123.repo
--> give the following entries
[kernel123]
name=kernel media
baseurl=ftp://instructor.example.com/updates
gpgcheck=0
--> save and exit
# cd
# yum clean all
# yum install kernel -y
# vim /etc/grub.conf
--> the "default" option should be set to "0" in order for the latest kernel to be the default kernel
-> save and exit
# reboot

5) The user sarah must configure a cron job that runs daily at 14:23. and executes "/bin/echo "hyer" and deny the user max for creating cronjob.

solution:

# useradd sarah
# useradd max
# crontab -e
--> In the VIM editor prompt give the following entry
23 14 * * * /bin/echo "hyer"
--> save and exit
# vim /etc/cron.deny
--> Give the entry as under:
max
--> save and exit

6) Resize the lvm "/dev/vgsrv/home" so that after reboot size should be in between 90MB to 160MB.

solution:

Note: Depending upon the existing size you need to determine whether to extend or reduce the volume. Here we have assumed that the existing size of the given volume is greater than the range given in the question due to which we are reducing it.

# df -Th --> to check the mount point
# lvs --> to check the existing size of the lvm
# vgdisplay vgsrv --> to determine the PE size. Here volume group is vol1
# umount /home --> assuming "/home" to be the mount point of the logical volume
# e2fsck -f /dev/vgsrv/lv1
# resize2fs /dev/vgsrv/home 160M
# lvreduce -L 160M /dev/vgsrv/home
# mount /home
# lvs
# df -Th

7) BIND THE "LDAP" FOR USER AUTHENTICATION:

Note the following:

BASE DN: dc=example,dc=com ldap path ldap://instructor.example.com/. Download the certificate from "ftp://instructor.example.com/pub/EXAMPLE-CA-CERT". ldapuserX should login into your system, where "X" is your system no.

solution:

# system-config-authentication
--> In the "User Account Database:" select "LDAP"
--> In the "LDAP Search Base DN:" type "dc=example,dc=com"(suffix in our classroom)
--> In the "LDAP Server:" type "ldap://instructor.example.com"
--> Select "Use TLS to encrypt connections"
--> Click on "Download CA Certificate" and in the appeared box type the URL "ftp://instructor.example.com/pub/EXAMPLE-CA-CERT"
--> Click on "OK"
--> In the "Authentication Method:" select "LDAP password"
--> Click on "Apply"
--> Then with the below command you should be able to view user's information

# getent passwd ldapuserX

8) Configure your system as "NTP" client for "instructor.example.com".

solution:

# system-config-date
--> In the appeared window, select "Synchronize the date and time over the network"
--> Remove all the NTP Servers from the list
--> Click on Add
--> In the appeared box, type "instructor.example.com"(NTP Server in our class)
--> Hit the "<tab>" key on the keyboard
--> Click on "Advanced Options"
--> Select "Speed up initial synchronization"
--> Click on "OK"

9) Automount the home directory for the ldapuser of your system

Note the following:

instructor.example.com(192.168.0.254) "Nfs exports" /home/guests to your system where "x" is your station ip. Ldapuser's home directory is instructor.example.com:/home/guests/ldapuserX. Ldapuser's home directory should be automounted locally beneath at /home/guests/ldapuserX. While login with any of the ldapuser then only home directory should accesible from your system that ldapuserX.

solution:

# vim /etc/auto.master
--> Append the following entry
/home/guests /etc/auto.guests
--> save and exit

--> Create the file for the slave map as specified in /etc/auto.master
# vim /etc/auto.guests
--> type the following line
ldapuserX instructor.example.com:/home/guests/ldapuserX
--> save and exit

# service autofs reload

# su - ldapuserX
Note: You should not get any home directory error

10) Copy the file /etc/fstab to /var/tmp and configure the "ACL" as mentioned. The file /var/tmp/fstab is owned by the "root". The file /var/tmp/fstab belongs to the group "root" The file /var/tmp/fstab should not be executable by other's. The user "sarah" should able to read and write to the file. The user "natasha" can neither read nor write to the file. other users (future and current) shuold be able to read /var/tmp/fstab.

solution:
Note: Before adding users check their existence

# cp /etc/fstab /var/tmp
# ls -l /var/tmp/fstab
# chmod o-x /var/tmp/fstab
# useradd sarah
# setfacl -m u:sarah:rw /var/tmp/fstab
# useradd natasha
# setfacl -m u:natasha:--- /var/tmp/fstab
# chmod o+r /var/tmp/fstab

11) Configure FTP access from your system. Clients within the local network should have anonomyous FTP access to your system.

solution:

# rpm -qa vsftpd
--> If the package is not installed then install it
# yum install vsftpd -y
# service vsftpd restart
# chkconfig vsftpd on
# cd /var/ftp
# ls
# echo "testing" >> /var/ftp/file1

12) Configure your system as "web server" for the site http://serverX.example.com. Download the web page from ftp://instructor.example.com/updates/station.html. Rename the the downloaded page as "index.html". Copy the "index.html" page to the "document root". Do not make any modifications to the content of index.html.

solution:

# rpm -qa httpd
--> If the package is not installed then install it
# yum install httpd -y
# service httpd restart
# chkconfig httpd on
# wget ftp://instructor.example.com/updates/station.html
# mv station.html index.html
# cp index.html /var/www/html

13) Create the user "dax" with uid 4223.

solution:

# useradd -u 4223 dax

14) Extend the SWAP space with "250" MB dont remove the existing swap.

solution:

# free -m--> to check the existing swap space

# fdisk -cu /dev/vda

Command (m for help): p

Disk /dev/vda: 6442 MB, 6442450944 bytes
16 heads, 63 sectors/track, 12483 cylinders, total 12582912 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0007d1ac

Device Boot Start End Blocks Id System
/dev/vda1 * 2048 526335 262144 83 Linux
/dev/vda2 526336 9914367 4694016 8e Linux LVM
/dev/vda3 9914368 12582911 1334272 5 Extended
/dev/vda5 9916416 10262527 173056 8e Linux LVM
/dev/vda6 10264576 11493375 614400 83 Linux

Command (m for help): n
Command action
l logical (5 or over)
p primary partition (1-4)
l
First sector (11495424-12582911, default 11495424):
Using default value 11495424
Last sector, +sectors or +size{K,M,G} (11495424-12582911, default 12582911): +250M

Command (m for help): p

Disk /dev/vda: 6442 MB, 6442450944 bytes
16 heads, 63 sectors/track, 12483 cylinders, total 12582912 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0007d1ac

Device Boot Start End Blocks Id System
/dev/vda1 * 2048 526335 262144 83 Linux
/dev/vda2 526336 9914367 4694016 8e Linux LVM
/dev/vda3 9914368 12582911 1334272 5 Extended
/dev/vda5 9916416 10262527 173056 8e Linux LVM
/dev/vda6 10264576 11493375 614400 83 Linux
/dev/vda7 11495424 12007423 256000 83 Linux

Command (m for help): t
Partition number (1-7): 7
Hex code (type L to list codes): 82
Changed system type of partition 7 to 82 (Linux swap / Solaris)

Command (m for help): p

Disk /dev/vda: 6442 MB, 6442450944 bytes
16 heads, 63 sectors/track, 12483 cylinders, total 12582912 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0007d1ac

Device Boot Start End Blocks Id System
/dev/vda1 * 2048 526335 262144 83 Linux
/dev/vda2 526336 9914367 4694016 8e Linux LVM
/dev/vda3 9914368 12582911 1334272 5 Extended
/dev/vda5 9916416 10262527 173056 8e Linux LVM
/dev/vda6 10264576 11493375 614400 83 Linux
/dev/vda7 11495424 12007423 256000 82 Linux swap / Solaris

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.

# reboot

# mkswap /dev/vda7
# vim /etc/fstab
--> Append the following entry
/dev/vda7 swap swap defaults 0 0
--> save and exit

# swapon -a
# free -m
# swapon -s--> to check that the new device is enabled as swap space or not

15) locate the files of owner "julie" and copy to the directory /root/found directory

solution:

# mkdir /root/found
# find / -user julie -exec cp -pf {} /root/found/ \;

16) Download file from "http://192.168.0.254/exam/sample.txt". Search lines which contains alpha-numeric words( combination of alphabets and number) and copy those lines in sorted order to /root/samplelines (output should not contain any blank lines).

solution:

# wget http://192.168.0.254/exam/sample.txt
# cat sample.txt | sort >> /root/samplelines

17) List all lines which have string "enter" from "/tmp/file1" file and copy the lines in /root/word

# grep enter /tmp/file1 >> /root/word


0 coment�rios:

Note: only a member of this blog may post a comment.