To install Gnome Desktop type this
yum groupinstall "X Window System" "GNOME Desktop Environment"
and for KDE Desktop
yum groupinstall "X Window System" "KDE (K Desktop Environment)"
Search This Blog
Tuesday, March 31, 2009
Install GNOME KDE on centOS
To install Gnome Desktop type this
yum groupinstall "X Window System" "GNOME Desktop Environment"
and for KDE Desktop
yum groupinstall "X Window System" "KDE (K Desktop Environment)"
yum groupinstall "X Window System" "GNOME Desktop Environment"
and for KDE Desktop
yum groupinstall "X Window System" "KDE (K Desktop Environment)"
TUM KAISI MOHABBAT KERTAY HO?
Main aisi mohabbat kartee hoon
Tum kaisi mohabbat kartay ho
Tum jahan pe bayth k jate ho
Main waheen pe bethi rehti hoon
Us cheez ko chooti rehti hoon
Main aisi mohabbt karti hoon
Tum jis se huns k milte ho
Main us ko dost banati hoon
Tum jis rustay par chaltay ho
Main us say aati jati hoon
Main aisi mohabbat karti hoon
Tum kaisi mohabbat kartay ho
Tum jin ko daykhtay rehtay ho
Woh khuwab....sarhanay rakhti hoon
Tum say milnay julnay k
Kitnay hi bahanay rakhti hoon
Main aisi mohabbat karti hoon
Tum kaisi mohabbat kartay ho
Tum jahan bhi bayth k jata ho
Jis cheez ko hath lagatay ho
Main waheen peh baythi rehti hoon
Us jaga ko chooti rehti hoon
Main aisi mohabbat karti hoon
Tum kaisi mohabbat kartay ho
Kuch khuwab saja kar aankhoon main
Palkon say moti chunti hoon
Koi lums agar choo jaa a to
Main pehroon us ko sochti hoon
Main...aisi mohabbat karti hoon
Tum kaisi mohabbat kartay ho
Jin logon main tum rehtay ho
Tum jin say batain kartay ho
Tum jin say huns k miltay ho
Jo tum ko achay lagtay hoon
Wohi mujh ko achay lagtay han
Main aisi mohabbat karti hoon
Tum kaisi mohabbat kartay ho
Jis bagh main subh ko jatay ho
Jis sabzay par tum chaltay ho
Jo shakh tumhain choo jati hay
Jo khushboo...tum ko bhati hay
Woh os tumharay chehray par
Jo qatra qatra girti hai
Woh titli chor k phoolon ko
Jo tum say milnay aati hai
Jo tum ko choonay aati hay
Un sab ke nazuk jazbon main
Meray dil ki dharkan basti hai
Meri rooh bhi shamil rehti hai
Tum paas raho ya door raho
Nazron main samai rehtay ho
Main tum ko takti rehti hoon
Main tum ko sochti rehti hoon
Main aisi mohabbat karti hoon
Tum kaisi mohabbat kartay ho
Her moqay par her manzar main
Main sath tumharay rehti hoon
Main chashm-e-tasavvur main aksar
Bus tum ko dekhti rehti hoon
Bus tum ko sochti rehti hoon
Main aisi mohabbat karti hoon
Tum kaisi mohabbat kartay ho
Tum kaisi mohabbat kartay ho
Tum jahan pe bayth k jate ho
Main waheen pe bethi rehti hoon
Us cheez ko chooti rehti hoon
Main aisi mohabbt karti hoon
Tum jis se huns k milte ho
Main us ko dost banati hoon
Tum jis rustay par chaltay ho
Main us say aati jati hoon
Main aisi mohabbat karti hoon
Tum kaisi mohabbat kartay ho
Tum jin ko daykhtay rehtay ho
Woh khuwab....sarhanay rakhti hoon
Tum say milnay julnay k
Kitnay hi bahanay rakhti hoon
Main aisi mohabbat karti hoon
Tum kaisi mohabbat kartay ho
Tum jahan bhi bayth k jata ho
Jis cheez ko hath lagatay ho
Main waheen peh baythi rehti hoon
Us jaga ko chooti rehti hoon
Main aisi mohabbat karti hoon
Tum kaisi mohabbat kartay ho
Kuch khuwab saja kar aankhoon main
Palkon say moti chunti hoon
Koi lums agar choo jaa a to
Main pehroon us ko sochti hoon
Main...aisi mohabbat karti hoon
Tum kaisi mohabbat kartay ho
Jin logon main tum rehtay ho
Tum jin say batain kartay ho
Tum jin say huns k miltay ho
Jo tum ko achay lagtay hoon
Wohi mujh ko achay lagtay han
Main aisi mohabbat karti hoon
Tum kaisi mohabbat kartay ho
Jis bagh main subh ko jatay ho
Jis sabzay par tum chaltay ho
Jo shakh tumhain choo jati hay
Jo khushboo...tum ko bhati hay
Woh os tumharay chehray par
Jo qatra qatra girti hai
Woh titli chor k phoolon ko
Jo tum say milnay aati hai
Jo tum ko choonay aati hay
Un sab ke nazuk jazbon main
Meray dil ki dharkan basti hai
Meri rooh bhi shamil rehti hai
Tum paas raho ya door raho
Nazron main samai rehtay ho
Main tum ko takti rehti hoon
Main tum ko sochti rehti hoon
Main aisi mohabbat karti hoon
Tum kaisi mohabbat kartay ho
Her moqay par her manzar main
Main sath tumharay rehti hoon
Main chashm-e-tasavvur main aksar
Bus tum ko dekhti rehti hoon
Bus tum ko sochti rehti hoon
Main aisi mohabbat karti hoon
Tum kaisi mohabbat kartay ho
Process ID, User ID
[Process ID]
echo $$
[User ID]
echo $UID
id
id -nu
id -u
----------------------------
echo $_ # Just called /bin/bash to run the script.
ls >/dev/null # no output from command.
echo $_ # ls
ls -al >/dev/null # no output from command.
echo $_ # -al (last argument)
$ !! # last command
$ ![any char] #last command with that character
echo $$
[User ID]
echo $UID
id
id -nu
id -u
----------------------------
echo $_ # Just called /bin/bash to run the script.
ls >/dev/null # no output from command.
echo $_ # ls
ls -al >/dev/null # no output from command.
echo $_ # -al (last argument)
$ !! # last command
$ ![any char] #last command with that character
Process ID, User ID
[Process ID]
echo $$
[User ID]
echo $UID
id
id -nu
id -u
----------------------------
echo $_ # Just called /bin/bash to run the script.
ls >/dev/null # no output from command.
echo $_ # ls
ls -al >/dev/null # no output from command.
echo $_ # -al (last argument)
$ !! # last command
$ ![any char] #last command with that character
echo $$
[User ID]
echo $UID
id
id -nu
id -u
----------------------------
echo $_ # Just called /bin/bash to run the script.
ls >/dev/null # no output from command.
echo $_ # ls
ls -al >/dev/null # no output from command.
echo $_ # -al (last argument)
$ !! # last command
$ ![any char] #last command with that character
Monday, March 30, 2009
pop-up using the linux command
xmessage - display a message or query in a window (X-based /bin/echo)
xmessage abc
xmessage abc
pop-up using the linux command
xmessage - display a message or query in a window (X-based /bin/echo)
xmessage abc
xmessage abc
How to trun off - on monitor using linux command
$xset dpms force off
$xset -dispaly:0 dpms force suspend
$xset -dispaly:0 dpms force off
$xset -dispaly:0 dpms force on
To control Energy Star (DPMS) features:
-dpms Energy Star features off
+dpms Energy Star features on
dpms [standby [suspend [off]]]
force standby
force suspend
force off
force on
(also implicitly enables DPMS features)
a timeout value of zero disables the mode
[to on after 1 min.]
$echo "xset -dispaly:0 dpms force on" | at "NOW + 1 minutes"
$echo "xset dpms force on" | at "NOW + 1 minutes"
$xset -dispaly:0 dpms force suspend
$xset -dispaly:0 dpms force off
$xset -dispaly:0 dpms force on
To control Energy Star (DPMS) features:
-dpms Energy Star features off
+dpms Energy Star features on
dpms [standby [suspend [off]]]
force standby
force suspend
force off
force on
(also implicitly enables DPMS features)
a timeout value of zero disables the mode
[to on after 1 min.]
$echo "xset -dispaly:0 dpms force on" | at "NOW + 1 minutes"
$echo "xset dpms force on" | at "NOW + 1 minutes"
How to trun off - on monitor using linux command
$xset dpms force off
$xset -dispaly:0 dpms force suspend
$xset -dispaly:0 dpms force off
$xset -dispaly:0 dpms force on
To control Energy Star (DPMS) features:
-dpms Energy Star features off
+dpms Energy Star features on
dpms [standby [suspend [off]]]
force standby
force suspend
force off
force on
(also implicitly enables DPMS features)
a timeout value of zero disables the mode
[to on after 1 min.]
$echo "xset -dispaly:0 dpms force on" | at "NOW + 1 minutes"
$echo "xset dpms force on" | at "NOW + 1 minutes"
$xset -dispaly:0 dpms force suspend
$xset -dispaly:0 dpms force off
$xset -dispaly:0 dpms force on
To control Energy Star (DPMS) features:
-dpms Energy Star features off
+dpms Energy Star features on
dpms [standby [suspend [off]]]
force standby
force suspend
force off
force on
(also implicitly enables DPMS features)
a timeout value of zero disables the mode
[to on after 1 min.]
$echo "xset -dispaly:0 dpms force on" | at "NOW + 1 minutes"
$echo "xset dpms force on" | at "NOW + 1 minutes"
Wednesday, March 25, 2009
shred - linux command to delete file
Deletes a file securely by overwriting its contents
shred -v filename (replace filename with your specific file)
The -v option is useful since it provides extra view of what exactly the shred tool is doing while you wait. On especially BIG files this could take a bit of time. The result is that your file is so thoroughly deleted it is very unlikely to ever be retrieved again. This is especially useful when trying to zap important server related files that may include confidential information like user names or hidden processes.
[root@vikas Desktop]# whatis shred
shred (1) - overwrite a file to hide its contents, and optionally delete it
[root@vikas Desktop]#
shred -v filename (replace filename with your specific file)
The -v option is useful since it provides extra view of what exactly the shred tool is doing while you wait. On especially BIG files this could take a bit of time. The result is that your file is so thoroughly deleted it is very unlikely to ever be retrieved again. This is especially useful when trying to zap important server related files that may include confidential information like user names or hidden processes.
[root@vikas Desktop]# whatis shred
shred (1) - overwrite a file to hide its contents, and optionally delete it
[root@vikas Desktop]#
shred - linux command to delete file
Deletes a file securely by overwriting its contents
shred -v filename (replace filename with your specific file)
The -v option is useful since it provides extra view of what exactly the shred tool is doing while you wait. On especially BIG files this could take a bit of time. The result is that your file is so thoroughly deleted it is very unlikely to ever be retrieved again. This is especially useful when trying to zap important server related files that may include confidential information like user names or hidden processes.
[root@vikas Desktop]# whatis shred
shred (1) - overwrite a file to hide its contents, and optionally delete it
[root@vikas Desktop]#
shred -v filename (replace filename with your specific file)
The -v option is useful since it provides extra view of what exactly the shred tool is doing while you wait. On especially BIG files this could take a bit of time. The result is that your file is so thoroughly deleted it is very unlikely to ever be retrieved again. This is especially useful when trying to zap important server related files that may include confidential information like user names or hidden processes.
[root@vikas Desktop]# whatis shred
shred (1) - overwrite a file to hide its contents, and optionally delete it
[root@vikas Desktop]#
Saturday, March 7, 2009
System Memory used total or by a process
VMSTAT
root@vikas ~]# whatis vmstat
vmstat (8) - Report virtual memory statistics
[root@vikas ~]# vmstat
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
r b swpd free buff cache si so bi bo in cs us sy id wa st
0 0 204976 18444 4732 154720 3 5 120 49 178 313 8 2 88 2 0
[root@vikas ~]# vmstat 1 2
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
r b swpd free buff cache si so bi bo in cs us sy id wa st
0 0 204976 17948 4744 154724 3 5 120 49 178 313 8 2 88 2 0
0 0 204976 17804 4744 154724 0 0 0 0 4 1050 2 1 97 0 0
FREE
[root@vikas ~]# whatis free
free (1) - Display amount of free and used memory in the system
free (3p) - free allocated memory
free [malloc] (3) - Allocate and free dynamic memory
free -m
free -m -s 5
PMAP
[root@vikas ~]# whatis pmap
pmap (1) - report memory map of a process
[root@vikas ~]#pmap pid
PS
lists all processess.
$ ps aux
[This will show memory% and process]
ps aux | awk {'print $4 " --" $11'}
ps aux | awk '{print $4"\t"$11}' | sort | uniq -c | awk '{print $2" "$1" "$3}' | sort -nr
TOP
[root@vikas ~]# whatis top
top (1) - display Linux tasks
[root@vikas ~]# top -u root
top -p 25714
top -n 2 -p 25714
top -b
[top 10 processes]
top -d 1 | head -n 17 | tail -n 11
d-delay p-pid n-iterations u-user
[root@vikas ~]# top -d 1 -n 1 | grep firefox |awk {'print $11 "\t" $13'}
30.2 firefox-bin
[root@vikas ~]#
root@vikas ~]# whatis vmstat
vmstat (8) - Report virtual memory statistics
[root@vikas ~]# vmstat
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
r b swpd free buff cache si so bi bo in cs us sy id wa st
0 0 204976 18444 4732 154720 3 5 120 49 178 313 8 2 88 2 0
[root@vikas ~]# vmstat 1 2
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
r b swpd free buff cache si so bi bo in cs us sy id wa st
0 0 204976 17948 4744 154724 3 5 120 49 178 313 8 2 88 2 0
0 0 204976 17804 4744 154724 0 0 0 0 4 1050 2 1 97 0 0
FREE
[root@vikas ~]# whatis free
free (1) - Display amount of free and used memory in the system
free (3p) - free allocated memory
free [malloc] (3) - Allocate and free dynamic memory
free -m
free -m -s 5
PMAP
[root@vikas ~]# whatis pmap
pmap (1) - report memory map of a process
[root@vikas ~]#pmap pid
PS
lists all processess.
$ ps aux
[This will show memory% and process]
ps aux | awk {'print $4 " --" $11'}
ps aux | awk '{print $4"\t"$11}' | sort | uniq -c | awk '{print $2" "$1" "$3}' | sort -nr
TOP
[root@vikas ~]# whatis top
top (1) - display Linux tasks
[root@vikas ~]# top -u root
top -p 25714
top -n 2 -p 25714
top -b
[top 10 processes]
top -d 1 | head -n 17 | tail -n 11
d-delay p-pid n-iterations u-user
[root@vikas ~]# top -d 1 -n 1 | grep firefox |awk {'print $11 "\t" $13'}
30.2 firefox-bin
[root@vikas ~]#
System Memory used total or by a process
VMSTAT
root@vikas ~]# whatis vmstat
vmstat (8) - Report virtual memory statistics
[root@vikas ~]# vmstat
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
r b swpd free buff cache si so bi bo in cs us sy id wa st
0 0 204976 18444 4732 154720 3 5 120 49 178 313 8 2 88 2 0
[root@vikas ~]# vmstat 1 2
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
r b swpd free buff cache si so bi bo in cs us sy id wa st
0 0 204976 17948 4744 154724 3 5 120 49 178 313 8 2 88 2 0
0 0 204976 17804 4744 154724 0 0 0 0 4 1050 2 1 97 0 0
FREE
[root@vikas ~]# whatis free
free (1) - Display amount of free and used memory in the system
free (3p) - free allocated memory
free [malloc] (3) - Allocate and free dynamic memory
free -m
free -m -s 5
PMAP
[root@vikas ~]# whatis pmap
pmap (1) - report memory map of a process
[root@vikas ~]#pmap pid
PS
lists all processess.
$ ps aux
[This will show memory% and process]
ps aux | awk {'print $4 " --" $11'}
ps aux | awk '{print $4"\t"$11}' | sort | uniq -c | awk '{print $2" "$1" "$3}' | sort -nr
TOP
[root@vikas ~]# whatis top
top (1) - display Linux tasks
[root@vikas ~]# top -u root
top -p 25714
top -n 2 -p 25714
top -b
[top 10 processes]
top -d 1 | head -n 17 | tail -n 11
d-delay p-pid n-iterations u-user
[root@vikas ~]# top -d 1 -n 1 | grep firefox |awk {'print $11 "\t" $13'}
30.2 firefox-bin
[root@vikas ~]#
root@vikas ~]# whatis vmstat
vmstat (8) - Report virtual memory statistics
[root@vikas ~]# vmstat
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
r b swpd free buff cache si so bi bo in cs us sy id wa st
0 0 204976 18444 4732 154720 3 5 120 49 178 313 8 2 88 2 0
[root@vikas ~]# vmstat 1 2
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
r b swpd free buff cache si so bi bo in cs us sy id wa st
0 0 204976 17948 4744 154724 3 5 120 49 178 313 8 2 88 2 0
0 0 204976 17804 4744 154724 0 0 0 0 4 1050 2 1 97 0 0
FREE
[root@vikas ~]# whatis free
free (1) - Display amount of free and used memory in the system
free (3p) - free allocated memory
free [malloc] (3) - Allocate and free dynamic memory
free -m
free -m -s 5
PMAP
[root@vikas ~]# whatis pmap
pmap (1) - report memory map of a process
[root@vikas ~]#pmap pid
PS
lists all processess.
$ ps aux
[This will show memory% and process]
ps aux | awk {'print $4 " --" $11'}
ps aux | awk '{print $4"\t"$11}' | sort | uniq -c | awk '{print $2" "$1" "$3}' | sort -nr
TOP
[root@vikas ~]# whatis top
top (1) - display Linux tasks
[root@vikas ~]# top -u root
top -p 25714
top -n 2 -p 25714
top -b
[top 10 processes]
top -d 1 | head -n 17 | tail -n 11
d-delay p-pid n-iterations u-user
[root@vikas ~]# top -d 1 -n 1 | grep firefox |awk {'print $11 "\t" $13'}
30.2 firefox-bin
[root@vikas ~]#
Friday, March 6, 2009
Making a png of "text" using convert command
[root@vikas Desktop]# convert -size 800x400 xc:white -font Times-Roman -pointsize 100 -fill red -annotate +120+150 "Anal Pandey" -fill black -annotate +170 +150 +repage anal.png
[root@vikas Desktop]# convert -size 800x400 xc:white -font Times-Roman -pointsize 100 -fill red -annotate +120+150 "Vikas Sharma" -fill black -annotate +170 +150 +repage vikass.png
[root@vikas Desktop]# convert -list type
Bilevel
ColorSeparation
ColorSeparationMatte
Grayscale
GrayscaleMatte
Optimize
Palette
PaletteBilevelMatte
PaletteMatte
TrueColorMatte
TrueColor
[root@vikas Desktop]# convert -list color
yellow1 rgb(255,255,0) X11
yellow2 rgb(238,238,0) X11
yellow3 rgb(205,205,0) X11
yellow4 rgb(139,139,0) X11
YellowGreen rgb(154,205,50) SVG X11 XPM
[root@vikas Desktop]#
[root@vikas Desktop]# convert -size 800x400 xc:white -font Times-Roman -pointsize 100 -fill red -annotate +120+150 "Vikas Sharma" -fill black -annotate +170 +150 +repage vikass.png
[root@vikas Desktop]# convert -list type
Bilevel
ColorSeparation
ColorSeparationMatte
Grayscale
GrayscaleMatte
Optimize
Palette
PaletteBilevelMatte
PaletteMatte
TrueColorMatte
TrueColor
[root@vikas Desktop]# convert -list color
yellow1 rgb(255,255,0) X11
yellow2 rgb(238,238,0) X11
yellow3 rgb(205,205,0) X11
yellow4 rgb(139,139,0) X11
YellowGreen rgb(154,205,50) SVG X11 XPM
[root@vikas Desktop]#
Making a png of "text" using convert command
[root@vikas Desktop]# convert -size 800x400 xc:white -font Times-Roman -pointsize 100 -fill red -annotate +120+150 "Anal Pandey" -fill black -annotate +170 +150 +repage anal.png
[root@vikas Desktop]# convert -size 800x400 xc:white -font Times-Roman -pointsize 100 -fill red -annotate +120+150 "Vikas Sharma" -fill black -annotate +170 +150 +repage vikass.png
[root@vikas Desktop]# convert -list type
Bilevel
ColorSeparation
ColorSeparationMatte
Grayscale
GrayscaleMatte
Optimize
Palette
PaletteBilevelMatte
PaletteMatte
TrueColorMatte
TrueColor
[root@vikas Desktop]# convert -list color
yellow1 rgb(255,255,0) X11
yellow2 rgb(238,238,0) X11
yellow3 rgb(205,205,0) X11
yellow4 rgb(139,139,0) X11
YellowGreen rgb(154,205,50) SVG X11 XPM
[root@vikas Desktop]#
[root@vikas Desktop]# convert -size 800x400 xc:white -font Times-Roman -pointsize 100 -fill red -annotate +120+150 "Vikas Sharma" -fill black -annotate +170 +150 +repage vikass.png
[root@vikas Desktop]# convert -list type
Bilevel
ColorSeparation
ColorSeparationMatte
Grayscale
GrayscaleMatte
Optimize
Palette
PaletteBilevelMatte
PaletteMatte
TrueColorMatte
TrueColor
[root@vikas Desktop]# convert -list color
yellow1 rgb(255,255,0) X11
yellow2 rgb(238,238,0) X11
yellow3 rgb(205,205,0) X11
yellow4 rgb(139,139,0) X11
YellowGreen rgb(154,205,50) SVG X11 XPM
[root@vikas Desktop]#
Hash command
[root@vikas ~]# whatis hash
hash (1p) - remember or report utility locations
hash [builtins] (1) - bash built-in commands, see bash(1)
Hash::Util (3pm) - A selection of general-utility hash subroutines
[root@vikas ~]#
[root@vikas ~]# hash
hits command
1 /bin/egrep
3 /usr/bin/whatis
2 /usr/bin/yum
2 /bin/ls
2 /usr/bin/clear
[root@vikas ~]#
hash (1p) - remember or report utility locations
hash [builtins] (1) - bash built-in commands, see bash(1)
Hash::Util (3pm) - A selection of general-utility hash subroutines
[root@vikas ~]#
[root@vikas ~]# hash
hits command
1 /bin/egrep
3 /usr/bin/whatis
2 /usr/bin/yum
2 /bin/ls
2 /usr/bin/clear
[root@vikas ~]#
Hash command
[root@vikas ~]# whatis hash
hash (1p) - remember or report utility locations
hash [builtins] (1) - bash built-in commands, see bash(1)
Hash::Util (3pm) - A selection of general-utility hash subroutines
[root@vikas ~]#
[root@vikas ~]# hash
hits command
1 /bin/egrep
3 /usr/bin/whatis
2 /usr/bin/yum
2 /bin/ls
2 /usr/bin/clear
[root@vikas ~]#
hash (1p) - remember or report utility locations
hash [builtins] (1) - bash built-in commands, see bash(1)
Hash::Util (3pm) - A selection of general-utility hash subroutines
[root@vikas ~]#
[root@vikas ~]# hash
hits command
1 /bin/egrep
3 /usr/bin/whatis
2 /usr/bin/yum
2 /bin/ls
2 /usr/bin/clear
[root@vikas ~]#
function command in terminal
function name [enter]
[then enter all statements with in { } ]
[then write the function name in terminal for output]
[root@vikas ~]# function vik
> {
> echo "vik fun"
> }
[root@vikas ~]# vik
vik fun
[root@vikas ~]# vik
vik fun
[root@vikas ~]#
[then enter all statements with in { } ]
[then write the function name in terminal for output]
[root@vikas ~]# function vik
> {
> echo "vik fun"
> }
[root@vikas ~]# vik
vik fun
[root@vikas ~]# vik
vik fun
[root@vikas ~]#
function command in terminal
function name [enter]
[then enter all statements with in { } ]
[then write the function name in terminal for output]
[root@vikas ~]# function vik
> {
> echo "vik fun"
> }
[root@vikas ~]# vik
vik fun
[root@vikas ~]# vik
vik fun
[root@vikas ~]#
[then enter all statements with in { } ]
[then write the function name in terminal for output]
[root@vikas ~]# function vik
> {
> echo "vik fun"
> }
[root@vikas ~]# vik
vik fun
[root@vikas ~]# vik
vik fun
[root@vikas ~]#
Script using for
#/bin/bash
# Enter some string as command line argument
star () {
str="$@"
len=$((${#str}+4))
for i in $(seq $len); do echo -n '*'; done;
echo; echo "* "$str" *";
for i in $(seq $len); do echo -n '*'; done;
echo
}
hash_ () {
str="$@"
len=$((${#str}+4))
for i in $(seq $len); do echo -n '#'; done;
echo; echo "# "$str" #";
for i in $(seq $len); do echo -n '#'; done;
echo
}
if [ $# = 0 ] ; then
star "You dont have entered string."
else
star "$*"
hash_ "$*"
fi
# Enter some string as command line argument
star () {
str="$@"
len=$((${#str}+4))
for i in $(seq $len); do echo -n '*'; done;
echo; echo "* "$str" *";
for i in $(seq $len); do echo -n '*'; done;
echo
}
hash_ () {
str="$@"
len=$((${#str}+4))
for i in $(seq $len); do echo -n '#'; done;
echo; echo "# "$str" #";
for i in $(seq $len); do echo -n '#'; done;
echo
}
if [ $# = 0 ] ; then
star "You dont have entered string."
else
star "$*"
hash_ "$*"
fi
Script using for
#/bin/bash
# Enter some string as command line argument
star () {
str="$@"
len=$((${#str}+4))
for i in $(seq $len); do echo -n '*'; done;
echo; echo "* "$str" *";
for i in $(seq $len); do echo -n '*'; done;
echo
}
hash_ () {
str="$@"
len=$((${#str}+4))
for i in $(seq $len); do echo -n '#'; done;
echo; echo "# "$str" #";
for i in $(seq $len); do echo -n '#'; done;
echo
}
if [ $# = 0 ] ; then
star "You dont have entered string."
else
star "$*"
hash_ "$*"
fi
# Enter some string as command line argument
star () {
str="$@"
len=$((${#str}+4))
for i in $(seq $len); do echo -n '*'; done;
echo; echo "* "$str" *";
for i in $(seq $len); do echo -n '*'; done;
echo
}
hash_ () {
str="$@"
len=$((${#str}+4))
for i in $(seq $len); do echo -n '#'; done;
echo; echo "# "$str" #";
for i in $(seq $len); do echo -n '#'; done;
echo
}
if [ $# = 0 ] ; then
star "You dont have entered string."
else
star "$*"
hash_ "$*"
fi
Thursday, March 5, 2009
All in linux IF ( conditions )
* -b file = True if the file exists and is block special file.
* -c file = True if the file exists and is character special file.
* -d file = True if the file exists and is a directory.
* -e file = True if the file exists.
* -f file = True if the file exists and is a regular file
* -g file = True if the file exists and the set-group-id bit is set.
* -k file = True if the files' "sticky" bit is set.
* -L file = True if the file exists and is a symbolic link.
* -p file = True if the file exists and is a named pipe.
* -r file = True if the file exists and is readable.
* -s file = True if the file exists and its size is greater than zero.
* -s file = True if the file exists and is a socket.
* -t fd = True if the file descriptor is opened on a terminal.
* -u file = True if the file exists and its set-user-id bit is set.
* -w file = True if the file exists and is writable.
* -x file = True if the file exists and is executable.
* -O file = True if the file exists and is owned by the effective user id.
* -G file = True if the file exists and is owned by the effective group id.
* file1 –nt file2 = True if file1 is newer, by modification date, than file2.
* file1 ot file2 = True if file1 is older than file2.
* file1 ef file2 = True if file1 and file2 have the same device and inode numbers.
* -z string = True if the length of the string is 0.
* -n string = True if the length of the string is non-zero.
* string1 = string2 = True if the strings are equal.
* string1 != string2 = True if the strings are not equal.
* !expr = True if the expr evaluates to false.
* expr1 –a expr2 = True if both expr1 and expr2 are true.
* expr1 –o expr2 = True is either expr1 or expr2 is true.
* -c file = True if the file exists and is character special file.
* -d file = True if the file exists and is a directory.
* -e file = True if the file exists.
* -f file = True if the file exists and is a regular file
* -g file = True if the file exists and the set-group-id bit is set.
* -k file = True if the files' "sticky" bit is set.
* -L file = True if the file exists and is a symbolic link.
* -p file = True if the file exists and is a named pipe.
* -r file = True if the file exists and is readable.
* -s file = True if the file exists and its size is greater than zero.
* -s file = True if the file exists and is a socket.
* -t fd = True if the file descriptor is opened on a terminal.
* -u file = True if the file exists and its set-user-id bit is set.
* -w file = True if the file exists and is writable.
* -x file = True if the file exists and is executable.
* -O file = True if the file exists and is owned by the effective user id.
* -G file = True if the file exists and is owned by the effective group id.
* file1 –nt file2 = True if file1 is newer, by modification date, than file2.
* file1 ot file2 = True if file1 is older than file2.
* file1 ef file2 = True if file1 and file2 have the same device and inode numbers.
* -z string = True if the length of the string is 0.
* -n string = True if the length of the string is non-zero.
* string1 = string2 = True if the strings are equal.
* string1 != string2 = True if the strings are not equal.
* !expr = True if the expr evaluates to false.
* expr1 –a expr2 = True if both expr1 and expr2 are true.
* expr1 –o expr2 = True is either expr1 or expr2 is true.
All in linux IF ( conditions )
* -b file = True if the file exists and is block special file.
* -c file = True if the file exists and is character special file.
* -d file = True if the file exists and is a directory.
* -e file = True if the file exists.
* -f file = True if the file exists and is a regular file
* -g file = True if the file exists and the set-group-id bit is set.
* -k file = True if the files' "sticky" bit is set.
* -L file = True if the file exists and is a symbolic link.
* -p file = True if the file exists and is a named pipe.
* -r file = True if the file exists and is readable.
* -s file = True if the file exists and its size is greater than zero.
* -s file = True if the file exists and is a socket.
* -t fd = True if the file descriptor is opened on a terminal.
* -u file = True if the file exists and its set-user-id bit is set.
* -w file = True if the file exists and is writable.
* -x file = True if the file exists and is executable.
* -O file = True if the file exists and is owned by the effective user id.
* -G file = True if the file exists and is owned by the effective group id.
* file1 –nt file2 = True if file1 is newer, by modification date, than file2.
* file1 ot file2 = True if file1 is older than file2.
* file1 ef file2 = True if file1 and file2 have the same device and inode numbers.
* -z string = True if the length of the string is 0.
* -n string = True if the length of the string is non-zero.
* string1 = string2 = True if the strings are equal.
* string1 != string2 = True if the strings are not equal.
* !expr = True if the expr evaluates to false.
* expr1 –a expr2 = True if both expr1 and expr2 are true.
* expr1 –o expr2 = True is either expr1 or expr2 is true.
* -c file = True if the file exists and is character special file.
* -d file = True if the file exists and is a directory.
* -e file = True if the file exists.
* -f file = True if the file exists and is a regular file
* -g file = True if the file exists and the set-group-id bit is set.
* -k file = True if the files' "sticky" bit is set.
* -L file = True if the file exists and is a symbolic link.
* -p file = True if the file exists and is a named pipe.
* -r file = True if the file exists and is readable.
* -s file = True if the file exists and its size is greater than zero.
* -s file = True if the file exists and is a socket.
* -t fd = True if the file descriptor is opened on a terminal.
* -u file = True if the file exists and its set-user-id bit is set.
* -w file = True if the file exists and is writable.
* -x file = True if the file exists and is executable.
* -O file = True if the file exists and is owned by the effective user id.
* -G file = True if the file exists and is owned by the effective group id.
* file1 –nt file2 = True if file1 is newer, by modification date, than file2.
* file1 ot file2 = True if file1 is older than file2.
* file1 ef file2 = True if file1 and file2 have the same device and inode numbers.
* -z string = True if the length of the string is 0.
* -n string = True if the length of the string is non-zero.
* string1 = string2 = True if the strings are equal.
* string1 != string2 = True if the strings are not equal.
* !expr = True if the expr evaluates to false.
* expr1 –a expr2 = True if both expr1 and expr2 are true.
* expr1 –o expr2 = True is either expr1 or expr2 is true.
linux script to check file or folder is empty or not
#!/bin/bash
#
ch=4
while [ $ch != 0 ]
do
clear
echo -en "To check File or Folder is empty or not\n"
echo -en "Enter 1. File\n2. Folder\n0. Exit\n"
echo -en "Enter choice 1, 2 or 0 - "
read ch
case $ch in
1) echo -en "Enter File name (path) -" ; read fl ;
if [ -f $fl ] ; then
#[ -z "$(cat $fl)" ] && echo -en "File is Empty\n" || echo -en "File is not Empty\n" ;
if [ -z "$(cat $fl)" ] ; then
echo -en "File is Empty\n"
else
echo -en "File is not Empty\n"
fi ;
else
echo -en "File is not Persent.\n"
fi
echo "Press a key. . ." ; read ;;
2) echo -en "Enter Folder name (path) -" ; read fl
if [ -d $fl ] ; then
#[ -z "$(ls -A $fl)" ] && echo -en "Folder is Empty\n" || echo -en "Folder is not Empty\n" ;
if [ -z "$(ls -A $fl)" ] ; then
echo -en "Folder is Empty\n"
else
echo -en "Folder is not Empty\n"
fi ;
else
echo -en "Folder is not Persent.\n"
fi
echo "Press a key. . ." ; read ;;
0) exit ;;
*) echo "Opps!!! Please select choice 1,2 or 0";
echo "Press a key. . ." ; read ;;
esac
done
#
ch=4
while [ $ch != 0 ]
do
clear
echo -en "To check File or Folder is empty or not\n"
echo -en "Enter 1. File\n2. Folder\n0. Exit\n"
echo -en "Enter choice 1, 2 or 0 - "
read ch
case $ch in
1) echo -en "Enter File name (path) -" ; read fl ;
if [ -f $fl ] ; then
#[ -z "$(cat $fl)" ] && echo -en "File is Empty\n" || echo -en "File is not Empty\n" ;
if [ -z "$(cat $fl)" ] ; then
echo -en "File is Empty\n"
else
echo -en "File is not Empty\n"
fi ;
else
echo -en "File is not Persent.\n"
fi
echo "Press a key. . ." ; read ;;
2) echo -en "Enter Folder name (path) -" ; read fl
if [ -d $fl ] ; then
#[ -z "$(ls -A $fl)" ] && echo -en "Folder is Empty\n" || echo -en "Folder is not Empty\n" ;
if [ -z "$(ls -A $fl)" ] ; then
echo -en "Folder is Empty\n"
else
echo -en "Folder is not Empty\n"
fi ;
else
echo -en "Folder is not Persent.\n"
fi
echo "Press a key. . ." ; read ;;
0) exit ;;
*) echo "Opps!!! Please select choice 1,2 or 0";
echo "Press a key. . ." ; read ;;
esac
done
linux script to check file or folder is empty or not
#!/bin/bash
#
ch=4
while [ $ch != 0 ]
do
clear
echo -en "To check File or Folder is empty or not\n"
echo -en "Enter 1. File\n2. Folder\n0. Exit\n"
echo -en "Enter choice 1, 2 or 0 - "
read ch
case $ch in
1) echo -en "Enter File name (path) -" ; read fl ;
if [ -f $fl ] ; then
#[ -z "$(cat $fl)" ] && echo -en "File is Empty\n" || echo -en "File is not Empty\n" ;
if [ -z "$(cat $fl)" ] ; then
echo -en "File is Empty\n"
else
echo -en "File is not Empty\n"
fi ;
else
echo -en "File is not Persent.\n"
fi
echo "Press a key. . ." ; read ;;
2) echo -en "Enter Folder name (path) -" ; read fl
if [ -d $fl ] ; then
#[ -z "$(ls -A $fl)" ] && echo -en "Folder is Empty\n" || echo -en "Folder is not Empty\n" ;
if [ -z "$(ls -A $fl)" ] ; then
echo -en "Folder is Empty\n"
else
echo -en "Folder is not Empty\n"
fi ;
else
echo -en "Folder is not Persent.\n"
fi
echo "Press a key. . ." ; read ;;
0) exit ;;
*) echo "Opps!!! Please select choice 1,2 or 0";
echo "Press a key. . ." ; read ;;
esac
done
#
ch=4
while [ $ch != 0 ]
do
clear
echo -en "To check File or Folder is empty or not\n"
echo -en "Enter 1. File\n2. Folder\n0. Exit\n"
echo -en "Enter choice 1, 2 or 0 - "
read ch
case $ch in
1) echo -en "Enter File name (path) -" ; read fl ;
if [ -f $fl ] ; then
#[ -z "$(cat $fl)" ] && echo -en "File is Empty\n" || echo -en "File is not Empty\n" ;
if [ -z "$(cat $fl)" ] ; then
echo -en "File is Empty\n"
else
echo -en "File is not Empty\n"
fi ;
else
echo -en "File is not Persent.\n"
fi
echo "Press a key. . ." ; read ;;
2) echo -en "Enter Folder name (path) -" ; read fl
if [ -d $fl ] ; then
#[ -z "$(ls -A $fl)" ] && echo -en "Folder is Empty\n" || echo -en "Folder is not Empty\n" ;
if [ -z "$(ls -A $fl)" ] ; then
echo -en "Folder is Empty\n"
else
echo -en "Folder is not Empty\n"
fi ;
else
echo -en "Folder is not Persent.\n"
fi
echo "Press a key. . ." ; read ;;
0) exit ;;
*) echo "Opps!!! Please select choice 1,2 or 0";
echo "Press a key. . ." ; read ;;
esac
done
list of all empty folders linux command
find . -depth -type d -empty
[will operate delete as well]
find . -depth -type d -empty -exec rmdir {} \;
[will operate delete as well]
find . -depth -type d -empty -exec rmdir {} \;
list of all empty folders linux command
find . -depth -type d -empty
[will operate delete as well]
find . -depth -type d -empty -exec rmdir {} \;
[will operate delete as well]
find . -depth -type d -empty -exec rmdir {} \;
How to check a file of folder is empty or not linux script...
[root@vikas Desktop]# touch v/v1
[root@vikas Desktop]# touch v/v2
[root@vikas Desktop]# [ -z "$(ls -A /root/Desktop/v)" ] && echo "empty" || echo "not"
not
[root@vikas Desktop]# [ -z "$(cat /root/Desktop/coralPBX.sh)" ] && echo "empty" || echo "not"
not
[root@vikas Desktop]# [ -z "$(cat /root/Desktop/ss)" ] && echo "empty" || echo "not"
empty
[root@vikas Desktop]# rm v/v
v1 v2
[root@vikas Desktop]# rm v/v
v1 v2
[root@vikas Desktop]# rm v/v*
rm: remove regular empty file `v/v1'? y
rm: remove regular empty file `v/v2'? y
[root@vikas Desktop]# [ -z "$(ls -A /root/Desktop/v)" ] && echo "empty" || echo "not"
empty
[root@vikas Desktop]# rmdir v
[root@vikas Desktop]# [ -z "$(ls -A /root/Desktop/v)" ] && echo "empty" || echo "not"
ls: cannot access /root/Desktop/v: No such file or directory
empty
[root@vikas Desktop]#
[root@vikas Desktop]# touch v/v2
[root@vikas Desktop]# [ -z "$(ls -A /root/Desktop/v)" ] && echo "empty" || echo "not"
not
[root@vikas Desktop]# [ -z "$(cat /root/Desktop/coralPBX.sh)" ] && echo "empty" || echo "not"
not
[root@vikas Desktop]# [ -z "$(cat /root/Desktop/ss)" ] && echo "empty" || echo "not"
empty
[root@vikas Desktop]# rm v/v
v1 v2
[root@vikas Desktop]# rm v/v
v1 v2
[root@vikas Desktop]# rm v/v*
rm: remove regular empty file `v/v1'? y
rm: remove regular empty file `v/v2'? y
[root@vikas Desktop]# [ -z "$(ls -A /root/Desktop/v)" ] && echo "empty" || echo "not"
empty
[root@vikas Desktop]# rmdir v
[root@vikas Desktop]# [ -z "$(ls -A /root/Desktop/v)" ] && echo "empty" || echo "not"
ls: cannot access /root/Desktop/v: No such file or directory
empty
[root@vikas Desktop]#
How to check a file of folder is empty or not linux script...
[root@vikas Desktop]# touch v/v1
[root@vikas Desktop]# touch v/v2
[root@vikas Desktop]# [ -z "$(ls -A /root/Desktop/v)" ] && echo "empty" || echo "not"
not
[root@vikas Desktop]# [ -z "$(cat /root/Desktop/coralPBX.sh)" ] && echo "empty" || echo "not"
not
[root@vikas Desktop]# [ -z "$(cat /root/Desktop/ss)" ] && echo "empty" || echo "not"
empty
[root@vikas Desktop]# rm v/v
v1 v2
[root@vikas Desktop]# rm v/v
v1 v2
[root@vikas Desktop]# rm v/v*
rm: remove regular empty file `v/v1'? y
rm: remove regular empty file `v/v2'? y
[root@vikas Desktop]# [ -z "$(ls -A /root/Desktop/v)" ] && echo "empty" || echo "not"
empty
[root@vikas Desktop]# rmdir v
[root@vikas Desktop]# [ -z "$(ls -A /root/Desktop/v)" ] && echo "empty" || echo "not"
ls: cannot access /root/Desktop/v: No such file or directory
empty
[root@vikas Desktop]#
[root@vikas Desktop]# touch v/v2
[root@vikas Desktop]# [ -z "$(ls -A /root/Desktop/v)" ] && echo "empty" || echo "not"
not
[root@vikas Desktop]# [ -z "$(cat /root/Desktop/coralPBX.sh)" ] && echo "empty" || echo "not"
not
[root@vikas Desktop]# [ -z "$(cat /root/Desktop/ss)" ] && echo "empty" || echo "not"
empty
[root@vikas Desktop]# rm v/v
v1 v2
[root@vikas Desktop]# rm v/v
v1 v2
[root@vikas Desktop]# rm v/v*
rm: remove regular empty file `v/v1'? y
rm: remove regular empty file `v/v2'? y
[root@vikas Desktop]# [ -z "$(ls -A /root/Desktop/v)" ] && echo "empty" || echo "not"
empty
[root@vikas Desktop]# rmdir v
[root@vikas Desktop]# [ -z "$(ls -A /root/Desktop/v)" ] && echo "empty" || echo "not"
ls: cannot access /root/Desktop/v: No such file or directory
empty
[root@vikas Desktop]#
Wednesday, March 4, 2009
Tuesday, March 3, 2009
Extracting digits, upper lower letter from a string using TR
[root@vikas ~]# echo "Vv1Ii2Kk3Aa4Ss5" | tr -cd '[[:upper:]]\n'
VIKAS
[root@vikas ~]# echo "Vv1Ii2Kk3Aa4Ss5" | tr -cd '[[:lower:]]\n'
vikas
[root@vikas ~]# echo "Vv1Ii2Kk3Aa4Ss5" | tr -cd '[[:digit:]]\n'
12345
[root@vikas ~]# echo "Vv1Ii2Kk 3Aa4Ss5" | tr -cd '[[:blank:]]\n'
[root@vikas ~]# echo "Vv1Ii2Kk3Aa4Ss$$5" | tr -cd '[[:alpha:]]\n'
VvIiKkAaSs
[root@vikas ~]#
VIKAS
[root@vikas ~]# echo "Vv1Ii2Kk3Aa4Ss5" | tr -cd '[[:lower:]]\n'
vikas
[root@vikas ~]# echo "Vv1Ii2Kk3Aa4Ss5" | tr -cd '[[:digit:]]\n'
12345
[root@vikas ~]# echo "Vv1Ii2Kk 3Aa4Ss5" | tr -cd '[[:blank:]]\n'
[root@vikas ~]# echo "Vv1Ii2Kk3Aa4Ss$$5" | tr -cd '[[:alpha:]]\n'
VvIiKkAaSs
[root@vikas ~]#
Extracting digits, upper lower letter from a string using TR
[root@vikas ~]# echo "Vv1Ii2Kk3Aa4Ss5" | tr -cd '[[:upper:]]\n'
VIKAS
[root@vikas ~]# echo "Vv1Ii2Kk3Aa4Ss5" | tr -cd '[[:lower:]]\n'
vikas
[root@vikas ~]# echo "Vv1Ii2Kk3Aa4Ss5" | tr -cd '[[:digit:]]\n'
12345
[root@vikas ~]# echo "Vv1Ii2Kk 3Aa4Ss5" | tr -cd '[[:blank:]]\n'
[root@vikas ~]# echo "Vv1Ii2Kk3Aa4Ss$$5" | tr -cd '[[:alpha:]]\n'
VvIiKkAaSs
[root@vikas ~]#
VIKAS
[root@vikas ~]# echo "Vv1Ii2Kk3Aa4Ss5" | tr -cd '[[:lower:]]\n'
vikas
[root@vikas ~]# echo "Vv1Ii2Kk3Aa4Ss5" | tr -cd '[[:digit:]]\n'
12345
[root@vikas ~]# echo "Vv1Ii2Kk 3Aa4Ss5" | tr -cd '[[:blank:]]\n'
[root@vikas ~]# echo "Vv1Ii2Kk3Aa4Ss$$5" | tr -cd '[[:alpha:]]\n'
VvIiKkAaSs
[root@vikas ~]#
Monday, March 2, 2009
Mohabbat bhi doston se hai..................
Khushi bhi doston se hai
Gham bhi doston se hai
Takraar bhi doston se hai
Pyaar bhi doston se hai
Roothna bhi doston se hai
Manana bhi doston se hai
Baat bhi doston se hai
Misaal bhi doston se hai
Nasha bhi doston se hai
Shaam bhi doston se hai
Zindagi ki shuruvaat bhi doston se hai
Zindagi main mulakaat bhi doston se hai
Mohabbat bhi doston se hai
Inaayat bhi doston se hai
Kaam bhi doston se hai
Naam bhi doston se hai
Khyal bhi doston se hai
Armaan bhi doston se hai
Khwab bhi doston se hai
Maahol bhi doston se hai
Yaadein bhi doston se hai
Mulakaatein bhi doston se hai
Sapne bhi doston se hain
Apne bhi doston se hai
Ya yun kahun yaro
Apni to duniya hi doston se hai .........
Gham bhi doston se hai
Takraar bhi doston se hai
Pyaar bhi doston se hai
Roothna bhi doston se hai
Manana bhi doston se hai
Baat bhi doston se hai
Misaal bhi doston se hai
Nasha bhi doston se hai
Shaam bhi doston se hai
Zindagi ki shuruvaat bhi doston se hai
Zindagi main mulakaat bhi doston se hai
Mohabbat bhi doston se hai
Inaayat bhi doston se hai
Kaam bhi doston se hai
Naam bhi doston se hai
Khyal bhi doston se hai
Armaan bhi doston se hai
Khwab bhi doston se hai
Maahol bhi doston se hai
Yaadein bhi doston se hai
Mulakaatein bhi doston se hai
Sapne bhi doston se hain
Apne bhi doston se hai
Ya yun kahun yaro
Apni to duniya hi doston se hai .........
Subscribe to:
Comments (Atom)
