SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi im curious as to what all the startup files are that slackware uses.
files like the autoexec.bat file from dos that runs when dos starts up. from reading other questions i can see there are rc.local and some others but i was hoping for some others so i can run a particular startup script when a particular user logs in or when x starts etc. do these files exist or are their any other ways people can think of to get around this.
thanks.
Ben.
i was hoping for some others so i can run a particular startup script when a particular user logs in or when x starts etc.
- to do stuff when an user login : first you have to know what shell he uses by looking at /etc/passwd (the shell is the last info, eg /bin/bash).
for bash : edit .bashrc in the user directory, for csh .profile... for others use man +shell name to see what the shell init file is.
- to do stuff when startx, edit the appropriate xinitrc file in /etc/X11/xinit (the config that correspond to the window manager)
all users are using the bash shell (hey i just said shell twice) there is no ".bashrc" file in the users home directory. if i just create one and add the code i want into it will the system find it ok? or shall i tell another file somewhere that the file exists now?
When you login with a new shell, bash reads /etc/profile and /home/user/.bash_profile if it exists.
Slackware doesn't have a .bash_profile in the user's directory by default, but just create it with the aliases, functions, or commands you want to run on login and bash will find and use it.
You can also invoke, or start, bash as a subshell -- meaning it's not a log-in, just another process running under your current shell. When bash starts in this manner, it doesn't read the profiles... It looks for /etc/bashrc or /home/user/.bashrc
A simple way to get bash to read the log-in commands, aliases, etc every time a new instance is started is to keep all of your customizations in /home/user/.bash_profile and then simply have these two lines in your .bashrc:
Code:
source /etc/profile
source ~/.bash_profile
Thus, .bash_profile is read on login, and from a subshell, as referenced through .bashrc
Also, on another note, Slackware uses BSD style initscripts, rather than the System V style most other linux distrobutions use. The layout of the /etc/rc.d/ directory is a bit different, but in my opinion, more straightforward.
There is a HOW-TO at www.tldp.org called "From Boot to Bash" which goes over the whole boot process, if you're interested. There may also be a bit on this at www.freebsd.org in the freebsd handbook, which is also an excellent source of dry, easy to follow information.
Yeah, it takes but a mere moment to wrap your head around it. Once you get it, it's quite simple.
I just leave .bashrc the same and add all my stuff to .bash_profile
That way, whenever you start a terminal session, or log in, you're always dealing with the same thing. That's the way I like it.
I can, however, envision instances where I wouldn't want them both to be the same.
Say for example -- I like having fortune show up on log in. But it gets annoying if it starts with every single aterm or xterm.. So you could just include source .bash_profile and include your PS1 prompt setting in there, to have a uniform prompt but no fortune in xterms, etc.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.