Files
mkdocs/docs/macos/terminal/terminal.md
2022-03-04 17:56:50 +01:00

97 lines
1.8 KiB
Markdown

# 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
```
#### 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/)