-
Notifications
You must be signed in to change notification settings - Fork 47
Terminal issue completed #59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ricky129
wants to merge
8
commits into
cartabinaria:main
Choose a base branch
from
ricky129:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
6bf2613
add: inpiù
ricky129 ebdf7a2
add: print_cheatshit
Pitots 66e748b
add: cheatsheets corso di Terminale
ricky129 13b6a34
fixed file name in print_cheatshit
Pitots 7462fb0
Merge remote-tracking branch 'refs/remotes/origin/main'
Pitots 2d010c8
add: readme && mv: print_cheatshit
Pitots df73267
rm: print_cheatshit
Pitots 2b35f51
edit: aggiunti i percorsi base ai comandi dei cheatsheets
ricky129 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,138 @@ | ||
| ### Elenca i file | ||
|
|
||
| ```sh | ||
| ls | ||
| ``` | ||
|
|
||
| ### Entrare in una cartella | ||
|
|
||
| ```sh | ||
| cd | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. manca il path dove entrate |
||
| ``` | ||
|
|
||
| ### Uscire da una cartella | ||
|
|
||
| ```sh | ||
| cd .. | ||
| ``` | ||
|
|
||
| ### Creare una cartella | ||
|
|
||
| ```sh | ||
| mkdir | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. manca il nome della cartella |
||
| ``` | ||
|
|
||
| ### Creare file | ||
|
|
||
| ```sh | ||
| touch | ||
| ``` | ||
|
|
||
| ### Controllare di che tipo è un file | ||
|
|
||
| ```sh | ||
| file | ||
| ``` | ||
|
|
||
| ### Copiare file | ||
|
|
||
| ```sh | ||
| cp | ||
| ``` | ||
|
|
||
| ### Spostare file | ||
|
|
||
| ```sh | ||
| mv | ||
| ``` | ||
|
|
||
| ### Rinominare file | ||
|
|
||
| ```sh | ||
| mv | ||
| ``` | ||
|
|
||
| ### Eliminare file | ||
|
|
||
| ```sh | ||
| rm | ||
| ``` | ||
|
|
||
| ### Copiare una cartella | ||
|
|
||
| ```sh | ||
| cp -r | ||
| ``` | ||
|
|
||
| ### Manuale di un comando | ||
|
|
||
| ```sh | ||
| man | ||
| ``` | ||
|
|
||
| ### Leggere un file di testo | ||
|
|
||
| ```sh | ||
| less | ||
| ``` | ||
|
|
||
| ### Nano e Vim | ||
|
|
||
| ```sh | ||
| nano | ||
| vim | ||
| ``` | ||
|
|
||
| ### Contare caratteri | ||
|
|
||
| ```sh | ||
| wc | ||
| ``` | ||
|
|
||
| ### Ricerca di una stringa | ||
|
|
||
| ```sh | ||
| grep | ||
| ``` | ||
|
|
||
| ### Concatenazione o lettura | ||
|
|
||
| ```sh | ||
| cat | ||
| ``` | ||
|
|
||
| ### Testa e coda | ||
|
|
||
| ```sh | ||
| head | ||
| tail | ||
| ``` | ||
|
|
||
| ### Wildcard | ||
|
|
||
| ```sh | ||
| cp _ /scripts | ||
| ls -d ca** | ||
| cat _ | ||
| cat * | ||
| ``` | ||
|
|
||
| ### Cambiare owner e group | ||
|
|
||
| ```sh | ||
| chmod | ||
| chown | ||
| chgrp | ||
| ``` | ||
|
|
||
| ### Pipe | ||
|
|
||
| ```sh | ||
| ls /bin | less | ||
| ``` | ||
|
|
||
| ### Ridezione su file | ||
|
|
||
| ```sh | ||
| comando > file | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| ### Slide della scorsa volta | ||
|
|
||
| [main.pdf](https://risorse.vercel.app/lab/2025/terminale-1/main.pdf) | ||
|
|
||
| # STDIO e ridirezioni | ||
|
|
||
| ## Output | ||
|
|
||
| Normale output di un comando, può essere visto come un file e usato su pipe e ridirezione. > distruttiva, >> appende in fondo al file. | ||
|
|
||
| ```bash | ||
| ls > file1 > file2 | ||
| ``` | ||
|
|
||
| ## Error | ||
|
|
||
| ```bash | ||
| ls ifnrigor > mangusta | ||
| ``` | ||
|
|
||
| Il file mangusta viene creato (l’esecuzione non si ferma all’errore) ma mangusta non conterrà l’errore del comando perché non è `stdout`. | ||
|
|
||
| ```bash | ||
| ls ifnrigor > mangusta 2>&1 | ||
| ``` | ||
|
|
||
| Ridirezionare lo `stderr` sullo stdout: `2>&1` . Non mostra messaggio di errore e ora mangusta contiene l’errore di ls. | ||
|
|
||
| ```bash | ||
| ls ifnrigor > mangusta 2>1 | ||
| ``` | ||
|
|
||
| Crea un file di nome 1 e mangusta è vuoto. Ha preso `2>1` come: prendi lo `stderr` e mettilo nel file 1. | ||
|
|
||
| ```bash | ||
| ls ifnrigor > mangusta 2>/dev/null | ||
| ``` | ||
|
|
||
| Butta tutti gli errori dentro /dev/null e non saranno più recuperabili. | ||
|
|
||
| ## Echo | ||
|
|
||
| ```bash | ||
| echo */lontra | ||
| ``` | ||
|
|
||
| Stampa tutti i percorsi relativi delle sottocartelle (o cartelle) chiamate lontra. | ||
|
|
||
| ```bash | ||
| echo {1..1} | ||
| echo {a..z} | ||
| ``` | ||
|
|
||
| Stampa tutti i numeri e caratteri in mezzo ai valori definiti. | ||
|
|
||
| ```bash | ||
| file $(ls -d /bin/* | grep zip) | ||
| ``` | ||
|
|
||
| Permette di stampare tutti i file che hanno dentro zip e sono locati dentro `/bin/*`. Questa sintassi è necessaria per rispettare la sintassi di `file` . | ||
|
|
||
| # Variabili | ||
|
|
||
| ```bash | ||
| $ set src castoro | ||
| $ set dest capybara | ||
| $ echo $dest | ||
| capybara | ||
| $ echo $src | ||
| castoro | ||
| $ cp -r $src $dest | ||
| $ ls | ||
| 1 capybara castoro file1 file2 mangusta | ||
| ``` | ||
|
|
||
| set copia le cartelle nelle variabili locali, e cp copia le cartelle ricorsivamente l’una dentro l’altra. | ||
|
|
||
| ```bash | ||
| bash -c [comando] | ||
| ``` | ||
|
|
||
| Lancia un comando in una nuova shell. | ||
|
|
||
| Le variabili custom vengono eliminate al riavvio del computer. | ||
|
|
||
| # Shell scripting | ||
|
|
||
| Per specificare che interprete usare: | ||
|
|
||
| ```bash | ||
| #!/bin/bash | ||
| ``` | ||
|
|
||
| Specifica l’interprete da usare nella prima riga del file. Dice al terminale che stiamo creando un file di scripting. Non è necessario chiamare i file di scripting \*.sh e definire le variabili maiuscole. | ||
|
|
||
| ```bash | ||
| #!/bin/bash | ||
| echo "Reading programs" | ||
| PROG=$(ls -d /bin/*) | ||
| NUM=$(echo "$PROG" | grep "ca" | wc -l) | ||
| ``` | ||
|
|
||
| `NUM=$(echo "$PROG" | grep "ca" | wc -l)` stampa il contenuto di $NUM, che conterrà il numero di programmi che iniziano con ca. La variabile $NUM rimane locale all’esecuzione dello script, non posso neanche usare export perché viene trasposta ai processi figli di quel nuovo terminale creato all’inizio dello script. | ||
|
|
||
| `chmod +100` permesso di esecuzione a user e 0 agli altri. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In tutti i comandi del primo cheatsheet mancano i path o i nomi dei file