generate and print a sequence of number

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 […]

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

query using debian packaging manager

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. […]

Posted in Admin, backquote, dpkg, grep, pipeline, which | Hits: 55850 | 5 Comments »

check the file type

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 […]

Posted in backquote, Common, file, which | Hits: 37047 | 3 Comments »

log personal message to /var/log/messages

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 […]

Posted in Admin, backquote, logger, tail | Hits: 144663 | 28 Comments »

find out the command is from which packages using rpm

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. […]

Posted in Admin, backquote, rpm | Hits: 32679 | 3 Comments »