Archive for the Category » Linux «

Thursday, November 20th, 2008 | Author: Angelo

Deleting directories and files starting with special characters on linux server. Suppose you find directories and files starting with special characters for example —- ##– ##### ## #-#- . Removing it using command rm -rf will give you following output.

[root@Linux ~]# rm -rf ----
rm: unrecognized option `----'
Try `rm ./----' to remove the file `----'.
Try `rm --help' for more information.

Or trying to remove directory with name #-#- will not produce any output (means it will not give any error) but also it will not get delete. ls -l will list directory #-#-

[root@Linux ~]# rm -rf #-#-

[root@Linux ~]# ls -l
total 8
drwxr-xr-x 2 root root 4096 Nov 20 18:25 #-#-

To remove all these directories or files starting special characters just add ./ before name.

[root@Linux ~]# rm -rf ./#-#-

[root@Linux ~]# rm -rf ./----

And you have deleted files & directories starting with special character.

Category: Linux  | One Comment
Monday, November 10th, 2008 | Author: Angelo

SSH without authentication while opening multiple sessions.

While working on a remote server via SSH, we need to open multiple sessions for the same remote server. Suppose, you are logged into a server 10.10.10.1, and now you want to transfer a file to server X from your local machine. Then you will have to copy those files using scp, for which you need to enter password while establishing a fresh connection to server X. So, it takes some time as well as it is irritating to enter password again and again.

Here’s the remedy :

Open the file /etc/ssh/ssh_config on your local machine as root to edit. Or if you are not the root user, you can create a file ~/.ssh/config for user level SSH configurations.

Add the following lines at the end of the file you opened just now:

ControlMaster auto
ControlPath /tmp/ssh-%r@%h:%p

Save the file and you are done !!

Now check out (One can try it this way) – Open a terminal and connect to a server :

$ ssh root@10.10.10.1

The connection gets established after entering the proper password.

Then in another terminal try to copy a file from your local machine to the same server :

$ scp -r ~/pintos root@10.10.10.1

This time, you don’t need to wait for a fresh connection, neither you will have to enter the password again. File transfer starts instantaneously. SSH shared the already established connection. Similarly you can open another terminal without waiting and entering the password again.

Sunday, October 12th, 2008 | Author: Angelo

Hello,

Change default text editor on linux server.

A. How to find default text editor of linux machine ? — >> You can determine default editor of linux machine from variable EDITOR.

Following command will show default text editor.
root@server [~]#echo $EDITOR
pico

This means default text editor of your linux machine is pico if you want to change it temporary to vi then simply execute following command.

root@server [~]#EDITOR=vi
In case, you want to change default text editor permanently to emacs then edit /root/.bashrc at the bottom of file add line.
export EDITOR=emacs

To, verify is it changed permanently or not, simply logout and login again and execute command.

root@server [~]#echo $EDITOR
emacs

EDITOR variable contains all capital letter because it is system variable. You can find all system variables and it’s value by command env .

root@server [~]#env
It will show all environment variables (system variables).