Files
mkdocs/docs/macos/terminal/terminal.md
2023-11-14 20:35:51 +01:00

124 lines
2.4 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Terminal
#### Ouvrir une page man dans un fenêtre spécifique:
```bash
$ open x-man-page://ls
# fonction:
function xmanpage() { open x-man-page://$@ ; }
```
#### Ouvrir une page man dans Aperçu:
```bash
$ man -t ls | open -f -a "Preview"
# fonction:
function preman() { man -t "$@" | open -f -a "Preview" ;}
```
#### Obtenir le chemin de la fenêtre courante du Finder:
```bash
$ osascript -e 'tell app "Finder" to get posix path of ((target of window 1) as alias)'
/Users/bruno/.kymsu/plugins.d/
```
```bash
# fonction:
# prints the path of the front Finder window. Desktop if no window open
function pwdf () {
osascript <<EOS
tell application "Finder"
if (count of Finder windows) is 0 then
set dir to (desktop as alias)
else
set dir to ((target of Finder window 1) as alias)
end if
return POSIX path of dir
end tell
EOS
}
# changes directory to frontmost Finder window
alias cdf='pwdf; cd "$(pwdf)"'
```
#### Erreur: 'zsh: operation not permitted'
```bash
zsh: operation not permitted: /Users/bruno/.local/bin/convert-videos-for-plex.sh
```
Le script est peut-être en quarantaine:
```bash
$ xattr -l /Users/bruno/.local/bin/convert-videos-for-plex.sh
com.apple.quarantine
```
Pour supprimer la quarantaine:
```bash
$ xattr -d com.apple.quarantine /Users/bruno/.local/bin/convert-videos-for-plex.sh
```
#### Erreur: '/usr/bin/env : mauvais interpréteur: Operation not permitted'
```bash
/usr/local/bin/kymsu2: /Users/bruno/.kymsu/plugins.d/00-kymsu.sh : /usr/bin/env : mauvais interpréteur: Operation not permitted
```
```bash
$ xattr -l 00-kymsu.sh
com.apple.TextEncoding: UTF-8;134217984
com.apple.lastuseddate#PS: J<><4A>b
com.apple.provenance:
com.apple.quarantine: 0086;62df747e;BBEdit;
```
Pour supprimer la quarantaine:
```bash
$ xattr -d com.apple.quarantine 00-kymsu.sh
$ xattr -l 00-kymsu.sh
com.apple.TextEncoding: UTF-8;134217984
com.apple.lastuseddate#PS: J<><4A>b
com.apple.provenance:
```
#### Raccourcis:
Aller en début de ligne: `CTRL+A`
Aller en fin de ligne: `CTRL+E`
Déplacer le curseur: `OPTION+clic`
Supprimer du curseur jusqu'à la fin de ligne: `CTRL+K`
Coller les texte supprimer: `CTRL+Y`
Supprimer le mot précédent: `CTRL+W`
Rechercher dans l'historique: `CTRL+R`
#### Date:
[How to format Date and Time in Linuxn macOS and Bash ?](https://www.shell-tips.com/linux/how-to-format-date-and-time-in-linux-macos-and-bash/)