17 Matching Annotations
- Feb 2024
-
-
- Jun 2023
-
wet-boew.github.io wet-boew.github.io
-
Setting the proxy for other tasks
export HTTPS_PROXY=http://USERNAME:PASSWORD@PROXY_ADDRESS:PROXY_PORT
Tags
Annotators
URL
-
- Jan 2023
-
unix.stackexchange.com unix.stackexchange.com
-
This feature can be tuned with ZLE_REMOVE_SUFFIX_CHARS and ZLE_SPACE_SUFFIX_CHARS shell parameters.
研究下
-
- Dec 2022
-
www.zhihu.com www.zhihu.com
-
为什么说 zsh 是 shell 中的极品?
-
- Feb 2021
-
unix.stackexchange.com unix.stackexchange.com
-
Here, you could use zsh instead of sh which doesn't have either of those annoying "features" (at least in current versions).
-
- Jan 2021
-
scriptingosx.com scriptingosx.com
Tags
Annotators
URL
-
- Oct 2020
-
unix.stackexchange.com unix.stackexchange.com
-
(../)#.git(:h) # relative path to containing directory, eg. '../../..', '.' (../)#.git(:a) # absolute path to actual file, eg. '/home/you/src/prj1/.git' (../)#.git(:a:h) # absolute path to containing directory, eg. '/home/you/src/prj1'
-
- Apr 2020
-
dev.to dev.to
-
From Bash to Zsh
-
-
apple.stackexchange.com apple.stackexchange.com
-
zsh will be the default login shell for new accounts, and even then, you can select bash instead
-
-
stackabuse.com stackabuse.com
-
-
www.cyberciti.biz www.cyberciti.biz
-
Apple replaced Bourne Again SHell with Z shell for licensing reasons
-
- May 2015
-
www.tuxradar.com www.tuxradar.com
-
Every shell has some startup files that it consults for its configuration. Zsh has system-wide startup items in /etc/ (or, in distributions such as Ubuntu, in /etc/zsh/) and user-specific startup files (in the home directory). When Zsh starts up, it reads the following things in this order: /etc/zshenv and ~/.zshenv If the shell is a login shell: /etc/zprofile and ~/.zprofile If it’s an interactive shell: /etc/zshrc and ~/.zshrc If the shell is a login shell: /etc/zlogin and ~/.zlogin And when a user logs out from a login shell, Zsh reads /etc/zlogout and ~/.zlogout. To work out which commands you have to write in which startup files, it's important to know the different types of shells. A login shell is one that's spawned when you log in - for example, via SSH or on a virtual terminal. An interactive shell displays a prompt to the user where you can type commands - for instance, when you open a terminal window in Ubuntu. However, if you run ssh host somecommand, then this is a login shell, but is in fact a non-interactive one.
-
Every shell has some startup files that it consults for its configuration. Zsh has system-wide startup items in /etc/ (or, in distributions such as Ubuntu, in /etc/zsh/) and user-specific startup files (in the home directory). When Zsh starts up, it reads the following things in this order: /etc/zshenv and ~/.zshenv If the shell is a login shell: /etc/zprofile and ~/.zprofile If it’s an interactive shell: /etc/zshrc and ~/.zshrc If the shell is a login shell: /etc/zlogin and ~/.zlogin And when a user logs out from a login shell, Zsh reads /etc/zlogout and ~/.zlogout. To work out which commands you have to write in which startup files, it's important to know the different types of shells. A login shell is one that's spawned when you log in - for example, via SSH or on a virtual terminal. An interactive shell displays a prompt to the user where you can type commands - for instance, when you open a terminal window in Ubuntu. However, if you run ssh host somecommand, then this is a login shell, but is in fact a non-interactive one.
-
There's also a function periodic() that is executed every PERIOD seconds if the latter variable is set.
Periodic commands in ZSH
-
Zsh also makes it possible to run particular code automatically on certain occasions. You just have to define some special functions. The two most frequently used are chpwd and precmd. Zsh calls the former each time the current directory changes. The latter is called just before Zsh shows you a new prompt. Both functions are regularly used to show the current directory in the title bar of your terminal emulator. If you use programs other than the shell, which alter the title of your terminal emulator (Vim is one example), you should use precmd - it restores the title after another command has run. So this is how we show the current directory in the title bar (adapted from the manual page):
Run commands
-
precmd() { [[ -t 1 ]] || return case $TERM in (sun-cmd) print -Pn "\e]l%~\e\\" ;; (*xterm*|rxvt|(dt|k|E)term) print -Pn "\e]2;%~\a" ;; esac }
Execute a command before prompt is displayed.
-
REPORTTIME=5 TIMEFMT="%U user %S system %P cpu %*Es total"
Report times of long running shell commands
Tags
Annotators
URL
-