Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

For debugging purpose sometimes I access a remote Linux box via VNC. At that time someone else may be working on that same Linux box through VNC and it may happen that I do not have facility to chat with that person. So essentially what happens is I start a new tab in the GNOME and type a message like this :

[xxx@slc04lyo abc]$ Hi this is X. I will use the box for some time
Hi: Command not found.

Is it possible to not have shell print the following?

Hi: Command not found.

If yes how can I do that selectively and not always? So that when needed I can use the shell as a raw chat platform?

P.S: I do not need to see an output. The other user is already in the VNC and can see what I typed. So the output is superfluous.

share|improve this question
3  
Don't do this at all. ssh into the box with your own account, use another X session via XDMCP, or many other possibilities. –  Michael Hampton Jan 16 at 16:56

4 Answers 4

up vote 6 down vote accepted

End the line by pressing Ctrl+C. It will look like

[user@box ~]$ Are you there?^C

ETA: Ctrl+C sends the signal SIGINT, which in this context basically means "stop what I'm doing and give me back a prompt". It's just the same as when you're running a program from your prompt and pressing Ctrl+C - it will kill the running program and give you your prompt back. Except in this case you've not actually started the program.

This can be useful in other situations too, e.g. when the cat has been having a dance all over the keyboard...

share|improve this answer
    
It does solve but can you explain in your answer why it works? –  Geek Jan 16 at 13:16
    
I added an explanation. –  Jenny D Jan 16 at 13:33

Just comment out your message by prepending a # to it. This way nothing of what you write will be processed nor expanded by the shell.

[xxx@slc04lyo abc]$ # Hello, this is dog. I will use the box for some time

Note: If you forget to write the # first, you can hit Alt + # to comment out the current line and get back to the prompt in a single move. This works with prompts using GNU Readline, such as bash, ksh, mysql, python, zsh and many others.

Here's a short summary of GNU readline's keyboard shortcuts.

share|improve this answer

There is a : command that does nothing and ignores its arguments (way back when, it was used to tag labels for use by the goto command.)

$ : Hi this is X. I will use the box for some time
$

[Edit: As @llua points out, the shell will still parse the command line, so any unbalanced braces, quotes, backquotes, etc. will result in a continuation prompt, and semicolon, pipe, etc. will terminate the command.]

If you want to have a two-way chat with the other user, type cat >/dev/null and then type all you want; there will be no output other than what you type. Type Ctrl-C to terminate the cat.

$ cat >/dev/null
Are you there?
yes I am.
^C
share|improve this answer
    
: or # in my case i would use the colon as the dash need me to type Caps + colon –  Kiwy Jan 16 at 11:29
2  
normal parsing still happens, so : Mark's answer will cause the shell to wait for the ending '. –  llua Jan 16 at 12:34
    
@llua Thanks. I added this to the answer. –  Mark Plotnick Jan 16 at 13:28

You can simply type echo Hi this is X. I will use the box for some time no ?

If you want to avoid any output message you can also consider :
echo Hi this is X. I will use the box for some time &> /dev/null it will redirect the error and the output of this command in null. ==>no output at all.

You can also use the comment like this:
# Hi this is X. I will use the box for some time
if your using a shell that does not use # as comment mark just use the one you're used to.

share|improve this answer
    
echo still has an output. I do not need to see an output. The other user is already in the VNC and can see what I typed. so the output is superfluous. –  Geek Jan 16 at 11:23
    
@Geek using # does not work ? –  Kiwy Jan 16 at 12:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.