LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 06-15-2011, 07:58 AM   #1
hitmen
Member
 
Registered: Jun 2011
Distribution: Kubuntu 10.04
Posts: 158

Rep: Reputation: Disabled
.bash_profile file


Adapted from: http://linuxcommand.org/wss0010.php

Most modern Linux distributions encourage a practice in which each user has a specific directory for the programs he/she personally uses. This directory is called bin and is a subdirectory of your home directory. If you do not already have one, create it with the following command:

mkdir bin # It is empty. Am I correct?

This bin directory is different from /usr/bin . Am I correct?




Now, before you become too confused about what I just said, let's make an alias. Make sure you are in your home directory. Using your favorite text editor, open the file .bash_profile and add this line to the end of the file:


alias l='ls -l'

Is the home directory /home or /home/username?
Either way I cant find where the .bash_profile file is.
Help!
 
Old 06-15-2011, 08:04 AM   #2
ozminh
Member
 
Registered: Aug 2007
Posts: 73

Rep: Reputation: 19
you mean 'cd ~; ls -a'?
 
Old 06-15-2011, 08:04 AM   #3
andrewthomas
Senior Member
 
Registered: May 2010
Location: Chicago Metro
Distribution: Arch, Gentoo, Slackware
Posts: 1,690

Rep: Reputation: 308Reputation: 308Reputation: 308Reputation: 308
Quote:
Originally Posted by hitmen View Post

Either way I cant find where the .bash_profile file is.
Help!
Quote:
/home/USER/.bash_profile
Mine just looks for .bashrc

Code:
#
# ~/.bash_profile
#

[[ -f ~/.bashrc ]] && . ~/.bashrc
and my .bashrc

Code:
#
# ~/.bashrc
#

# If not running interactively, don't do anything
[[ $- != *i* ]] && return

alias ls='ls --color=auto'
PS1='[\u@\h \W]\$ '
 
Old 06-15-2011, 08:41 AM   #4
SL00b
Member
 
Registered: Feb 2011
Location: LA, US
Distribution: SLES
Posts: 375

Rep: Reputation: 112Reputation: 112
.bashrc and .bash_profile are hidden files, as indicated by the fact that the name starts with a period. To view hidden files, use the -a switch on the ls command.

And yes, the command "mkdir bin" will create a directory at /home/<userid>/bin, assuming you issued the command while your home directory was your working directory.
 
Old 06-15-2011, 07:32 PM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,362

Rep: Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377
Also, the conventional alias for 'ls -l is 'll'. You can see why Some distros actually set this up for you by default because its so often used/useful ...
 
Old 06-16-2011, 01:45 AM   #6
hitmen
Member
 
Registered: Jun 2011
Distribution: Kubuntu 10.04
Posts: 158

Original Poster
Rep: Reputation: Disabled
I am currently facing a few problems:

1)I can only find my .bashrc file and not the .bash_profile file

2) I can only see the .bashrc file through the console and not the graphical interface. Shell scripts dont appear in the GNOME.

3) I used nano to add alias='ls -l' but it doesnt work. In which part of the file am I supposed to put it?
 
Old 06-16-2011, 03:52 AM   #7
lugoteehalt
Senior Member
 
Registered: Sep 2003
Location: UK
Distribution: Debian
Posts: 1,215
Blog Entries: 2

Rep: Reputation: 49
Quote:
Originally Posted by hitmen View Post
I am currently facing a few problems:

1)I can only find my .bashrc file and not the .bash_profile file

2) I can only see the .bashrc file through the console and not the graphical interface. Shell scripts dont appear in the GNOME.

3) I used nano to add alias='ls -l' but it doesnt work. In which part of the file am I supposed to put it?
1) On my thing, in home directory:
Code:
ls -a .bash*
.bash_history  .bash_logout  .bashrc  .bashrcLugo
So I don't have .bash_profile iether. It was always a bit unclear what it was for. Using latest stable Debian. Suggest quite strongly you forget it. But you can create it youself with the command touch .bash_profile. .bashrcLugo is a file I created myself.

2) You can change the graphical thing to show hidden files: at a guess edit > preferences.

3) Should it be alias l='ls -l' ?? As said above this is unconventional. It does not matter where it is in the file, but it would be neater under the other aliases. You might try the vim editor or some editor of you choice: vim .bashrc then go to the block of aliases and see if you can just uncomment the ones you want, to make them work. That is remove the # in front of them.
 
Old 06-17-2011, 11:22 PM   #8
ozminh
Member
 
Registered: Aug 2007
Posts: 73

Rep: Reputation: 19
then create it yourself.
 
Old 06-20-2011, 01:57 PM   #9
athrin
Member
 
Registered: Mar 2011
Posts: 135

Rep: Reputation: 1
just use this to find file
Code:
locate <filename>
kind regards,
Athrin
 
Old 06-20-2011, 06:40 PM   #10
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,362

Rep: Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377
The main point is that you don't HAVE to have any of .bashrc, .bash_profile, but normally you would have both.

You can read up on them here
http://rute.2038bug.com/index.html.gz
http://tldp.org/LDP/Bash-Beginners-G...tml/index.html
http://www.tldp.org/LDP/abs/html/

Most versions of Linux also have a global eg /etc/profile that affects all users before their personal files are called.
 
  


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
[SOLVED] source ~/.bash_profile env :no such file or directory janakiramulu Linux From Scratch 15 02-06-2013 06:26 PM
Problem with the bash_profile [ unexpected end of the file ] shivamkalra Linux - Newbie 3 05-18-2011 02:14 PM
bash_profile file doesn't run in home directory spaceman spiff Slackware - Installation 3 01-13-2009 11:59 PM
Adding Java to my path in the .bash_profile file .... jmax24 Linux - General 5 04-20-2004 01:14 PM
.bash_profile and .bashrc file frustrations DeanB Linux - Newbie 5 09-15-2003 08:46 PM


All times are GMT -5. The time now is 04:08 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration