LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to edit inittab file? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-edit-inittab-file-797776/)

gardenair 03-25-2010 06:44 AM

How to edit inittab file?
 
Hi,
The default setting of linux is run level 5 (Red Hat 9) I want to use my system in Runlevel 1. For that purpose i 1st check the permission which were

-rw-r--r--

I want to edit the File " vim /etc/inittab " in the terminal .please let me know which line should i edit so I may use it in a single mode.

2-The second thing i want to ask that before editing any important file which are /etc like "inittab" can i 1st make it's copy and keep it in my home directoty so,in case of any mistake I can get my original file?

What u suggest me
thanks in advance.
mypass

i92guboj 03-25-2010 07:02 AM

Quote:

Originally Posted by gardenair (Post 3911613)
Hi,
The default setting of linux is run level 5 (Red Hat 9) I want to use my system in Runlevel 1. For that purpose i 1st check the permission which were

-rw-r--r--

What file do these permissions belong to? What is your effective user id when doing the editing?

Quote:

I want to edit the File " vim /etc/inittab " in the terminal .please let me know which line should i edit so I may use it in a single mode.
The inittab file comes well commented, that includes a note letting you know which line is responsible for setting the default runlevel. You should however read the inittab man page (just type "man inittab") before doing anything at all.

If you only need to operate in runlevel 1 once (or once in a while) there are ways to boot into that runlevel without having to edit the inittab file. For example, just pass "1" as an argument to the kernel boot line.

Quote:

2-The second thing i want to ask that before editing any important file which are /etc like "inittab" can i 1st make it's copy and keep it in my home directoty so,in case of any mistake I can get my original file?
You can copy any file to any location. But if you don't know how to copy a file, in first place, you shouldn't be messing with system files...

From command line, you can use "cp" to copy files. Use "cp -a" to preserve permissions and ownerships.

"cp" also has a man page, just like almost every regular command.

sreeharsha.t 03-25-2010 07:49 AM

Hi,

Change the line :
Code:

id:5:initdefault
to
Code:

id:1:initdefault:
But, before you do consider whether you really want to do this as suggested by i92guboj.

You can take a backup of any file provided you have a read permission on it. To take the backup of the inittab file:

Code:

cp /etc/inittab /home/harsha/inittab.bk
To recover using the backup

Code:

cp /home/harsha/inittab.bk /etc/inittab
Regards,
Harsha


All times are GMT -5. The time now is 07:35 AM.