LinuxQuestions.org
Visit Jeremy's Blog.
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 11-01-2003, 07:32 PM   #1
zexter
Member
 
Registered: Oct 2003
Location: Saint Louis, Missouri
Distribution: Mandrake 10 Official
Posts: 210

Rep: Reputation: 30
whats the open command?


what is the command to open something if i know the directory of it?
 
Old 11-01-2003, 07:34 PM   #2
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 197Reputation: 197
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
 
Old 11-01-2003, 07:45 PM   #3
zexter
Member
 
Registered: Oct 2003
Location: Saint Louis, Missouri
Distribution: Mandrake 10 Official
Posts: 210

Original Poster
Rep: Reputation: 30
umm none of that worked
 
Old 11-01-2003, 07:47 PM   #4
zexter
Member
 
Registered: Oct 2003
Location: Saint Louis, Missouri
Distribution: Mandrake 10 Official
Posts: 210

Original Poster
Rep: Reputation: 30
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


thanks
 
Old 11-01-2003, 07:50 PM   #5
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 197Reputation: 197
Quote:
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


thanks
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

or

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.

Regards.
 
Old 11-01-2003, 07:51 PM   #6
zexter
Member
 
Registered: Oct 2003
Location: Saint Louis, Missouri
Distribution: Mandrake 10 Official
Posts: 210

Original Poster
Rep: Reputation: 30
sorry and thanks
 
Old 11-01-2003, 07:53 PM   #7
quatsch
LQ Addict
 
Registered: Aug 2003
Location: New York, NY
Distribution: gentoo, gentooPPC
Posts: 1,661

Rep: Reputation: 47
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.
 
Old 11-01-2003, 07:55 PM   #8
Mrcdm
Member
 
Registered: Apr 2003
Location: Australia
Distribution: Debian 3, 31r0, 4, slackware, DSL, RH8.0/7, MDK9/10, et al. Vista is cute but not Linux - I tried
Posts: 70

Rep: Reputation: 15
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
or
less /etc/inittab
or
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.
 
Old 11-01-2003, 07:57 PM   #9
Mrcdm
Member
 
Registered: Apr 2003
Location: Australia
Distribution: Debian 3, 31r0, 4, slackware, DSL, RH8.0/7, MDK9/10, et al. Vista is cute but not Linux - I tried
Posts: 70

Rep: Reputation: 15
We all got in didn't we. Feel bombarded? Must be a good feeling then
 
Old 11-01-2003, 07:58 PM   #10
zexter
Member
 
Registered: Oct 2003
Location: Saint Louis, Missouri
Distribution: Mandrake 10 Official
Posts: 210

Original Poster
Rep: Reputation: 30
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

Last edited by zexter; 11-01-2003 at 08:01 PM.
 
Old 11-01-2003, 08:01 PM   #11
quatsch
LQ Addict
 
Registered: Aug 2003
Location: New York, NY
Distribution: gentoo, gentooPPC
Posts: 1,661

Rep: Reputation: 47
you have to be root for inittab and other files not in your home directory. Use
su
to become root and then open it.
 
Old 11-01-2003, 08:02 PM   #12
zexter
Member
 
Registered: Oct 2003
Location: Saint Louis, Missouri
Distribution: Mandrake 10 Official
Posts: 210

Original Poster
Rep: Reputation: 30
im already root.... i logged in as root
 
Old 11-01-2003, 08:11 PM   #13
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 197Reputation: 197
Quote:
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:

qw!

That will quit and write to the file the changes made.
 
Old 11-01-2003, 08:18 PM   #14
zexter
Member
 
Registered: Oct 2003
Location: Saint Louis, Missouri
Distribution: Mandrake 10 Official
Posts: 210

Original Poster
Rep: Reputation: 30
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
 
Old 11-01-2003, 08:25 PM   #15
quatsch
LQ Addict
 
Registered: Aug 2003
Location: New York, NY
Distribution: gentoo, gentooPPC
Posts: 1,661

Rep: Reputation: 47
It might not look like anything happens when you hit ESC but you should be back to command mode. Press the sequence
:w
and see if it saves the changes and then
:q
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
or
telinit 3
as root to get out of X. You can restart X with
init 5
or
telinit 5
 
  


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
whats the (wd:...) in the table of the jobs command? merlin23 Linux - Newbie 3 08-13-2013 04:15 PM
whats the dangers of leaving a port open? Mr. New General 3 08-09-2005 05:18 PM
whats the first command? matthewa Linux From Scratch 4 04-04-2005 02:45 PM
Whats the output given by make -p command? cranium2004 Programming 2 03-11-2005 06:11 AM
whats the command for this. dkc_ace Linux - General 1 12-20-2002 09:55 PM


All times are GMT -5. The time now is 07:15 PM.

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