LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 05-26-2009, 10:19 AM   #1
gr8linux
Member
 
Registered: May 2009
Posts: 44

Rep: Reputation: 15
Post difference in GUI & CLI in command execution


some commands give different output in graphical terminal and command line, why they do so?

e.g. $ echo -e "\033[5m"

will set blinking text in CLI mode but it wont work in Xterm........ why???

there are many commands with this problem.
 
Old 05-26-2009, 10:34 AM   #2
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,040

Rep: Reputation: 373Reputation: 373Reputation: 373Reputation: 373
Those are ANSI escape sequences or VT control codes that will only work (or fail) depending on the capabilities of the current terminal emulator that you are using. First thing to note is that xterm can emulate a number of different output devices (man page). Second thing is that you might already be using a coloured prompt or something like that, which might also contain its own escape codes that can override the one you supply in command line just 1 nanosecond after you press enter.
 
Old 05-27-2009, 12:10 AM   #3
gr8linux
Member
 
Registered: May 2009
Posts: 44

Original Poster
Rep: Reputation: 15
[QUOTE=i92guboj;3553270]Those are ANSI escape sequences or VT control codes that will only work (or fail) depending on the capabilities of the current terminal emulator that you are using. First thing to note is that xterm can emulate a number of different output devices (man page). Second thing is that you might already be using a coloured prompt or something like that, which might also contain its own escape codes that can override the one you supply in command line just 1 nanosecond after you press enter.[/QUO


thanx for ur answer, but i m not using a coloured prompt or something else.

when i typed

$ echo -e "\033[1m"

it will bold the text in Xterm but not in CLI...........


so, why it happens that some commands gives output onnly on CLI and some only on Xterm?????
 
Old 05-27-2009, 01:25 AM   #4
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,289

Rep: Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034
xterm is running on top of Xwindows (run level 5); CLI (assuming you mean run level 3) isn't.
 
Old 05-27-2009, 01:36 AM   #5
gr8linux
Member
 
Registered: May 2009
Posts: 44

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by chrism01 View Post
xterm is running on top of Xwindows (run level 5); CLI (assuming you mean run level 3) isn't.

yes, but both are using same shell then how differences creates?
 
Old 05-27-2009, 09:58 AM   #6
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,040

Rep: Reputation: 373Reputation: 373Reputation: 373Reputation: 373
As said, this control codes are not interpreted by the shell, so, the fact that the shell is the same is completely irrelevant. They are intercepted by the terminal emulator, whatever that is. The effect of these control codes will only depend on the capabilities of your terminal emulator.

To check if a given capability is on you can use many methods, the first way to check is the $TERM variable. In what you call CLI it will be "linux", in an xterm is will be "xterm". Then you can act consequently on depending on what terminal emulator is being used.
 
Old 05-28-2009, 12:06 AM   #7
gr8linux
Member
 
Registered: May 2009
Posts: 44

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by i92guboj View Post
As said, this control codes are not interpreted by the shell, so, the fact that the shell is the same is completely irrelevant. They are intercepted by the terminal emulator, whatever that is. The effect of these control codes will only depend on the capabilities of your terminal emulator.

To check if a given capability is on you can use many methods, the first way to check is the $TERM variable. In what you call CLI it will be "linux", in an xterm is will be "xterm". Then you can act consequently on depending on what terminal emulator is being used.


thankyou vry much.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
file format why difference between "command line and GUI interface" hocheetiong Linux - Newbie 3 09-17-2007 07:19 AM
What is difference between /usr/sbin/ps & /usr/ucb/ps command rajaniyer123 Solaris / OpenSolaris 6 07-05-2007 12:53 PM
difference between gcore utility & gdb gcore command coontie Linux - Kernel 0 06-13-2007 09:09 AM
boot CLI vs GUI weazy Linux - Software 2 08-04-2006 09:15 PM
cli: command & domtar Linux - General 1 02-27-2005 07:43 AM


All times are GMT -5. The time now is 09:02 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration