Linux Essential Important Question Answer Tips Tricks

While Copy Replace if the file is exist
1)#yes | cp Source Destination { while copy if the file is already present replace answer yes }
2)Search And delete the word
#sed "/search word/d" -i file
Partition Hard disk
3))Hard disk partition
/dev/sda1 (hd0,0)
/dev/sda5 (hd5,0)
4)rsync backup script under High availability
The Root partition.
#mount /dev/sda5 /mnt/hd
#rsync -ax / /mnt/hd
Using These method we can copy only the root partition, But we can't use these to maintain the separate system,
Because pid,dev it will not make the proper update,
5) script how to create current date as folder name.
# mkdir `date +%d-%m-%y.%H:%M:%S`
30-05-11.11:23:29
6)disk label in Linux
6.1)mkfs.ext3 -L HOME /dev/hda1
6.2)e2label /dev/hda2 SECONDARY_BACKUP
while Create Swap Space
6.3)mkswap -L SWAP /dev/hda5
While using in fstabe we can use like
LABEL=HOME /home ext2 defaults 0 0
7)How to check whether Cron tab job is working or not.
#cat /var/log/cron
May 30 11:30:01 jkumar crond[5844]: (root) CMD (/usr/lib/sa/sa1 1 1)
Using cron log we can identify whether job is running at a specific time.s
8)env - environment variable it is used to maintain or modify the environment variable.
#! These sysntax is used to mention the which interpreter is used to execute the program.
#!/bin/bash
#!/usr/bin/perl
#!/usr/bin/python
1)Shell script shebang also called a hashbang it is contain the character number sign(#) and exclamation point (#!),
2)it is give the absolute path for the interpreter
How to set the Proxy Entry in the Linux
9)export http_proxy=http://proxyip:portnumber
export http_proxy=http://151.8.27.214:6588 (or)
wget -Y -e "http_proxy=host:port" url

Related post