Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Linux Ask!

Aug 272011
 

Edit a remote file with vim over SSH

Answer:

If you have a remote file and you can have a quick edit, if you use the following command:

# ssh -t john@remote-server vim /data/test.txt

You will be prompted to login if you don't have proper ssh key in the remote server, and after finishing editing the file, you will quit the ssh session automatically.

Aug 252011
 

Disable MySQL server from listening for TCP/IP connections

Answer:

If you only connect to the MySQL server from localhost and you might want to disable TCP/IP networking feature so the server is more secure.

To do so, edit the MySQL configurations, e.g. /etc/my.cnf

..
skip-networking
..

Don't forget to restart MySQL to take effect.

# /sbin/service mysqld restart

Aug 232011
 

Check if a file exist in Bash Shell

Answer:

The following script demonstrates how to check if a file exist, using shell (Bash) script

#!/bin/bash

if [ -e test.txt ]
then
  echo 'The file exists.'
else
  echo 'The file does not exist.'
fi
Aug 212011
 

How to print screen in Mac OS X

Answer:

1. To print the whole screen in Mac OS X, try

Press down Apple key ⌘ + Shift + 3 at the same time

2. To print an active window

Press down Apple key ⌘ + Shift + 4 at the same time

When you see the mouse changed to +, press the space key in your keyboard.

3. To print a portion of your screen

Press down Apple key ⌘ + Shift + 4 at the same time

When you see the mouse changed to +, move your mouse to select the portion .