ilia_kr Posted August 4, 2006 Report Share Posted August 4, 2006 I would like to learn some basic CLI commands that will allow me to do: - turn on/off the X server - start/stop/restart services I'm using Mandriva & FC4 so that commands should work in both systems. What are these commands? Thanks. Quote Link to comment Share on other sites More sharing options...
daniewicz Posted August 4, 2006 Report Share Posted August 4, 2006 service X start service Y stop where X and Y are the name of the service you wish to start or stop Quote Link to comment Share on other sites More sharing options...
ilia_kr Posted August 4, 2006 Author Report Share Posted August 4, 2006 service X startservice Y stop where X and Y are the name of the service you wish to start or stop doesn't work in fc4 Quote Link to comment Share on other sites More sharing options...
ianw1974 Posted August 4, 2006 Report Share Posted August 4, 2006 It should work in fedora. How are you doing the su? If you do: su then you need to type: /sbin/service name start/stop/restart If you type: su - then you can use: service name start/stop/restart and to get a list of services: chkconfig --list of course, without doing "su -" you need: /sbin/chkconfig --list I found this when using fedora and not using the su command correctly. Quote Link to comment Share on other sites More sharing options...
tyme Posted August 4, 2006 Report Share Posted August 4, 2006 in all linux (and bsd, even unix IIRC) distributions you should be able to do one of the following two: /etc/rc.d/servicename start|stop|restart or: /etc/init.d/servicename start|stop|restart for example: /etc/init.d/network stop where init.d could also be rc.d. as far as X11 goes, if it's starting at boot and your using a display manager you should be able to do: /etc/init.d/gdm stop where gdm could also be either kdm, xdm or just plain dm. i believe both fedora and mandriva use the init.d framework. Quote Link to comment Share on other sites More sharing options...
ianw1974 Posted August 4, 2006 Report Share Posted August 4, 2006 They do yes, a symlink to /etc/rc.d from memory. Quote Link to comment Share on other sites More sharing options...
ilia_kr Posted August 4, 2006 Author Report Share Posted August 4, 2006 [ilia@linux-fc4 ~]$ su Password: [root@linux-fc4 ilia]# service smb restart bash: service: command not found [root@linux-fc4 ilia]# /sbin/service smb restart Shutting down SMB services: [ OK ] Shutting down NMB services: [ OK ] Starting SMB services: [ OK ] Starting NMB services: [ OK ] [root@linux-fc4 ilia]# Problem is solved. Thank you guys. What about X or Gnome session? Quote Link to comment Share on other sites More sharing options...
tyme Posted August 4, 2006 Report Share Posted August 4, 2006 like i said (though I wouldn't expect you to read my post :P )...try using dm/gdm/xdm/kdm as the service...using what worked for you, you should try this: /sbin/service dm stop assuming you're using a display manager - as the DM actually initiates the X session. If you aren't using a display manager then you'll probably have to use kill as X doesn't normally have a service of it's own. so I would check to see if the above works, otherwise is a matter of finding the PID of the X process and killing that. Quote Link to comment Share on other sites More sharing options...
ilia_kr Posted August 4, 2006 Author Report Share Posted August 4, 2006 like i said (though I wouldn't expect you to read my post :P )... :blush: oops, didn't see it... Thank you tyme ! Quote Link to comment Share on other sites More sharing options...
tyme Posted August 4, 2006 Report Share Posted August 4, 2006 it's ok, i'm used to being ignored :D ;) Quote Link to comment Share on other sites More sharing options...
ianw1974 Posted August 4, 2006 Report Share Posted August 4, 2006 and if you don't want to type the /sbin/ before the service command, just do this to get root privileges instead: su - the minus is required to ensure the path searches are loaded. Quote Link to comment Share on other sites More sharing options...
ilia_kr Posted August 5, 2006 Author Report Share Posted August 5, 2006 Again, what is the difference between "su" and "su -" ? One more question: how can check what kernel version i'm using from CLI ? Quote Link to comment Share on other sites More sharing options...
aioshin Posted August 5, 2006 Report Share Posted August 5, 2006 su let you log as root but the path is still under your regular user, while su - let you log as root with all the path of user ROOT... checking kernel ver. at cli.. uname -a Quote Link to comment Share on other sites More sharing options...
Steve Scrimpshire Posted August 5, 2006 Report Share Posted August 5, 2006 More specifically: < root /home/omar > su --help Usage: su [OPTION]... [-] [USER [ARG]...] Change the effective user id and group id to that of USER. -, -l, --login make the shell a login shell You are making it a login shell, so that it sources your /root/.bashrc, /root/.bash_profile, etc. Quote Link to comment Share on other sites More sharing options...
Gowator Posted August 5, 2006 Report Share Posted August 5, 2006 (edited) it's ok, i'm used to being ignored :D ;) What... who are you? su let you log as root but the path is still under your regular user, while su - let you log as root with all the path of user ROOT... checking kernel ver. at cli.. uname -a Or more specifically uname -r -a is a good fallback but when using scripts unname -r gives the exact kernel so you can quote it as a llteral string and use it for urpmi etc. apt-get install kernel-headers-`uname -r` instead of the clunky apt-get install kernel-headers-`uname -a | cut -f 3 -d' '` change apt-get to urpmi for mandriva..... There is a great O'reilly unix/linux tool kit site with loads of stuff like this ... well worth a google. The thing is the more you use and the more generic the more you can combine .. This is why tymes method is IMHO much better because its universal (only changing the rc.d or init.d dirs according to SYS V or BSD) .... edits missed 1st example Edited August 5, 2006 by Gowator Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.