LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
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 03-26-2012, 09:23 PM   #1
Micky12345
Member
 
Registered: Feb 2012
Posts: 58

Rep: Reputation: Disabled
.login file


My terminal want to display username, time and date whenever logged into the terminal.
For that i made a script which displays username and date
My script is as follows
Code:
who am i | cut -d " " -f1
date
This sript name is userdate
I want to run this script whenevr i log in
So i want to put 'userdate' into .login file

But how can i do that
Where can i find .login file
 
Old 03-26-2012, 09:27 PM   #2
whansard
Senior Member
 
Registered: Dec 2002
Location: Mosquitoville
Distribution: RH 6.2, Gen2, Knoppix,arch, bodhi, studio, suse, mint
Posts: 3,185

Rep: Reputation: 52
look in your home directory.
 
Old 03-26-2012, 11:38 PM   #3
divyashree
Senior Member
 
Registered: Apr 2007
Location: bbsr,orissa,India
Distribution: RHEL5 ,RHEL4,CENT OS5,FEDORA,UBUNTU
Posts: 1,362

Rep: Reputation: 135Reputation: 135
Quote:
Originally Posted by Micky12345 View Post
My terminal want to display username, time and date whenever logged into the terminal.
For that i made a script which displays username and date
My script is as follows
Code:
who am i | cut -d " " -f1
date
This sript name is userdate
I want to run this script whenevr i log in
So i want to put 'userdate' into .login file

But how can i do that
Where can i find .login file

run ls -la in you r home dir , it may be there.
if not there create a file on that name and and put the script in that file, make it executable and make an entry in profile/rc file in your home dir to execute .login.
 
Old 03-26-2012, 11:46 PM   #4
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
In case you are using bash ...

Bash does not use a .login file. It uses the first (if any) of ~/.bash_profile, ~/.bash_login and ~/.profile
 
Old 03-27-2012, 03:45 AM   #5
Micky12345
Member
 
Registered: Feb 2012
Posts: 58

Original Poster
Rep: Reputation: Disabled
I got login file inside bin
i copied my file into login


but then also when i am logging in i didnt get the desired output
 
Old 03-27-2012, 05:34 AM   #6
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
Changing files in /bin (or /usr/bin, /sbin and /usr/sbin) can break your system. Even if it works, such can be lost on routine system upgrade.

It is not necessary to change /bin/login to achieve what you want. Earlier replies in this thread have suggested appropriate ways.
 
Old 03-27-2012, 08:33 PM   #7
Micky12345
Member
 
Registered: Feb 2012
Posts: 58

Original Poster
Rep: Reputation: Disabled
make an entry in profile/rc file in your home dir to execute .login.


HOW ITS POSSIBLE?
 
Old 03-27-2012, 09:02 PM   #8
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,258

Rep: Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947
What shell are you running (sh, bash, tcsh, etc.)?
 
Old 03-28-2012, 03:27 AM   #9
divyashree
Senior Member
 
Registered: Apr 2007
Location: bbsr,orissa,India
Distribution: RHEL5 ,RHEL4,CENT OS5,FEDORA,UBUNTU
Posts: 1,362

Rep: Reputation: 135Reputation: 135
Quote:
Originally Posted by Micky12345 View Post
make an entry in profile/rc file in your home dir to execute .login.


HOW ITS POSSIBLE?
Dear Micky, what shell do you use ?

Run this to get:

Quote:
echo $SHELL
If BASH then the files are : ~/.bashrc and ~/.bash-profile
If ksh the the files are : ~/.profile and ~/.kshrc or ~/.login file may be there.
if csh the files are : ~/.cshrc

You can add an entry like this:

Code:
. ~/.login
in the profile/rc file in your home dir if you dont have .login.

where .login contains the script you want to excute.

When you login the these rc/profile file executes whatever written in them.

Last edited by divyashree; 03-28-2012 at 05:56 AM.
 
  


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
Batch file to login to putty nirmal.mukundan Linux - General 1 02-02-2011 09:50 AM
Looking for .login file on Fedora stefaandk Red Hat 2 06-03-2005 10:52 AM
smb login and get file mnauta Linux - Networking 2 03-09-2005 11:35 PM
.login file tuananhbirm Linux - General 2 01-24-2005 08:20 PM
can anyone tell me how can i edit the .login file mithinjagani Linux - Newbie 1 01-28-2004 09:11 AM


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