LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-04-2010, 08:14 AM   #1
sametyalcin
LQ Newbie
 
Registered: Aug 2010
Posts: 3

Rep: Reputation: 0
help for make a special terminal ?


Hii everbody,

I wanna terminal do some commands without my command as soon as I open it. For example I have to show PATH to computer therefore whenever I open terminal I want not to say terminal:

$ source /home/samet/.bashrc

everytime...

I hope that terminal can process this command and/or these commands when I open it.

How can I do that? what should I do simply?

Best regard...
 
Old 10-04-2010, 08:44 AM   #2
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: Slackware®
Posts: 12,541
Blog Entries: 23

Rep: Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943
Hi,

You could setup a .bashrc & .bash_profile for your user;
Code:
 sample .bash_profile;
 
 ~$ cat .bash_profile
 # .bash_profile
 #08-30-06 12:21
 #
 # Source .bashrc
 if [ -f ~/.bashrc ]; then
         . ~/.bashrc
 fi
Code:
 sample .bashrc;
 :~$ cat .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
The .bashrc is very useful!

Just a few links to aid you;
Linux Documentation Project
Rute Tutorial & Exposition
Linux Command Guide
Ultimate Linux Newbie Guide
LinuxSelfHelp
Getting Started with Linux
Bash Reference Manual
Advanced Bash-Scripting Guide
Linux Home Networking
Virtualiation- Top 10

The above links and others can be found at Slackware-Links'. More than just Slackware® links!

Last edited by onebuck; 10-04-2010 at 08:46 AM.
 
Old 10-05-2010, 03:39 AM   #3
sametyalcin
LQ Newbie
 
Registered: Aug 2010
Posts: 3

Original Poster
Rep: Reputation: 0
Thank you but I think the problem I wanna solve is not this.
To use the commands;

(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')

I have to say in terminal $ source .bashrc , haven't I? But as soon as terminal start, terminal must say

$ source .bashrc

or

$ su

or etc.
thank you very much for the sources you sent, I could not examine yet. I believe they will help me but the issue I wonder is if I run commands that ı want automatically.
 
Old 10-05-2010, 05:07 AM   #4
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,629

Rep: Reputation: Disabled
Well I dont think that you need to do that. if you have .bashrc file in your home directory, it will be read when you login. You do not need to do it manually.
 
Old 10-05-2010, 06:27 AM   #5
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,063

Rep: Reputation: 381Reputation: 381Reputation: 381Reputation: 381
First, make sure you are using bash. Logically, if you use any other shell putting stuff into the bash initialization files will never help you.

Second, read the bash man page, the file you need to use will be different depending on the way you open the shell (login vs. non login shells, look into the man page for ~/.bashrc, ~/.bash_profile and a few others). You can also source .bashrc from any other bash rc file, as suggested about by onebuck.

Third, if you use any other shell then use the correct rc file for that shell. Check the relevant man page.

Tip:

Code:
# echo $SHELL
/bin/bash
 
Old 10-05-2010, 09:26 AM   #6
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: Slackware®
Posts: 12,541
Blog Entries: 23

Rep: Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943
Hi,

Quote:
Originally Posted by sametyalcin View Post
Thank you but I think the problem I wanna solve is not this.
To use the commands;

(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')

I have to say in terminal $ source .bashrc , haven't I? But as soon as terminal start, terminal must say

$ source .bashrc

or

$ su

or etc.
thank you very much for the sources you sent, I could not examine yet. I believe they will help me but the issue I wonder is if I run commands that ı want automatically.
If you are using 'bash' then place the two sample files: .bash_profile (which will source) .bashrc in the '~' (home) directory of the user. Modify the samples to suit your needs. The .bash_profile will be used to source the .bashrc file when you enter the shell/terminal for the user. Once this is done then the 'alias' defined will be available:

~#ll <<< would provide the 'ls -l' output desired for root.
or
~$ll
<<< would provide the 'ls -l' output desired for user.

A few more useful links;

Bash Beginners Guide would be something you should reference.

Linux Shell Scripting Tutorial v1.05r3 A Beginner's handbook tutorial is designed for beginners who wish to learn the basics of shell scripting/programming plus introduction to power tools such as awk, sed, etc.

Bash Reference Manual is another Great Manual.

Advanced Bash-Scripting Guide 6.1 is Revised. This document is both a tutorial and a reference on shell scripting with Bash'

Advanced Bash-Scripting Guide 6.0.05 document is both a tutorial and a reference on shell scripting with 'Bash'.

The above links and others can be found at '
Slackware-Links'. More than just Slackware® links!


 
Old 10-07-2010, 10:53 AM   #7
sametyalcin
LQ Newbie
 
Registered: Aug 2010
Posts: 3

Original Poster
Rep: Reputation: 0
But once I enter as su, I still have to show PATH to use my script. Yes it is exporting PATH while I am not as su.

I know that my experience is not enough, sometimes I confuse. But I am stubborn. So I m reading the source you have showm, they will certainly solve my lots of problems.

But now;

I have made .bash_profile like yours and done processes. when I enter, terminal is good, the settings I want is coming. But when I login as su there is nothing, I am beginning from zero.

I am not sure if I reply your effort, so sorry and thank you so much...
 
Old 10-07-2010, 01:48 PM   #8
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: Slackware®
Posts: 12,541
Blog Entries: 23

Rep: Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943
Hi,

Try 'su -'. 'man su' shold be read to understand.
 
  


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
How to make special keys run commands without X? catkin Slackware 4 06-07-2010 04:38 AM
[SOLVED] Make linux terminal transparent with terminal command? yooy Linux - Newbie 1 05-11-2010 04:24 AM
LXer: 5 things make Kubuntu 9.10 special LXer Syndicated Linux News 0 10-28-2009 03:21 PM
Ubuntu 8.04 Terminal - Can you make the terminal window transparent with a wallpaper? bparkerson04 Linux - Newbie 6 02-17-2009 06:12 PM
How to open a terminal in a special folder under nautilus? kevinqian Linux - Newbie 1 12-04-2003 08:59 AM


All times are GMT -5. The time now is 09:04 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration