[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
howtos:cli_manual:shells [2012/10/09 18:53 (UTC)] – [Configuring a Shell Prompt] sycamorex | howtos:cli_manual:shells [2012/10/28 21:39 (UTC)] (current) – [~/.bashrc] sycamorex | ||
---|---|---|---|
Line 174: | Line 174: | ||
export MY_EXPORTED_VAR=" | export MY_EXPORTED_VAR=" | ||
- | By exporting a variable you make it accessible to any sub-shells created in the current shell. In other words, if you want a script to be aware of a variable, you need to export it. | + | By exporting a variable you make it accessible to any sub-shells created in the current shell. In other words, if you want a script to be aware of a variable, you need to export it. If you want to see all the exported variables in the current shell, type: |
+ | < | ||
Line 415: | Line 416: | ||
bash: qp: command not found</ | bash: qp: command not found</ | ||
- | If you run a (long) command on a regular basis, it might be convenient to create an alias for it. To view all the currently set aliases, just type '' | + | If you run a (long) command on a regular basis, it might be convenient to create an alias for it. |
Have a look at some more examples of aliases below. This may help you create your own aliases. | Have a look at some more examples of aliases below. This may help you create your own aliases. | ||
Line 449: | Line 450: | ||
</ | </ | ||
+ | === Aliases and Security === | ||
+ | Sometimes aliases may pose a security risk in a sense that they can spoof other commands (eg. on compromised systems). Consider the following: | ||
+ | < | ||
+ | |||
+ | To view currently set aliases, just type '' | ||
+ | |||
+ | < | ||
+ | |||
+ | Escaping the command with \ prevents any alias expansion in case someone had tried to spoof the '' | ||
+ | |||
+ | < | ||
+ | /home/user | ||
+ | user@darkstar: | ||
+ | user@darkstar: | ||
+ | 666 | ||
+ | user@darkstar: | ||
+ | / | ||
=====Creating functions===== | =====Creating functions===== | ||
+ | |||
+ | FIXME | ||
=====~/ | =====~/ | ||
+ | |||
+ | At the moment our '' | ||
+ | |||
+ | < | ||
+ | # load the system-wide environment | ||
+ | source / | ||
+ | |||
+ | # Add a directory with your scripts to the path. | ||
+ | PATH=$PATH: | ||
+ | |||
+ | # Configure the CDPATH variable to include a frequently visited directories | ||
+ | CDPATH=$CDPATH: | ||
+ | |||
+ | # Set the default editor | ||
+ | export VISUAL=vim | ||
+ | export EDITOR=vim | ||
+ | |||
+ | # Defining foreground variables for the prompt | ||
+ | P_BLACK=" | ||
+ | P_RED=" | ||
+ | P_GREEN=" | ||
+ | P_YELLOW=" | ||
+ | P_BLUE=" | ||
+ | P_MAGENTA=" | ||
+ | P_CYAN=" | ||
+ | P_WHITE=" | ||
+ | P_RESET=" | ||
+ | |||
+ | # Setting a fancy prompt for the current user | ||
+ | export PS1=" | ||
+ | |||
+ | # Setting aliases | ||
+ | alias e=' | ||
+ | alias ll='ls -l' | ||
+ | alias lla=' | ||
+ | alias mkdir=' | ||
+ | alias rm='rm -i' | ||
+ | alias 1.='cd .. ; pwd' | ||
+ | alias 2.='cd ../.. ; pwd' | ||
+ | alias 3.='cd ../../.. ; pwd' | ||
+ | alias 4.='cd ../../../.. ; pwd' | ||
+ | alias h=' | ||
+ | alias eq=' | ||
+ | |||
+ | alias emc=' | ||
+ | alias org=' | ||
+ | alias ci3=' | ||
+ | |||
+ | alias psp=' | ||
+ | alias wic=' | ||
+ | |||
+ | alias dl='cd / | ||
+ | alias mftp=' | ||
+ | alias mylaptop=' | ||
+ | alias myserver=' | ||
+ | |||
+ | alias t=' | ||
+ | alias r2j=' | ||
+ | |||
+ | ####################################################################### | ||
+ | # | ||
+ | ####################################################################### | ||
+ | |||
+ | # Specify an NNTP Server | ||
+ | export NNTPSERVER=' | ||
+ | |||
+ | # To take advantage of multicore CPUs you can use the MAKEFLAGS variable. | ||
+ | # For example the equivalent of "make -j2" would be: | ||
+ | # export MAKEFLAGS=" | ||
+ | # Uncomment the above line to use it. | ||
+ | |||
+ | </ | ||
+ | |||
=====Other configuration files===== | =====Other configuration files===== | ||