LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 12-20-2010, 08:48 PM   #1
HazMat117
LQ Newbie
 
Registered: Apr 2008
Location: NW Ohio
Distribution: Debian, Fedora
Posts: 23

Rep: Reputation: 0
Question Two quick terminal questions.


I have a VM of Fedora 12 set up for school. I was instructed to set it up to start in runlevel 3. I also have a habit of customizing my .bashrc file. I create a lot of aliases for CDing to various directories among other things. I was doing this before I started x. I was in the /var/www directory when I started x. I noticed after I was in gnome that whenever I started a terminal it would open up to the /var/www directory. My question is, is this normal?

My second question is dealing with my .bashrc file. I edited the file for root. When I open up the terminal in user it did not have any of my aliases from root. I have searched and thought I had it figured out how to get they to "sync" for lack of better word. Any suggestions would be helpful. I will copy and past my root .bashrc file and user file below.

user .bashrc file


# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi

# User specific aliases and functions

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias ..='cd ..'
alias ..2='cd ../..'
alias ..3='cd ../../..'
alias ..4='cd ../../../..'
alias ..5='cd ../../../../..'
alias ll='ls -l'
alias l='ls -ltr'
alias cls='clear'
alias Desktop='cd /home/hazmat/Desktop'
alias desktop='cd /home/hazmat/Desktop'
alias Documents='cd /home/hazmat/Documents'
alias docs='cd /home/hazmat/Documents'
alias documents='cd /home/hazmat/Documents'
alias Downloads='cd /home/hazmat/Downloads'
alias downloads='cd /home/hazmat/Downloads'
alias Music='cd /home/hazmat/Music'
alias music='cd /home/hazmat/Music'
alias movies='cd /home/hazmat/Videos'
alias Movies='cd /home/hazmat/Videos'
alias Videos='cd /home/hazmat/Videos'
alias videos='cd /home/hazmat/Videos'
alias vids='cd /home/hazmat/Videos'
alias pics='cd /home/hazmat/Pictures'
alias Pictures='cd /home/hazmat/Pictures'
alias pictures='cd /home/hazmat/Pictures'
alias x='exit'
alias bashrc='vi ~/.bashrc'

root .bashrc file


# .bashrc

# User specific aliases and functions

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias ..='cd ..'
alias ..2='cd ../..'
alias ..3='cd ../../..'
alias ..4='cd ../../../..'
alias ..5='cd ../../../../..'
alias ll='ls -l'
alias l='ls -ltr'
alias cls='clear'
alias Desktop='cd /home/hazmat/Desktop'
alias desktop='cd /home/hazmat/Desktop'
alias Documents='cd /home/hazmat/Documents'
alias docs='cd /home/hazmat/Documents'
alias documents='cd /home/hazmat/Documents'
alias Downloads='cd /home/hazmat/Downloads'
alias downloads='cd /home/hazmat/Downloads'
alias Music='cd /home/hazmat/Music'
alias music='cd /home/hazmat/Music'
alias pics='cd /home/hazmat/Pictures'
alias Pictures='cd /home/hazmat/Pictures'
alias pictures='cd /home/hazmat/Pictures'
alias movies='cd /home/hazmat/Videos'
alias Movies='cd /home/hazmat/Videos'
alias Videos='cd /home/hazmat/Videos'
alias videos='cd /home/hazmat/Videos'
alias vids='cd /home/hazmat/Videos'
alias x='exit'
alias bashrc='vi ~/.bashrc'
alias home='cd /home'
alias hazmat='cd /home/hazmat'
alias var='cd /var'



# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi

(I copied the aliases from one to the other until I can figure out what I am doing wrong. I googled it quite a bit before asking but my google-fu seems to be weak today)
 
Old 12-20-2010, 09:42 PM   #2
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
How did you become root ? .. 'sudo su -' ?
 
Old 12-20-2010, 10:18 PM   #3
HazMat117
LQ Newbie
 
Registered: Apr 2008
Location: NW Ohio
Distribution: Debian, Fedora
Posts: 23

Original Poster
Rep: Reputation: 0
No I used su then the root password, to the best of my knowledge Fedora 12 does not have a sudo account set up.

#EDIT# I guess Fedora 12 does have sudo but needs setup, I have not done this. I edited the .bashrc files in root. Tested them and they worked. Then I tried to test them as user, they did not. I then copied all my aliases from root to user in vim and then deleted them from root. Worked in user, but not root. So I tried the script that was suggested. (It is above) Messed with it some more and still could not figure it out .

Last edited by HazMat117; 12-20-2010 at 10:46 PM.
 
Old 12-20-2010, 10:47 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Re q1)
Yes, that's normal. All sub-shells will inherit the PWD from the
shell you spawn them from; even a DE/WM will, hence gnome (and all
terminal windows started from it) will have the same PWD.

Re q2)
Use "su - " to get root's work environment - "su" will keep the
environment of the user invoking it.



Cheers,
Tink
 
Old 12-20-2010, 11:33 PM   #5
HazMat117
LQ Newbie
 
Registered: Apr 2008
Location: NW Ohio
Distribution: Debian, Fedora
Posts: 23

Original Poster
Rep: Reputation: 0
So if I understand this correctly for the first answer, since I ran the command startx from the /var/www directory all my sub terminals start from there. Not a big deal just found it to be curious.

For the second question maybe I am not asking it correctly. I am trying to get the .bashrc files to be made in one spot and have both my user account and root account recognize it. After a little more thought I realize you would not want to do this on a server but would be a nice thing to have on my home machines. Since I have started this thread though I have decided to just make a default .txt file to carry on my thumbstick that I can just copy and past in vim whenever I set up a new install. Since I will not be editing them by hand any more in vim I will just consider this a closed thread.

Thanks for your help guys

Last edited by HazMat117; 12-20-2010 at 11:36 PM.
 
Old 12-21-2010, 01:40 AM   #6
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
If you want these aliases available to all users then add them to /etc/bashrc

cheers
 
  


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
Two quick (hopefully) questions Roy G. Biv Incognito 2 10-15-2009 08:48 AM
How do I send a quick email via terminal glenn69 Linux - Newbie 2 04-15-2007 01:00 AM
Quick terminal question benrose111488 Linux - Software 10 07-02-2005 11:12 AM
Quick questions Nylex Slackware 4 09-21-2003 07:16 AM
Two quick questions rand07 Linux - Newbie 1 12-09-2001 02:57 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:35 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration