LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 07-07-2007, 04:37 PM   #1
AriciU
Member
 
Registered: Jul 2007
Location: Bucharest, Romania
Distribution: Ubuntu 7.04, Slackware 12
Posts: 87

Rep: Reputation: 15
Make the terminal show me where i am


I'm using the xfce terminal. The default output is this:

Quote:
bash-3.1#
How can i modify that so it'll show me where i am in the file structure? Instead of bash-3.1 to show /home/directory_where_i_am ?
 
Old 07-07-2007, 04:42 PM   #2
reddazz
LQ Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 77
On most distros, you can do
Code:
#cp /etc/skel/.bash* /home/someuser/.
#chown someuser:somegroup /home/someuser/.bash*
 
Old 07-07-2007, 04:54 PM   #3
erklaerbaer
Member
 
Registered: Mar 2006
Posts: 381

Rep: Reputation: 30
not on this one

maybe http://humanreadable.nfshost.com/sdeg/bash_startup.htm is interesting for you.
alternatively you could make your terminal a login shell ( -ln ,-ls or something )
 
Old 07-07-2007, 05:08 PM   #4
dive
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,467

Rep: Reputation: Disabled
I think this is what you are after:

PS1="\u@\h \w "

You just need to put that command somewhere that will be read when you open a terminal - ~/.bashrc whould do it.
 
Old 07-07-2007, 05:17 PM   #5
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
You need to export the variable as well, don't you? It should be

export PS1="..."
 
Old 07-07-2007, 05:58 PM   #6
AriciU
Member
 
Registered: Jul 2007
Location: Bucharest, Romania
Distribution: Ubuntu 7.04, Slackware 12
Posts: 87

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by dive
I think this is what you are after:

PS1="\u@\h \w "

You just need to put that command somewhere that will be read when you open a terminal - ~/.bashrc whould do it.
Thanks! Worked great

Also. Any idea how to make the terminal use the classic linux colours? I mean show the directories in green just like in the original console... so you know witch is a directory, witch is a file, etc...... In Gnome-terminal there was an option but in xfce terminal nothing like that at all.

EDIT: found it... "run command as login shell". Nice colours now :>

Last edited by AriciU; 07-07-2007 at 06:00 PM.
 
Old 07-07-2007, 06:00 PM   #7
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
Run "dircolors".
 
Old 07-07-2007, 07:58 PM   #8
spiffytech
Member
 
Registered: Dec 2005
Location: NC, USA
Distribution: (K)ubuntu
Posts: 139

Rep: Reputation: 15
I'm having trouble customizing my terminal in Slackware 12. I've copied my .bashrc from my Kubuntu installation to my home directory, and my /root/ directory. However, neither my custom prompt nor my aliases are activated upon login. I've checked the file's permissions and done a quick google search, but didn't find anything useful. What could be going wrong?
 
Old 07-07-2007, 08:07 PM   #9
icmp_request
Member
 
Registered: Jun 2007
Location: São Paulo - Brazil
Distribution: Linux Mint
Posts: 54

Rep: Reputation: 15
spiffytech, do you have also .bash_profile or .profile on your home dir? If not, Try making a ~/.profile file with the following content:

# Begin ~/.profile

if [ -f "$HOME/.bashrc" ] ; then
source $HOME/.bashrc
fi

# End ~/.profile

"If there is a ~/.bashrc file then source it" . When you are inside an interactive login shell, e.g. tty1-6 by default .bashrc is not sourced, but you can override it doing this.

Last edited by icmp_request; 07-07-2007 at 08:10 PM.
 
Old 07-07-2007, 10:28 PM   #10
spiffytech
Member
 
Registered: Dec 2005
Location: NC, USA
Distribution: (K)ubuntu
Posts: 139

Rep: Reputation: 15
The bash_profile did it. Thanks!
 
Old 07-07-2007, 10:55 PM   #11
icmp_request
Member
 
Registered: Jun 2007
Location: São Paulo - Brazil
Distribution: Linux Mint
Posts: 54

Rep: Reputation: 15
No problem! If you want more information about bash login files check bash manual:

bash# man bash
 
Old 07-08-2007, 09:11 AM   #12
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: Slackware®
Posts: 13,923
Blog Entries: 44

Rep: Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158
Hi,

A sample of a .bashrc;
Code:
odin:~# cat .bashrc

#.bashrc
#08-30-06 12:20 gws copied loki:/root

# Add bin to path
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 gws

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 gws

#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
A sample of .bash_profile;

Code:
odin:~# cat .bash_profile
# .bash_profile
#08-30-06 12:21 gws copied loki:/root

# Source .bashrc
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi
A user .bashrc;

Code:
odin:~# cat /home/gws/.bashrc
#.bashrc
#08-30-06 12:17 gws copied loki:/home/gws
# Add bin to path
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 gws

#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 na='nano'
alias web='links -g -download-dir ~/ www.google.com'

#08-29-06 11:45 gws
#To clean this 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
Note the difference in the 'if' for the root test and the user .bashrc is absolute.

You could look at 'Advanced Bash-Scripting Guide' to get more information.

This link and other useful links can be found at 'Slackware LQ Suggestions!'.
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Terminal dosen't show location JAKK Linux - General 6 02-06-2007 07:36 PM
how to show input and output of a program on the terminal divin Linux - Software 1 03-25-2005 12:19 AM
configuring terminal so not to show full path harshnoise SUSE / openSUSE 2 02-26-2005 07:42 AM
show all terminal typed commands joulupukki Linux - Newbie 6 05-10-2004 04:42 AM
Bash: show on terminal and save to file shadowhunter Linux - Newbie 5 12-13-2003 04:49 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 06:14 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