Sonobe Lab. > > > Lc| Japanese|Ger|Fre|Spa|Por|Ita
** Sonobe Lab for 22nd C!**
How to type a tilde (~) or HOME (~/) very easily How to type a tilde (~) or HOME (~/) very easily  
* This page is made by "machine translation" program from Japanese to English.

     While we are using UNIX (including Linux), we are always troubled by inputting of the tilde character `~', by which UNIX shells indicate user's home directory,

Example :   % more ~sonobe/.login

where the percent sign '%' represents the prompting character(s) of UNIX shell.

     The tilde key is located at the far side on the keyboard, so the key is harder to depress.
     Moreover, the positions of tilde have been designed differently, depending on the keyboard type.
     We feel it very troublesome that pushing Shift key is needed simultaneously.

     Especially in case of the JIS keyboard in Japan, the tilde key is stamped together on the 0 (zero) key. However we have to depress the key, located at two keys righter than the zero key. How strange it is!
     (I do not know whether you can believe or not that I saw persons actually who could not find the tilde key when they were trying to input some URL.)

(tilde key,wave)

Depress this key while depressing
Shift key to input a tilde '~'.


     To solve the problem, I have developed two methods to avoid the tilde keying for HOME designation. I will present these convenient methods to you.


method 1:  A Symbolic Link formality

(Step 1) Checking Your Computer's Operating System

     The functionality of 'symbolic link' is adopted for this method.
     Almost in case of UNIX and Linux, it is O.K.
     But, in the case of Microsoft Windows, it is impossible for 95/98/Me systems.
     Even if it is NT/2000/XP system, symbolic linking is impossible for FAT32 file system, while it is possible for NTFS file system, I am sure. Please confirm. When you are thinking of moving to NTFS format, I recommend you to investigate sufficiently the influence in advance.


(Step 2) Determination of Your Home's Abbreviation symbol

     Determinate your abbreviation symbol to represent your home directory.

     For the abbreviation, you had better to adopt your User ID or its abbreviation.
     My recommendation is the symbol which is two sequential lower-case alphabet, each of which is the initial character of your usrid.
     For example, the symbol is ss if the User ID is sonobe.
     Though the symbol is short, it is very convenient, for you will seldom mistype.
A root directory % cd / A directory name which comes out and is directly under what comes out avoids.
A system name, a software name, a directory name that a system has, and the same confusing thing as others' name are also avoided.

Below, it is fooooooo about your user ID. A contracted form which you decided is written to be ff.


(Step 3) A request of Symbolic Link

If you get used to a system manager, it will be to step 4.

I ask that I have Symbolic Link made directly under a root directory of a system manager.
It is . a procedure is [ . ] abnormal termination when refused here (^^;


(Step 4) Registration of a contracted form

If good and it will become, I have you make by the following commands.


% su root
Password:********
% cd/
% ls -alF
% ln -s/home/...../fooooooo ff
% ls -alF
% exit

Exmaple (in my case):
   % ln -s /home/usr/sonobe ss

Since pass of a home directory changes with systems, cautions are required.
% pwd ~
It is being able to carry out a ������������������ check.

A procedure end



Usage is easy.

Known ~ fooooooo ~ To �������� /ff Then, it is O.K.
already -- a tilde -- " ~ It does not trouble to a key in which is ".

It is - when putting in from the middle of pass. - //ff It carries out.
For example, a current directory ~ fooooooo/a/aa/aaa When it is displayed (when tcsh is used by an input row and kterm of emacs and an input row is taken out with C-p last time), ~ it carries out to wanting to have come to specify a file of fooooooo/b/bb -- if it carries out . ��
~ fooooooo/a/aa/aaa
Continue being alike. //ff Strike with /b/bb.
~ fooooooo/a/aa/aaa //ff /b/bb
Then, the target file can be specified.
although there was a also conventionally alike method -- " ~ " -- a point it becomes unnecessary to push is progress

It can use, not only when striking from a command line, but when specifying in a program.

Other users can use this notation about specification of this user's home.

The above-mentioned set point is required only of this for every . host which cannot be used by other hosts.


method 2:  tcsh key binding method

tcsh (tc-shell) is used.

(Step 1) Determination of tcsh adoption

Since tcsh is the shell which has a still bigger advantage including a function of csh, if it is those who use csh usually, it can also perform . combined use which is recommendation.
When you are not liking, you terminate tcsh abnormally. (^^;.


(Step 2) Installation of tcsh

If it is not checking whether tcsh is installed in your machine, it finds and installs and lets pass pass (please investigate independently for details).
There is also tcsh of the Windows version (. which is moving also by a writer's Windows 2000 machine).
If installation is impossible, it terminates abnormally. (^^;.


(Step 3) Determination of a bind key

you -- future -- usually -- ' ~ Please assign by "CTRL-what" instead of [ of '] is carried out, and an alphabetic character of one character (to what kind of character it is made except an alphabetic character should read a manual of tcsh).
I made it 'x'.


(Step 4) Updating or creation of a tcsh execution file
A file ~ /. tcshrc is made and the following contents are put in.
when it already has .tcshrc, be careful not to break a file of . former which is added (in order to write this report, it experiments by Windows, and they are 8s �������� about this!)


# .tcshrc
#
# --- tcsh   user bind key (This is the point.) --- #
     bindkey   -s ^x '~'
# --- tcsh prompt  (optional, independent of this article) --- #
     set   prompt="[%n'echo $shlvl' %m:%~]" 
# --- The rest calls csh's initial setting. --- #
# ---(It is optional whether .tcshrc is 
#      divided or not from .cshrc          )--- #
     source   ~/.cshrc.



Notes: Make x behind . hat which is what puts in this hat '^' sign by one character as it is (it is not the meaning which pushes CTRL simultaneously) into a character of liking decided in a top.


A procedure end



Usage.
whenever [ henceforth, / which pushes C-x by tcsh ] -- the present cursor location of a shell input row -- ' ~ A character of 'comes out.

There is a fault that this method cannot be used by that it is necessary to press the CTRL key and program except tcsh (for example, input row of emacs).

It still has the feature that a system manager's consent is not needed.


Furthermore, .cshrc with easy me in Windows as an addition is attached. :


# .cshrc
#
 alias a "alias"
 a ls "ls -aCF"
 a lls "ls -alF \!* | less"
 a lsgrep "ls -alF ./ | grep \!*"
 a psgrep "ps | grep \!*"
 a mo "less"
 a more "less"
 a q "exit"
 a tt "tcsh"
 a wh "where"


God bless you!




 
- Copyright © sonobelab.com, Masayuki Sonobe 2002-2024.
- Updated 5383 days ago: 2009. 7. 2 Thu 19:19
- Accesses to the Page since 2002.11.10 00,038,081
- Accesses to Sonobe's since 2002.07.01 05,091,042