|
How to comment all lines in VI editor ? |
|
Aaj Ka Tip
|
How to comment all lines in VI editor ?
This can be done with a using a command like 'search and replace'
1.Open the file in 'vi' editor. 2.Press Escape and type :1,$s/^/##/g 3.Press Enter
1,$s/^/##/g can be broken down as 1: To start from 1st line $s :To end at the last line /^ : Search for the start of the line /##:Replace with ## /g: Replace all occurrences
contributed by : Pratik Shah |
|
|
Search and delete files in Unix |
|
Aaj Ka Tip
|
This is a useful tip to find and remove some files by searching recursively in a directory and sub directories
This will list down all the *.tmp/*.log files find . -type f -name "*.tmp" -exec echo {} \; find . -type f -name "*.log" -exec echo {} \;
This will delete down all the *.tmp/*.log files find . -type f -name "*.tmp" -exec rm {} \; find . -type f -name "*.log" -exec rm {} \;
It will be better to list the files first and then delete them, so that we do not miss out any important file |
|
|
Monitoring Servers over Network |
|
Aaj Ka Tip
|
Monitoring Network servers becomes a tiresome job.To ease out the process a software can be deployed on the servers to monitor them.
Nagios (http://www.nagios.org/) is a usefull monitoring tool , the features include
- Monitoring of network services (SMTP, POP3, HTTP, NNTP, PING, etc.)
- Monitoring of host resources (processor load, disk usage, etc.)
- Simple plugin design that allows users to easily develop their own service checks
- Parallelized service checks
Checkout the site:http://www.nagios.org/ for more details
|
|
|
Get Hostname from IP address. |
|
Aaj Ka Tip
|
|
To get the hostname from the IP address. The simplest way is to use the "host" utility provided by Gnu/Linux. Just run host <IP address> <nameserver> This will query the name server and provide you with the hostname of the IP address.By default it will query the nameserver listed in the /etc/resolv.conf file. |
|
|
Starting with Ubuntu Linux 7.10 |
|
Aaj Ka Tip
|
Starting with Ubuntu Linux 7.10
Its advisable to get a proper internet connection as this will save you from lot of hassles. Once ubuntu is installed,work on the following points
1. gstreamer plugins for support of mp3/mpeg and other multimedia files 2. icedtea-java7-plugin package to have support for Java in browsers like firefox and mozilla 3. vlc player to play all kind of files |
|
Read more...
|
|
|
: bad interpreter: No such file or directory |
|
Aaj Ka Tip
|
: bad interpreter: No such file or directory
The above error is reported when trying to execute some script at the Unix/Linux shell.
If the file has been edited on a Windows machine it can sometimes Add CR/LF (VM) characters on the end of each line, so #!/bin/sh becomes #!/bin/shVM and as the ctrl-v/ctrl-m characters are special, and hidden by default on most editors, |
|
Read more...
|
|