LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 10-05-2003, 07:42 AM   #1
dummyagain
Member
 
Registered: Sep 2003
Posts: 74

Rep: Reputation: 15
Unhappy text mode VS X window


is there any command for testing if the program is rumming in text mode console or X window??
 
Old 10-05-2003, 08:17 AM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 58
You could examine the parent process IDs they should lead to a shel whose parent will either be a console or an x application.
 
Old 10-05-2003, 08:41 AM   #3
dummyagain
Member
 
Registered: Sep 2003
Posts: 74

Original Poster
Rep: Reputation: 15
can u give me some example like a program ?
 
Old 10-05-2003, 08:42 AM   #4
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: ubuntu
Posts: 2,524

Rep: Reputation: 93
You could use "ttyname()". This returns the path to the terminal connected to a filedescriptor. For consoles, this will be something like "/dev/tty1", for a xterm it will return somthing like /dev/pts/1
 
Old 10-05-2003, 08:43 AM   #5
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 58
Quote:
Originally posted by dummyagain
can u give me some example like a program ?
Just use ps.
 
Old 10-06-2003, 11:45 AM   #6
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: ubuntu
Posts: 2,524

Rep: Reputation: 93
...or the "tty" command.
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How change text color using linux in text mode only runlevel 3? Xavius Linux - General 7 05-07-2009 02:19 AM
Change from GUI mode to text mode alexr186 Linux - Software 4 01-08-2009 06:56 AM
Change the display mode in text mode Drunkalot Linux - General 7 08-12-2005 11:35 AM
How to; Suse9.3 prof. text mode to graphical mode anjum Linux - Software 5 07-20-2005 11:36 PM
Booting in text mode versus graphics mode LChalupa Linux - Newbie 3 01-15-2005 07:53 PM


All times are GMT -5. The time now is 05:34 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
Open Source Consulting | Domain Registration