Presentation is loading. Please wait.

Presentation is loading. Please wait.

Customizing Linux Environment Tutorial 4 ENGR 3950U / CSCI 3020U Operating Systems Instructor: Dr. Kamran Sartipi.

Similar presentations


Presentation on theme: "Customizing Linux Environment Tutorial 4 ENGR 3950U / CSCI 3020U Operating Systems Instructor: Dr. Kamran Sartipi."— Presentation transcript:

1 Customizing Linux Environment Tutorial 4 ENGR 3950U / CSCI 3020U Operating Systems Instructor: Dr. Kamran Sartipi

2 Customizing Shell  Making it more user-friendly  Adjusting it to your specific needs  There are jobs you repeat everyday  Complicated tasks  Commands you always forget

3 Important files  BASH  /etc/bashrc System wide functions and aliases  /etc/profiles System wide environment and start-up programs  ~/.bash_profile  ~/.bash_login  ~/.profile  ~/.bashrc

4 BASH Invocation Order  We have: login shell and interactive shell  Login shells: On login: if /etc/profile exists, source it. if ~/.bash_profile exists, source it, else if ~/.bash_login exists, source it, else if ~/.profile exists, source it. On exit: if ~/.bash_logout exists, source it.  Non-login interactive shells: On startup: if ~/.bashrc exists, source it.

5 Alias  Create an alias, aliases allow a string to be substituted for a word when it is used as the first word of a simple command.  SYNTAX: alias [-p] [name[=value]...] unalias [-a] [name... ]  If arguments are supplied, an alias is defined for each name whose value is given. If no value is given, `alias' will print the current value of the alias.

6 Alias Examples  alias nic 'nice +12 emacs -i -r -geometry 80x61+207+31 &‘  alias gh 'ghostview &‘  alias mca='mc -a‘  alias fnd 'find. -name "\!*" -print‘  alias which='alias | /usr/bin/which --tty- only --read-alias --show-dot --show-tilde‘  alias l.='ls -d.* --color=tty'  alias ll='ls -l --color=tty'  alias ls='ls --color=tty'

7 Export  Export Set an environment variable. Mark each name to be passed to child processes in the environment. Set an environment variable. Mark each name to be passed to child processes in the environment.  SYNTAX export [-fn] [-p] [name[=value]] export [-fn] [-p] [name[=value]]  OPTIONS -f The names refer to shell functions; -f The names refer to shell functions; otherwise the names refer to shell variables otherwise the names refer to shell variables -n No longer mark each name for export. -n No longer mark each name for export. -p Display output in a form that may be reused as input. -p Display output in a form that may be reused as input.  If no names are supplied, or if the `-p' option is given, a list of exported names is displayed.

8 Export Example If we want to modify PATH inside a shell script and have the effect preserved when we return to the shell PATH=$PATH:$HOME/bin export PATH

9 Umask  umask User's file creation mask. Set the shell process's file creation mask to mode.  SYNTAX umask [-p] [-S] [mode] OPTIONS  mode File creation mask  -S Print the mask in symbolic format  -p Output in a form that may be reused as input  The current value of the mask will be printed if mode is omitted,  If mode begins with a digit, it is interpreted as an octal number; if not, it is interpreted as a symbolic mode mask similar to that accepted by the chmod command.

10 Umask Examples  umask 02# Full group access, deny write to others.  umask 66# Deny read and write to group and others.  umask 77# Deny everything to everyone.  umask 26# Deny group write, deny read and write to others.

11 Command Prompt  Similar to Dos prompt it can be customized  Examples: set prompt="[$USER] “ set prompt="[$USER] “  In Bash the $PS1 is used as the environment variable for the prompt syntax

12 Miscellaneous if ( -r ${HOME}/.aliases ) source ${HOME}/.aliases Sourcing.aliases file if it exists.


Download ppt "Customizing Linux Environment Tutorial 4 ENGR 3950U / CSCI 3020U Operating Systems Instructor: Dr. Kamran Sartipi."

Similar presentations


Ads by Google