Linux - GeneralThis 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
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.
What are the symptoms that make you believe the PS1 and ls alias don't work?
PATH is not exported so will work only interactive shells; it will not be available in, for example, any shell scripts which will have the original version of $PATH.
Regards PS1, you can use echo $PS1 to show that it has been set. If \H does not display anything try \h. If that does not work (or you need \H) perhaps there is something wrong with the local hostname setting. What is the output of hostname ?
The ls alias tests OK on my system. You can check if it has been set using the alias command with no options or arguments. You can check the command itself by running /bin/ls --color=tty
What are the symptoms that make you believe the PS1 and ls alias don't work?
I just checked this again... PS1 and ls alias seem to work well in Konsole, but not Yakuake.. but i hardly use Konsole.. most of the time i use Yakuake, hence i had not noticed this. (PATH does work though, as expected, in Yakuake)
Quote:
Originally Posted by catkin
PATH is not exported so will work only interactive shells; it will not be available in, for example, any shell scripts which will have the original version of $PATH.
Noted. I'll 'export' the PATH variable
Quote:
Originally Posted by catkin
Regards PS1, you can use echo $PS1 to show that it has been set. If \H does not display anything try \h. If that does not work (or you need \H) perhaps there is something wrong with the local hostname setting. What is the output of hostname ?
echo $PS1 in Yakuake says '\s-\v\$'. Since it is working good in Konsole (as admitted above) i am assuming the \H is correct
Quote:
Originally Posted by catkin
The ls alias tests OK on my system. You can check if it has been set using the alias command with no options or arguments. You can check the command itself by running /bin/ls --color=tty
again, simply firing 'alias', shows me the --color=tty in Konsole, but not in Yakuake
Last edited by logicalfuzz; 05-29-2010 at 03:50 AM.
You could setup a .bashrc & .bash_profile for yourself or for a user;
Code:
sample .bash_profile;
# .bash_profile
#08-30-06 12:21
#
# Source .bashrc
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
Code:
sample .bashrc;
#.bashrc
#08-30-06 12:20
# Add bin to path
export PATH="$PATH:/sbin:/usr/sbin:$HOME/bin"
#export PATH="$PATH:$HOME/bin"
# Dynamic resizing
shopt -s checkwinsize
# Custom prompt
#PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
#08-29-06 11:40
if [ `id -un` = root ]; then
PS1='\[\033[1;31m\]\h:\w\$\[\033[0m\] '
else
PS1='\[\033[1;32m\]\h:\w\$\[\033[0m\] '
fi
#
# Add color
eval `dircolors -b`
# User defined aliases
alias cls='clear'
alias clls='clear; ls'
alias ll='ls -l'
alias lsa='ls -A'
alias lsg='ls | grep'
alias lsp='ls -1 /var/log/packages/ > package-list'
alias na='nano'
alias web='links -g -download-dir ~/ www.google.com'
#08-29-06 11:50
#To clean up and cover your tracks once you log off
#Depending on your version of BASH, you might have to use
# the other form of this command
trap "rm -f ~$LOGNAME/.bash_history" 0
#The older KSH-style form
# trap 0 rm -f ~$LOGNAME/.bash_history
Thanks for the update. Given that, in Yakuake, $PS1 is different and alias does not show the ls alias from your ~/.bashrc it seems likely that Yakuake initialisation is doing some other bash initialisation ... ?
Here is a copy of my working .bash_profile in Fedora , it should give you an idea of how to set up your bash_profile.
Code:
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
PATH=$PATH:$HOME/bin:$HOME/bin/
BASH_ENV=$HOME/.bashrc
USERNAME="steve"
PS1='[\u@\h]$ '
PS2='[\u@\h]# '
export USERNAME BASH_ENV PATH PS1 PS2
clear
uname -osrn
date
echo
Indeed yes! i did not have a .bashrc before... now that i have it, and all commands moved to bashrc file from bash_profile, they seem to work.. thanks!
I am yet to figure out how the PATH variable was working.. maybe its set somewhere else too... 'coz i can now see the 'sbin' paths in the PATH variable twice.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.