profile a startup script


profile file is placed in home directory of a user. It gets executed after login. User can place commands which are executed after login. This is useful when you have to setup something after login like alias for some command or whatever command which you want to execute after login.

Note that depending distribution which you are using file name will change.

Typical file will look like.

$ cat .profile
# ~/.profile: executed by the command interpreter for login shells.

# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.

# the default umask is set in /etc/profile; for setting the umask

# for ssh logins, install and configure the libpam-umask package.
#umask 022

# if running bash
if [ -n “$BASH_VERSION” ]; then
# include .bashrc if it exists
if [ -f “$HOME/.bashrc” ]; then

. “$HOME/.bashrc”

# set PATH so it includes user’s private bin if it exists
if [ -d “$HOME/bin” ] ; then

Let us add fortune to profile

$ echo “fortune | xargs cowthink” >> .profile

Now, when you login commands in profile will get executed.

profile file is hidden that why it starts dot.

Note that this doesn’t work with psudo terminal. You need command line interface for this. On Ubuntu, you can use ctrl + Alt + F1 to F6 to get CLI. With F7 you can go back to GUI.


Post a Comment

You must be logged in to post a comment.
%d bloggers like this: