LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-16-2004, 07:50 AM   #1
iomari
Member
 
Registered: Aug 2003
Posts: 46

Rep: Reputation: 15
testing for text mode


How can I test whether or not I am in text mode using perl? I want to write a progam that will display data on the screen in table format but the code wil vary depending on whether or not I am in text or in X. Like linuxconf does in Mandrake.
 
Old 07-16-2004, 08:43 AM   #2
jkobrien
Member
 
Registered: Jun 2003
Location: Dublin, Ireland
Distribution: Slackware, LFS, Ubuntu, RedHat, Slamd64
Posts: 507

Rep: Reputation: 30
pgrep X as a system call.

John

Last edited by jkobrien; 07-16-2004 at 08:44 AM.
 
Old 07-16-2004, 09:27 AM   #3
iomari
Member
 
Registered: Aug 2003
Posts: 46

Original Poster
Rep: Reputation: 15
No. pgrep X tells me if X is running, not if i am in X. You get the same response from pgrep X whether you are in X or a text console.
 
Old 07-16-2004, 09:35 AM   #4
jkobrien
Member
 
Registered: Jun 2003
Location: Dublin, Ireland
Distribution: Slackware, LFS, Ubuntu, RedHat, Slamd64
Posts: 507

Rep: Reputation: 30
True. True.

How about 'fgconsole' then? If that's = 7 you're in X, if it's anything else (1-6) you're not.

John
 
Old 07-16-2004, 10:57 AM   #5
iomari
Member
 
Registered: Aug 2003
Posts: 46

Original Poster
Rep: Reputation: 15
Thumbs up

Thanks John. Your the man.
 
  


Reply



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 On
HTML code is 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

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:02 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration