Live Chat!

generate and print a sequence of number

          0 votos

September 28th, 2006 mysurface

To generate a sequence of number we can use seq
seq 1 10
With this it prints 1 to 10 line by line, because by default separator is new line, anyway you can check, do this
seq -s” ” 1 10
Doing this it change new line to a single blank space.
But that is the usage of the this [...]

Posted in Misc, Text Manipulation, backquote, cat, pipeline, seq, wc | Hits: 9622 | 1 Comment »

query using debian packaging manager

          0 votos

September 24th, 2006 mysurface

I am here to show you two examples of using dpkg to query package info.
To know what deb package is installed, you can do this
dpkg -l
Usually we do this with grep, to filter only info that we are interested in, let say i want to know the packages consist of keyword gcc.
dpkg -l | grep [...]

Posted in Admin, backquote, dpkg, grep, pipeline, which | Hits: 6671 | 2 Comments »

check the file type

          0 votos

September 23rd, 2006 mysurface

A command file is a good tool to help you determine what file type of a file. To check for a file type simply do this
file filename
Let say i want to check the file type of command line update-rc.d, i can do this
file `which update-rc.d`
output:
/usr/sbin/update-rc.d: perl script text executable
Uses which to returns the full path [...]

Posted in Common, backquote, file, which | Hits: 5083 | 1 Comment »

log personal message to /var/log/messages

* * * * * 1 votos

August 14th, 2006 mysurface

To log personal messages to /var/log/messages when you write script, you can use logger
simple example:
logger i am testing
And check the result with tail, it display last 10 line of messages by default
tail /var/log/messages
To put more info to log file, you can specified the timestamp with scriptname by this
logger -t `basename $0` i am still testing
basename [...]

Posted in Admin, backquote, logger, tail | Hits: 5791 | 2 Comments »

find out the command is from which packages using rpm

          0 votos

August 5th, 2006 mysurface

rpm is a common package manager for red hat, fedora, centos distro, to find out the command is from which package, you can using rpm -qf, let say you wanna find out “host” is from which package.
rpm -qf `which host`
#output:
bind-utils-9.3.2-20.FC5
Take care of the symbol (`) , it is not single quote. For normal keyboard, it [...]

Posted in Admin, backquote, rpm | Hits: 2653 | 2 Comments »