I’ve spent the last week in Unix system land, and boy has it been painful! I thought I’d share some of the tips and tricks to save time and aggravation.
1. If you’re coding on a Windows machine, and you hear that annoying “BEEP” everytime you make a mistake in mysql or in a command prompt save yourself from being embarrassed and infuriating your co-works by typing:
>net stop beep
2. Trying to connect to a port that is already in use results in a:
Port already in use: <port #>; nested exception is: java.net.BindException: Address already in use
To find out if the port is already in use, use the following command, and then kill the associated process:
>netstat
3. One of my coworkers added color to grep, which helps tremendously when trying to search for key words that are embedded deep within text.
grep –color RED # add it to your .alias or .bash_profile file
4. This next tip will hopefully save a lot of time debugging scripts, if you have the following lines:
if [ `whoami` != “poornima” ] ; then
echo “Please run this script as user poornima.”
exit 1
fi
There must be a space between the close ” and ] or else the script will error when run.
5. To search for any process name issue the following command:
> ps -ef | grep “keyword(s) you’re looking for”