Results 1 to 7 of 7

Thread: How to Run a Command from Command prompt

  1. #1
    Join Date
    Jan 2013
    Beans
    6

    Exclamation How to Run a Command from Command prompt

    I see a 'Run' menu at the start menu at lubuntu desk top. Which can be activated by pressing Alt+F2.
    I want to do follwoing:
    1. Go To command prompt by Ctr+Alt+F2
    2. Activate 'run' from command prompt
    3. Type xrandr -s 1 at the run command text box

    All these three step I want to do from Command prompt and not from Terminal.
    How is it possible?
    my objective is to set screen resolution from command prompt.
    Last edited by rashidaa; January 19th, 2013 at 12:56 PM.

  2. #2
    Join Date
    Oct 2006
    Location
    California
    Beans
    Hidden!

    Re: How to Run a Command from Command prompt

    Hi,

    It looks like you're confusing the command prompt with the terminal. In linux, the command line interface is known as the terminal.

    Now, based on your previous posts, I'm assuming you want to get to the terminal to run chmod +x .xprofile so as to make it executable

    Assuming you want to create the .xprofile script, open the terminal, then type the following:

    Code:
    cd ~
    rm .xprofile
    touch .xprofile
    echo xrandr -s 1 > .xprofile
    chmod +x .xprofile
    Reboot or logout and let us know if that worked

  3. #3
    Join Date
    Jan 2013
    Beans
    6

    Unhappy Re: How to Run a Command from Command prompt

    On rebooting I lose the file.
    At present, I am trying lubuntu and boot it from USB, where I can save the file only for the session. On reboot I lose the file. I am unable to save file.
    I am not confusing the terminal window and command prompt.
    I go to the terminal window by ctrl+Alt+T
    where as I go to the Command prompt by
    Ctrl+Alt+F2
    At terminal window which I arrive at through Ctrl+Alt+T, I am able to change screen resolution by command
    xrandr -s 1
    but at Command prompt which arrive at through Ctrl+Alt+F2, I can not change the screen resolution by typing this command
    Why??

  4. #4
    Join Date
    Dec 2012
    Location
    Canada
    Beans
    187
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: How to Run a Command from Command prompt

    Quote Originally Posted by rashidaa View Post
    I go to the terminal window by ctrl+Alt+T
    where as I go to the Command prompt by
    Ctrl+Alt+F2
    At terminal window which I arrive at through Ctrl+Alt+T, I am able to change screen resolution by command
    xrandr -s 1
    but at Command prompt which arrive at through Ctrl+Alt+F2, I can not change the screen resolution by typing this command
    Why??
    My guess:

    - When you hit [Ctrl-Alt-T] you are launching a new process (a "Terminal" window) within the current X session, which by default runs on virtual terminal #7 (tty7).

    - When you hit [Ctrl-Alt-F2] you are switching to virtual terminal #2 (tty2) and there is no X session running there so `xrandr` doesn't work.

    The following might help explain:

    http://www.tuxfiles.org/linuxhelp/multiple-x.html
    Last edited by GordThompson; January 19th, 2013 at 02:38 PM.

  5. #5
    Join Date
    Jan 2013
    Beans
    6

    Re: How to Run a Command from Command prompt

    Thank you . This is a great information, I was quite unaware of it.
    Please tell, if there is any method from which we can send command from tty2 to tty7. That is can we manipulate tty7 from tty2.
    I think that it should be possible, but what is the method?

  6. #6
    Join Date
    Apr 2008
    Location
    LOCATION=/dev/random
    Beans
    5,767
    Distro
    Ubuntu Development Release

    Re: How to Run a Command from Command prompt

    You can prepend a command with the DISPLAY environment variable to indicate which display you want it to use. For example...
    Code:
    DISPLAY=:0.0 gedit
    Would open gedit on screen 0 on the first X display (usually TTY7).

    http://www.x.org/archive/X11R6.8.1/doc/X.7.html#sect4
    Cheesemill

  7. #7
    Join Date
    Apr 2012
    Beans
    6,754

    Re: How to Run a Command from Command prompt

    or for xrandr specifically you can specify the display via the -d parameter
    Code:
    xrandr -d :0 -q
    is equivalent to
    Code:
    DISPLAY=:0 xrandr -q

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •