MA10126

Essential Unix

 

Introduction | Logging in | Directories | Files | Text Editors | Miscellany | File access | Links

 

6. Miscellany

 

Here are a few other commands which may be useful…

 

Messaging

 

We saw the command who which produces a list of all users currently logged onto the Unix service. If you see that your mate mapjkl is logged on, you can invite him to chat by the command

write mapjkl

This will send a message to his screen. If he responds, you can chat by instant messaging until you terminate the conversation by pressing ctrl-d.

If you don’t want to be interrupted by such invitations to chat, issue the command

mesg n

No such messages will be passed to you, until you exit or become available again by typing

mesg y

 

 

Unix to Dos

 

If you try to open a Unix text file using a Windows application such as Notepad, you will find that the line breaks are missing. There is a command to convert a Unix file to Windows (Dos) format:

unix2dos datafile > data.txt

will produce the file data.txt in Dos format from the Unix file datafile.

To go the other way, there is the command dos2unix

 

 

Executing programs

 

If a file such as prog is executable, e.g. it is a program, you can run it in Unix by just typing the program name:

prog

By default, it will expect any data input to come from the keyboard. If you want it to read the data from the file datafile, type

prog < datafile

By default, the program output will appear on screen. To send the output to a file, use the > feature:

prog < data > outputfile

 

When you try to run a program or command and the screen seems to “hang”, this is often because the system is waiting for input from the keyboard, instead of from a datafile.

 

To be able to execute a file, you first have to set the necessary permissions. The next page deals with this; click on the “File access” link in the linkbar below…

 

Introduction | Logging in | Directories | Files | Text Editors | Miscellany | File access | Links