-   Linux - General (
-   -   whats the open command? (

zexter 11-01-2003 08:32 PM

whats the open command?
what is the command to open something if i know the directory of it?

trickykid 11-01-2003 08:34 PM

If its in your users path, simply type the name of it.

If its not in your users path, type the whole path out to the command or cd into the directory and then type ./command-name

zexter 11-01-2003 08:45 PM

umm none of that worked

zexter 11-01-2003 08:47 PM

im in the /etc directory and when i type in ./inittab it tells me permission denie.... but im in root... i have to know how to do this thru command line not thru the file browser...

anyone who can help please do


trickykid 11-01-2003 08:50 PM


Originally posted by zexter
im in the /etc directory and when i type in ./inittab it tells me permission denie.... but im in root... i have to know how to do this thru command line not thru the file browser...

anyone who can help please do


That's because that is a text file and not a program. If you had provided more details, maybe I could have explained myself better.

If you want to edit text files, you need to use vi or pico or any other editor of your choice to edit them.

Simply after cd'ing into the /etc directory:

vi inittab


pico inittab

Will open the text file to edit and save. And before you ask how to use these console text editors, please use the search button on this site, these are very basic questions which have been asked many many times.


zexter 11-01-2003 08:51 PM

sorry and thanks

quatsch 11-01-2003 08:53 PM

what do you mean by 'open'? Do you mean open it in an editor? If so,
vi {filename}
will open it in vi. {filename} can be the full path or just the name if you are in the directory where it is; e.g. vi /etc/inittab or just vi inittab if you are in /etc. You can use
emacs {filename}
to open it using emacs or
kedit {filename}
to open it in kedit or
konqueror {filename}
to open it using konqueror, etc.

edit oops, must've been typing when trickykid posted.

Mrcdm 11-01-2003 08:55 PM

You need to be more specific when you say you want to 'open' something, first off, to simply view a text file use the 'cat', 'more' or 'less' command. If you want to edit the text file use vi or whatever editor you prefer. To run a script or executable file that's not in your path you would use ./executable_name.

The inittab file in your example is a straight text file, unless you've done something funny to it and made it executable.

To be more specific:
if you just want to view the file.
cat /etc/inittab
less /etc/inittab
more /etc/inittab

if you just want to edit the file:
vi /etc/inittab
make sure you have some understanding of exiting vi before dong this or you'll become quickly frustrated and press the reset button.

Mrcdm 11-01-2003 08:57 PM

We all got in didn't we. Feel bombarded? Must be a good feeling then

zexter 11-01-2003 08:58 PM

when i vi to the inittab file it brings it up but i cant edit it, i can move my cursor all around in there but i cannot change anything

quatsch 11-01-2003 09:01 PM

you have to be root for inittab and other files not in your home directory. Use
to become root and then open it.

zexter 11-01-2003 09:02 PM

im already root.... i logged in as root

trickykid 11-01-2003 09:11 PM


Originally posted by zexter
im already root.... i logged in as root
You can't use your mouse to edit. You actually have to type in commands to start editing, etc.

man vi for more details.

Some quick hints about vi since you seem to not search the site like I asked nicely:

ESC = Takes you back to command mode.
I = Puts you in Interactive mode so you can type, edit, delete contents of the file.

After you go into Interactive mode to edit by pressing I, you will then edit by moving your arrow keys over what you want to edit in the file, etc.
Then you type ESC to go back to command mode and from there you can simply type:


That will quit and write to the file the changes made.

zexter 11-01-2003 09:18 PM

thank you and sorry, and ya i did search.... but the I thing works i changed the id from 5 to 3, but when i hit the ESC buttton, it doesnt do anything

quatsch 11-01-2003 09:25 PM

It might not look like anything happens when you hit ESC but you should be back to command mode. Press the sequence
and see if it saves the changes and then
to quit the program.

BTW, are you sure you want to change the default runlevel to 3? If you do, you'll have to deal with the command line and use startx to start gui. If all you want to do is terminate X temporarily to install something, you
init 3
telinit 3
as root to get out of X. You can restart X with
init 5
telinit 5

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