Skip to content
Snippets Groups Projects

Resolve "There is nothing about ZSH"

Merged Norman Koch requested to merge issue-217 into preview
Compare and Show latest version
1 file
+ 30
22
Compare changes
  • Side-by-side
  • Inline
# ZSH
# ZSH
The ZSH, short for `z-shell`, is an alternative shell for Linux that offers many convienence features
!!! warning
 
Though all efforts have been made to ensure the accuracy and
 
currency of the content on this website, please be advised that
 
some content might be out of date and there is no continuous
 
website support available. In case of any ambiguity or doubts,
 
users are advised to do their own research on the content's
 
accuracy and currency.
 
 
The ZSH, short for `z-shell`, is an alternative shell for Linux that offers many convenience features
for productive use that `bash`, the default shell, does not offer.
for productive use that `bash`, the default shell, does not offer.
This should be a short introduction to `zsh` and offer some examples that are especially useful on Taurus.
This should be a short introduction to `zsh` and offer some examples that are especially useful on Taurus.
@@ -46,7 +54,7 @@ plugins+=(
@@ -46,7 +54,7 @@ plugins+=(
### Typo-correction
### Typo-correction
With
With
```bash
```bash
setopt correct_all
setopt correct_all
@@ -96,7 +104,7 @@ mcd () {
@@ -96,7 +104,7 @@ mcd () {
You can then
You can then
```
```
marie@login$ mcd non-existant-directory
marie@login$ mcd non-existent-directory
```
```
and it will create it and `cd` into it
and it will create it and `cd` into it
@@ -105,20 +113,20 @@ and it will create it and `cd` into it
@@ -105,20 +113,20 @@ and it will create it and `cd` into it
```bash
```bash
function treesizethis {
function treesizethis {
du -k --max-depth=1 | sort -nr | awk '
du -k --max-depth=1 | sort -nr | awk '
BEGIN {
BEGIN {
split("KB,MB,GB,TB", Units, ",");
split("KB,MB,GB,TB", Units, ",");
}
}
{
{
u = 1;
u = 1;
while ($1 >= 1024) {
while ($1 >= 1024) {
$1 = $1 / 1024;
$1 = $1 / 1024;
u += 1
u += 1
}
}
$1 = sprintf("%.1f %s", $1, Units[u]);
$1 = sprintf("%.1f %s", $1, Units[u]);
print $0;
print $0;
}
}
'
'
}
}
```
```
@@ -126,7 +134,7 @@ This lists all files, from largest to smallest, in the current directory.
@@ -126,7 +134,7 @@ This lists all files, from largest to smallest, in the current directory.
### Automatically rewrite `..` as `../..`
### Automatically rewrite `..` as `../..`
This will automatically replace `...` with `../..` and `....` with `../../..` and so on (each additional `.`
This will automatically replace `...` with `../..` and `....` with `../../..` and so on (each additional `.`
adding another `/..`) when typing commands:
adding another `/..`) when typing commands:
``` bash
``` bash
@@ -149,8 +157,8 @@ This allows auto-completion for `module load`:
@@ -149,8 +157,8 @@ This allows auto-completion for `module load`:
function _module {
function _module {
MODULE_COMMANDS=(
MODULE_COMMANDS=(
'-t:Show computer parsable output'
'-t:Show computer parsable output'
'load:Lload a Module'
'load:Load a module'
'unload:Unload a Module'
'unload:Unload a module'
'spider:Search for a module'
'spider:Search for a module'
'avail:Show available modules'
'avail:Show available modules'
'list:List loaded modules'
'list:List loaded modules'
@@ -167,13 +175,13 @@ compdef _module "module"
@@ -167,13 +175,13 @@ compdef _module "module"
### Slurm-specific shortcuts
### Slurm-specific shortcuts
#### Show slurm log path
#### Show Slurm log path
This allows you to run `slurmlogpath $SLURM_ID` and get the log-path directly in stdout:
This allows you to run `slurmlogpath $SLURM_ID` and get the log-path directly in stdout:
```bash
```bash
function slurmlogpath {
function slurmlogpath {
scontrol show job $1 | grep StdOut | sed -e 's/^\s*StdOut=//'
scontrol show job $1 | grep StdOut | sed -e 's/^\s*StdOut=//'
}
}
```
```
Loading