≡ Menu

unix commands

Unix / Linux Shell: Parse Text CVS File Separator By Field

I work for a small ISP (Internet Service Provider) and we are using Linux and Unix-like operating system with bash shell. I want to write a shell script to parse the csv file line by line. Then line must be parse again field by field. The sample input file is as follows:


I need to extract each of these example.com,username,groupname,homedir,md5password,permission,secondarygroup fields and passed to the different system utilities. How do I write a shell script to automate this task and use the bash shell to parse a text file?
[click to continue…]

HowTo: Convert Between Unix and Windows text files

How can I convert newline [ line break or end-of-line (EOL) character ] between Unix and Windows text files?
[click to continue…]

Explains: echo Command (echo $”string”) Double-quoted String Preceded By a Dollar Sign

I noticed that many shell scripts in /etc/init.d/ directory use the following syntax:

echo $"Usage $prog start|stop|reload|restart"

Why a double-quoted string preceded by a dollar sign ($"string") using the echo command under Linux / UNIX bash scripts?
[click to continue…]

UNIX Command Line Tools For MS-Windows XP / Vista / 7 Operating Systems

I wish I had access to one of those nifty UNIX command-line tools under MS-Windows Vista or XP operating systems. How do I access UNIX command line utilities under Windows with out using virtualization?
[click to continue…]

UNIX Date Command Examples

How do I view and set date under UNIX operating systems? How do I see the current time/date on Unix based server?
[click to continue…]

Linux / UNIX killing a process and restarting the same

Q. How do I kill a process called inetd or foo and restart the same so that configuration file get updated?

A. Both UNIX and Linux supports POSIX reliable signals and POSIX real-time signals. Each signal has a current disposition, which determines how the process behaves when it is delivered the signal.

Generally following command is used
kill -1 process-pid

First get pid of inetd:
ps -e | grep inetd
Now force read inetd.conf:
kill -1 xinetd-pid

You can also use pkill command used to send signals. The pkill command allows the use of extended regular expression patterns and other matching criteria.
pkill -HUP process-name

Make syslog reread its configuration file
# pkill -HUP syslogd

Make xinetd reread its configuration file
# pkill -HUP inetd