GNU/Linux >> Linux Esercitazione >  >> Debian

Corso GRATUITO di Ubuntu di 4 ore per principianti

Si tratta di un corso di formazione su Linux Ubuntu di 4 ore in totale pubblicato sul nostro canale YouTube sotto il nome di Corso GRATUITO di Ubuntu di 4 ore per principianti.

1. Cos'è Linux?

Linux è un noto sistema operativo. Nel 1991, Linux è stato creato da uno studente universitario di nome Linux Torvalds. Tutta l'architettura del software è coperta da Linux, poiché aiuta a comunicare tra il programma del computer e l'hardware del sistema e gestisce anche le richieste tra di loro. Linux è un software open source. È distinguibile da altri sistemi operativi in ​​molti modi. Le persone con competenze professionali legate alla programmazione possono anche modificare il proprio codice, poiché è disponibile gratuitamente per tutti. Torvalds intendeva chiamare la sua creazione "freak ,' ma l'amministratore distribuiva il codice in base al nome del suo creatore e Unix, quindi quel nome è rimasto.

2. Distribuzione Linux

La distribuzione Linux è un tipo di sistema operativo che comprende un intero sistema di gestione dei pacchetti con un kernel Linux. La distribuzione Linux è facilmente accessibile scaricando qualsiasi distribuzione Linux.

Un esempio particolare di distribuzione Linux include un kernel, diverse librerie, strumenti GNU, un ambiente desktop completo e della documentazione software aggiuntiva. L'esempio di McDonald è il migliore per comprendere il concetto di distribuzione Linux. McDonald's ha più franchising nel mondo, ma i servizi e la qualità sono gli stessi. Allo stesso modo, puoi scaricare il sistema operativo di Linux da altre distribuzioni da Red Hat, Debian, Ubuntu o da Slackware dove più o tutti i comandi nel terminale sarebbero gli stessi. L'esempio di McDonald's si adatta qui. Puoi dire che ogni franchising di McDonald's è come una distribuzione. Quindi, gli esempi di distribuzioni Linux sono Red Hat, Slackware, Debian e Ubuntu, ecc.

3. Guida all'installazione

Questo argomento ti fornirà un modo completo attraverso il quale puoi installare Ubuntu sul tuo sistema. Segui i passaggi indicati di seguito per un'installazione senza problemi di Ubuntu:

Passaggio 1 :apri il tuo browser preferito, quindi vai su https://ubuntu.com/ e fai clic su Download Sezione.

Passaggio 2 :Dal Download Sezione, devi scaricare Ubuntu Desktop LTS .



Passaggio 3 :Fare clic per scaricare il file Ubuntu Desktop; dopo aver fatto clic su questo, ti verrà inviato un messaggio di ringraziamento che afferma Grazie per aver scaricato Ubuntu Desktop .



Passaggio 4 :Poiché sei in Windows, devi rendere avviabile la tua USB perché il trasferimento diretto di questo sistema operativo scaricato nella tua USN non lo renderà avviabile.

Passaggio 5 :puoi utilizzare Power ISO strumento per questo scopo. Basta fare clic su questo collegamento per scaricare lo strumento Power ISO https://www.poyouriso.com/download.php



Passaggio 6 :Usa Power ISO per trasferire il sistema operativo Ubuntu nell'USB. Lo farà mentre renderà avviabile l'USB.

Passaggio 7 :riavvia il sistema e vai al menu di avvio del sistema premendo F11 o F12 e da lì configura il tuo sistema operativo.

Passaggio 8 :salva le impostazioni e quindi riavvia nuovamente il sistema per dare il benvenuto a Ubuntu sul tuo sistema.

4. Riga di comando e terminale

La prima domanda che ti viene in mente è:perché imparare la riga di comando? Il fatto è che non puoi fare tutto con la GUI; le cose che non puoi gestire con la GUI vengono eseguite senza problemi utilizzando la riga di comando. In secondo luogo, puoi farlo più velocemente usando la riga di comando rispetto alla GUI.

Successivamente, discuterai di due cose:Shell e Terminal. Il sistema comunica con il sistema operativo tramite la shell. Qualunque sia il comando che scriverai, la shell lo eseguirà, comunicherà con il sistema operativo e darà un comando al sistema operativo per fare qualcosa che gli hai chiesto di fare. Quindi ti fornirà i risultati. Il terminale è la finestra che prenderà quel comando e visualizzerà i risultati su se stessa. È uno strumento che ti aiuta a interagire con la shell e la shell ti aiuta a interagire con il sistema operativo.

Tutti i comandi sono gli stessi per diversi sistemi basati su Linux. Se vuoi aprire il terminale, puoi cercare "terminale ' manualmente utilizzando la barra di ricerca.



Esiste un modo alternativo per aprire il terminale premendo 'CTRL+ALT+T '.

5. Il file system Linux

Linux ha una struttura di file basata sulla gerarchia. Esiste in modo simile ad un albero e tutti i file e le altre directory sono coinvolti in questa struttura. In Windows, hai "Cartelle". Mentre Linux ha "root ' come directory di base e in questa directory risiedono tutti i file e le cartelle. Puoi vedere la tua cartella principale nel tuo sistema aprendo il file system, come mostrato di seguito. Ha tutti i file e le cartelle sotto di esso. La cartella principale è la cartella principale; quindi ci sono sottocartelle come bin, boot, dev, ecc. Se fai clic su una di queste cartelle, ti mostreranno diverse directory che risiedono in essa, dimostrando che Linux ha una struttura gerarchica.

6. Pochi esempi di comandi

In questo argomento verranno illustrati alcuni comandi di esempio di Linux che possono aiutare a capirlo.

Premi CTRL+ALT+T per aprire il terminale.



Il primo comando riguarda il sistema di directory di file Linux. Linux ha un sistema ad albero e, ad esempio, se vuoi saltare nella cartella che si trova in fondo da qualche parte, devi passare attraverso ogni cartella collegata al suo genitore. Il primo comando è "comando pwd '. pwd sta per la directory di lavoro attuale . Digita "pwd" nel tuo terminale e ti farà conoscere la directory corrente/presente in cui stai lavorando. I risultati ti condurranno alla directory principale o home.

$ p.v



Il prossimo comando da discutere è 'comando cd '. cd sta per 'cambia directory '. Questo comando viene utilizzato per modificare la directory di lavoro attuale. Supponiamo che tu voglia passare dalla directory corrente a Desktop. Per questo, digita il comando fornito di seguito nel tuo terminale.

$ cd Desktop



Per tornare alla directory da cui sei arrivato, scrivi 'cd ..' e premi invio.

Il prossimo comando che studierai è "ls command". Poiché sei attualmente nella tua directory principale, digita "ls" nel tuo terminale per ottenere un elenco di tutte le cartelle che risiedono all'interno della directory principale.

$ l

7. Hard link e Soft link

Prima di tutto, discutiamo quali sono i collegamenti? I collegamenti sono un modo semplice ma utile per creare un collegamento a qualsiasi directory originale. I collegamenti possono essere utilizzati in molti modi per scopi diversi, ad esempio per collegare librerie, per creare un percorso appropriato a una directory e per garantire che i file siano presenti in posizioni costanti o meno. Questi collegamenti vengono utilizzati per conservare più copie di un singolo file in posizioni diverse. Quindi questi sono i quattro possibili usi. In questi casi, i link sono in un certo senso scorciatoie, ma non esattamente.

Abbiamo molto di più da imparare sui collegamenti piuttosto che semplicemente creare un collegamento a un'altra posizione. Questo collegamento creato funziona come un puntatore verso la posizione del file originale. Nel caso di Windows, quando crei un collegamento per qualsiasi cartella e lo apri. Si riferisce automaticamente alla posizione in cui è stato creato. Esistono due tipi di link:link soft e hard link. Gli hard link vengono utilizzati per collegare i file, non le directory. Non è possibile fare riferimento a file diversi dal disco di lavoro corrente. Si riferisce agli stessi inode della sorgente. Questi collegamenti sono utili anche dopo la cancellazione del file originale. I collegamenti software, noti anche come collegamenti simbolici, vengono utilizzati per fare riferimento a un file che può trovarsi sullo stesso disco o su un disco diverso e per collegare le directory. Dopo l'eliminazione del file originale, esiste un collegamento software come collegamento utilizzabile non funzionante.

Ora creiamo un collegamento reale. Ad esempio, crei un file di testo all'interno della cartella Documenti.



Scrivi del contenuto in questo file e salvalo come 'fileWrite' e apri il terminale da questa posizione.

Digita il comando 'ls' nel terminale per visualizzare i file e le cartelle correnti nella directory di lavoro.

$ l

Questo è linuxhint.com



$ l



In questo comando 'ln', devi specificare il nome del file per il quale creerai un collegamento reale, quindi scrivere il nome che verrà assegnato al file del collegamento reale.

$ ln fileScrivi hardlink

Quindi di nuovo, usa il comando 'la' per verificare l'esistenza del collegamento fisico. Puoi aprire questo file per verificare se ha il contenuto del file originale o meno.

$ la





Quindi, creerai un collegamento software per una directory, diciamo per Documents. Apri il terminale dalla home directory ed esegui il seguente comando usando il terminale

$ ln -s Collegamento a documenti

Quindi di nuovo, usa il comando 'ls' per verificare se il collegamento software è stato creato o meno. Per la sua conferma, apri il file e controlla il contenuto del file.

$ l





8. Elenco file 'ls'

In questo argomento imparerai a elencare i file usando il comando 'ls'. Usando il 'comando pwd ' per prima cosa, controlla la tua directory di lavoro attuale o corrente. Ora, se vuoi sapere cosa c'è all'interno di questa directory, digita semplicemente "ls" per visualizzare un elenco di file al suo interno.

$ pwd $ ls



Ora, se vuoi controllare cosa c'è all'interno della cartella Documenti, usa semplicemente il comando cd per avere accesso a questa directory e poi digita 'ls' nel terminale.

$ cd Desktop
$ ls



Esistono altri metodi per visualizzare l'elenco dei file e questo metodo fornisce anche alcune informazioni sui file. Per questo, quello che devi fare è digitare 'ls -l' nel terminale e ti mostrerà un formato lungo dei file contenente la data e l'ora di creazione del file, i permessi del file con il nome del file e la dimensione del file.

$ ls -l



Puoi anche visualizzare i file nascosti in qualsiasi directory. In questo caso, se vuoi visualizzare l'elenco dei file nascosti nella directory Documenti, scrivi "ls -a" nel terminale e premi invio. I file nascosti hanno l'inizio del nome del file con '.', che è la sua indicazione come file nascosto.

$ ls -a



Puoi anche visualizzare i file nell'elenco lungo ei file nascosti combinano il formato. A tale scopo, puoi utilizzare il comando 'ls -al' e ti darà i seguenti risultati.

$ ls -al



Utilizzare il comando 'ls -Sl' viene utilizzato per visualizzare un elenco di file che viene ordinato. Questo elenco è ordinato in base all'ordine decrescente delle loro dimensioni. Come in output, puoi vedere che il primo file ha la dimensione del file più grande tra tutti gli altri file. Se due file hanno le stesse dimensioni, questo comando li ordinerà in base ai loro nomi.

$ ls -Sl



Puoi copiare queste informazioni relative ai file che sono attualmente visualizzati sul terminale scrivendo 'ls -lS> out.txt', out.txt è il nuovo file che conterrà il contenuto corrente sul terminale. Esegui questo comando, controlla il contenuto del file out.txt aprendolo.

$ ls -lS> out.txt $ ls





È possibile utilizzare il comando 'man ls' per visualizzare la descrizione completa dei comandi relativi a 'ls' e applicare tali comandi per visualizzare i risultati prospettici.

$ uomo ls



9. Autorizzazioni file

In questo argomento verranno illustrati i privilegi dell'utente o i permessi dei file. Usa il comando 'ls -l' per vedere il lungo elenco dei file. Qui il formato '-rw-rw-r– ' è diviso in tre categorie. La prima parte rappresenta i privilegi del proprietario , il secondo rappresenta i privilegi di gruppo e il terzo è per il pubblico .

$ ls -l



In questo formato, r sta per read, w sta per write,d per directory e x per esecuzione. In questo formato '-rw-rw-r– ', il proprietario ha i permessi di lettura e scrittura; il gruppo ha anche i permessi di lettura e scrittura, mentre il pubblico ha solo il permesso di leggere il file. L'autorizzazione di queste sezioni può essere modificata utilizzando il terminale. Per questo, puoi ricordare questa cosa che qui userai "u" per un utente, "g" per il gruppo e "o" per il pubblico. Ad esempio, hai le seguenti autorizzazioni di file '-rw-rw-r– ' per il file1.txt e desideri modificare le autorizzazioni per il gruppo pubblico. Per aggiungere i privilegi di scrittura per il gruppo pubblico, usa il seguente comando

$ chmod o+w file1.txt

E premi invio. Successivamente, visualizza l'elenco lungo dei file per la conferma delle modifiche.

$ ls -l



Per riprendere il privilegio di scrittura concesso al gruppo pubblico del file1.txt, scrivere

$ chmod o-w file1.txt

E poi "ls -l" per visualizzare le modifiche.

$ ls -l



Per fare questo per tutte le porzioni in una volta (se stai usando questo scopo educativo), prima di tutto dovresti conoscere questi numeri, che verranno usati nei comandi.

4 ='leggi'
2 ='scrivi'
1 ='esegui'
0 =nessuna autorizzazione'

In questo comando 'chmod 754 file1.txt', 7 si occupa dei permessi del proprietario, 5 si occupa dei permessi del gruppo, 4 si occupa del pubblico o di altri utenti. 4 mostra che il pubblico ha il permesso di leggere, 5 che è (4+1) significa che gli altri gruppi hanno il permesso di leggere ed eseguire e 7 significa (4+2+1) che il proprietario ha tutti i permessi.

10. Variabili d'ambiente

Prima di entrare direttamente in questo argomento, devi sapere cos'è una variabile?.

È considerata una posizione di memoria che viene ulteriormente utilizzata per memorizzare un valore. Il valore memorizzato viene utilizzato per diversi motivi. Può essere modificato, visualizzato e salvato di nuovo dopo l'eliminazione.

Le variabili di ambiente hanno valori dinamici che influiscono sul processo di un programma su un computer. Esistono in ogni sistema informatico e i loro tipi possono variare. È possibile creare, salvare, modificare ed eliminare queste variabili. La variabile d'ambiente fornisce informazioni sul comportamento del sistema. Puoi controllare le variabili di ambiente sul tuo sistema. Apri il terminale premendo CTRL+ALT+T e digita "echo $PATH"

$ eco $PERCORSO



Fornirà il percorso di una variabile di ambiente, come mostrato di seguito. Nota che in questo comando 'echo $PATH', PATH fa distinzione tra maiuscole e minuscole.

Per controllare il nome della variabile d'ambiente dell'utente, digita "echo $USER" e premi invio.

$ eco $UTENTE



Per controllare la variabile della directory home, utilizzare il comando riportato di seguito

$ eco $ CASA



In questi diversi modi è possibile visualizzare i valori archiviati in specifiche variabili di ambiente. Per ottenere un elenco di variabili che esistono nel tuo sistema, digita "env" e premi invio.

$ ambiente



Ti darà i seguenti risultati.


I comandi scritti di seguito vengono utilizzati allo scopo di creare e assegnare un valore a una variabile.

$ NuovaVariabile=abc123
$eco $NuovaVariabile



Se vuoi rimuovere il valore di questa nuova variabile, usa il comando unset

$ non imposta NuovaVariabile

E poi fai eco per vedere i risultati

$ eco $NuovaVariabile

11. Modifica dei file

Apri il terminale premendo CTRL+ALT+T, quindi elenca i file usando il comando 'ls'.

$ l



Mostrerà i nomi dei file presenti nella directory di lavoro corrente. Ad esempio, si desidera creare un file e quindi modificarlo utilizzando il terminale, non manualmente. Per questo, digita il contenuto del file e scrivi il nome del file che vuoi dare.

$ echo 'Questo è un file'> linuxhint.txt e poi usa il comando 'ls' per visualizzare l'elenco dei file.

$ echo "Questo è un file"> linuxhint.txt $ ls



Utilizzare il comando seguente per visualizzare il contenuto del file.

$ gatto linuxhint.txt



Per modificare il file utilizzando il terminale, digita il seguente comando

$ nano linuxhint.txt



"Questo è un file"
Questo è un suggerimento per Linux
Visita il nostro canale, chiamato anche linuxhint



Scrivi il contenuto che desideri aggiungere a questo file e premi CTRL+O per scriverlo nel file, quindi premere invio.

Premi CTRL+X per uscire.

Puoi anche visualizzare il contenuto del file per controllare il testo modificato in esso.

$ gatto linuxhint.txt

12. Pseudo file system (dev proc sys)

Apri il terminale e digita "ls /dev" e premi invio. Questo comando ti darà l'elenco dei dispositivi che il sistema ha. Questi non sono dispositivi fisici, ma il kernel ha inserito alcune voci.

$ ls /dev



3
Se vuoi accedere al dispositivo stesso, devi passare attraverso l'albero del dispositivo, che è il risultato del comando precedente.
Digita 'ls /proc' e premi invio.

$ ls /proc





I numeri qui rappresentano gli ID dei processi in esecuzione. Il numero "1" è il primo processo del sistema, che è "processo di avvio". Utilizza l'ID processo per verificarne lo stato nel sistema. Ad esempio, se vuoi controllare lo stato del processo 1, digita "cd /proc/1", quindi digita "ls" ed eseguilo.

$ cd /proc/1



Esci da quel percorso usando ' cd ..'

$ cd ..



Successivamente, parleremo di "sys". annota il seguente comando nel tuo terminale

$ cd /sys $ ls

Ora puoi vedere tutte le directory importanti. Qui è dove non puoi ottenere molte impostazioni che esistono all'interno del kernel o del sistema operativo. Puoi entrare nel kernel ed elencare anche i suoi file.

$ cd kernel $ ls

Ora puoi vedere un elenco di flag, processi.



Puoi visualizzare il contenuto di uno qualsiasi di questi file utilizzando il comando cat con 'sudo' poiché richiederà l'autorizzazione di amministratore.

Inserisci la tua password.



Qui 0 indica che il flag è di default. L'impostazione del flag può cambiare drasticamente il comportamento del sistema.

13. Trova file

Lo scopo di questo argomento è di farti imparare a cercare e trovare file attraverso il terminale. Per prima cosa apri il terminale e usa il comando 'ls', quindi per trovare un file da qui puoi scrivere

$ trova. file1.txt





puoi vedere il risultato del comando con tutti i file che contengono '.' e 'file1'.

Per trovare soprattutto il file scrivi il comando.

$ sudo trova. -nome “file1.txt”



C'è un altro metodo per fare questa cosa è usare il comando 'trova'. Questo comando individuerà e troverà tutto ciò che corrisponde alla tua parola chiave.

Se la finestra del terminale mostra un errore per il comando, installa prima 'mlocate' nel tuo sistema e poi prova di nuovo questo comando.

$ sudo apt-get install mlocate

$ individuare fa

Stamperà tutte le informazioni che contengono "fa".



14. File punto

I file punto sono quei file nascosti nel normale file system. Prima di tutto, per vedere un elenco combinato di file, digita il seguente comando nel terminale.

$ ls -al



Qui puoi vedere che un punto rappresenta il nome utente e due punti rappresentano la cartella principale.

Utilizzando il comando 'ls .' verrà visualizzato un elenco di file o il contenuto presente nella directory corrente

$ l.





'ls ..' visualizzerà la cartella sopra, che è essenzialmente il nome utente in questo caso.

$ ls ..



Per saltare nel contenuto di un file in avanti, utilizzare il comando riportato di seguito.

$ cat ../../etc/passwd

Mostrerà tutto il contenuto in questo file passwd di ecc., direttamente usando i punti doppi.



15. Compressione e Decompressione

Per comprimere un file da qualsiasi posizione, il passaggio 1 consiste nell'aprire il terminale da quella posizione per aprire semplicemente il terminale e utilizzare il comando 'cd' per rendere quella directory la directory di lavoro attuale.

Per comprimere qualsiasi file, digita 'gzip filename'. In questo esempio, hai compresso un file chiamato "file1.txt", che è presente sul desktop.

$ gzip file1.txt

Esegui il comando per vedere i risultati.



Per decomprimere questo file, scrivi semplicemente il comando 'gunzip' con il nome del file e l'estensione di '.gz' poiché è un file compresso.

$ gunzip file1.txt.gz

E ora esegui il comando.



Puoi anche comprimere più file contemporaneamente in un'unica cartella.

$ tar cvf compressfile.tar file1.txt nuovofile.txt

Qui, c sta per creare, v sta per visualizzare e f sta per le opzioni dei file. Questi comandi funzioneranno in questo modo:in primo luogo, creerà una cartella compressa, chiamata "compressfile" in questa macchina. In secondo luogo, aggiungerà "file1.txt" e "newfile.txt" in questa cartella.





Esegui il comando e quindi controlla compressfile.tar per vedere se il file esiste o meno.

$ ls -l



Per decomprimere il file, digita il seguente comando nel terminale

$ tar xvf compressfile.tar

16. Comando touch in Linux

Per creare un nuovo file utilizzando il terminale, viene utilizzato un comando touch. Viene anche utilizzato per modificare il timestamp di un file. Per prima cosa, digita il comando 'ls; ti darà un elenco di file che sono presenti nella directory di lavoro corrente. Da qui puoi vedere facilmente i timestamp dei file.

Creiamo prima un file e chiamiamolo "bingo"

$ bingo tattile

E quindi visualizzare l'elenco dei file per confermarne l'esistenza.

$ l



E ora, visualizza un lungo elenco di file per vedere il timestamp.

$ ls -l



Supponiamo di voler modificare il timestamp di un file denominato "file1.txt". Per questo, scrivi il comando touch e definisci il nome del tuo file con esso.

$ tocca file1.txt $ ls -l



Ora, se hai un file esistente chiamato "file1.txt", questo comando cambierà solo il timestamp di questa modifica e conterrà lo stesso contenuto.

17. Crea e rimuovi directory

In questo argomento imparerai come creare e rimuovere directory in Linux. Puoi anche chiamare quelle directory "cartelle". Vai sul desktop e apri il terminale. Digita il seguente comando per ottenere l'elenco dei file.

$ l



Ora crea una cartella qui. Per questo, puoi usare il comando 'mkdir', che è il comando make directory e digitare il nome della cartella con esso.

$ mkdir nuova cartella

Esegui il comando ed elenca di nuovo i file per verificare che il comando abbia funzionato o meno.

$ l



Puoi anche eliminare questa cartella. Per questo, devi scrivere un comando che dice alla shell di comunicare con il sistema operativo per eliminare la cartella ma non i file all'interno.

$ rm -r nuova cartella

E poi verifica la sua rimozione usando il comando 'ls'.

$ l

18. Copia, incolla, sposta e rinomina i file in Linux

Per eseguire tutte le funzioni menzionate in questo argomento, in primo luogo, devi creare un file separato. Apri il terminale dal desktop.

Scrivi il comando per creare un file.

$ tocca bingwindowslinux

E scrivi del contenuto e salva il file.

$ l

Questo è solo Linux



Dopodiché, apri nuovamente il terminale. Per copiare il contenuto di questo 'bingowindowslinux' in un altro file, usa il comando 'cp' con il nome del primo file da cui il contenuto verrà copiato in un altro file.

$ cp copia di bingowindowslinux

E poi visualizza l'elenco dei file.

$ l



Ora apri il file "copia" per vedere se è stato copiato il contenuto del file di "bingowindowslinux" in sé.



Per rinominare questo file, utilizzare il comando sposta. Il comando "sposta" viene utilizzato per spostare il file da una directory a un'altra, ma se esegui questo comando nella stessa directory, il file verrà rinominato.

$ mv copy notcopy

Apri questo file rinominato per visualizzarne il contenuto.





Se desideri modificare la posizione di questo file, puoi utilizzare nuovamente il comando 'sposta' definendo la posizione in cui desideri spostare il file.

Per spostare il file 'notcopy' nella directory root'~', scrivi semplicemente

$ mv notcopy ~

Quindi 'ls ~' per visualizzare i file della directory principale.

$ ls ~



19. Nome file e spazi in Linux

Per prima cosa visualizza i file sul desktop con il comando $ ls. Se vuoi creare un file con un nome file con spazio, esiste qualche modifica nel comando touch semplice.

L'esecuzione del comando "tocca nuovo file" creerà file separati, come mostrato di seguito.

Per creare un file con spazi nel nome del file, considera questo formato:

$ tocca il file ubuntu

Esegui il comando ed elenca i file per vedere i risultati.







Se vuoi creare una directory con il nome tra spazi, scrivi semplicemente

$ mkdir nuova cartella

Ed esegui il comando per vedere i risultati.

20. Completamento automatico in Linux

In questo argomento parleremo del completamento automatico in Linux. Vai sul desktop e da lì apri il terminale.

Scrivi 'cd./D' e premi la scheda

$ cd ./D



Questo comando offre tre possibilità di completamento automatico per la "D".

Quindi digita "o" e premi la scheda NON INVIO, e ora vedrai la possibilità di completamento automatico per la parola "Fai".

$ cd ./Fai

Quindi premi "c" e tab; completerà automaticamente la parola perché esiste una sola possibilità per questa opzione.

$ cd./doc







Puoi usarlo anche per i comandi. Il completamento automatico nei comandi ti consentirà di selezionare le opzioni per i comandi per quella parola specifica.

Digita "a" e poi premi tab. Questa azione ti darà i seguenti risultati

$ a



21. Scorciatoie da tastiera

In questo argomento imparerai le diverse scorciatoie da tastiera in Linux.
CTRL+MAIUSC+n viene utilizzato per creare una nuova cartella.
Maiusc+cancella per eliminare un file
ALT+Home per entrare nella directory home
ALT+F4 Chiudi la finestra
CTRL+ALT+T per aprire il terminale.
ALT+F2 per immettere un singolo comando
CTRL+D per rimuovere una riga
CTRL+C per copiare e CTRL+V per incollare.

22. Cronologia della riga di comando

Puoi utilizzare il comando "cronologia" per visualizzare la cronologia della riga di comando in Linux.

$ storia





Per utilizzare nuovamente uno qualsiasi dei comandi di questo elenco, utilizzare il formato seguente

$ !496





Svuoterà la finestra.
Proviamo con un altro comando

$ storia | meno







Verranno visualizzati alcuni comandi e premere invio per vedere sempre di più dai comandi totali. Questo comando memorizzerà solo i comandi "500" e, successivamente, inizierà a scomparire.

23. Comandi Testa e Coda

Il comando Head serve per ottenere la prima parte della parte superiore del file mentre il comando Tail serve per ottenere l'ultima parte della parte inferiore del file di testo, che è di lunghezza fissa.

Apri il terminale usando CTRL+ALT+T e vai alla directory del desktop.

$ capo filearticle

Esegui il comando per vedere i risultati.



Per leggere le ultime righe del documento, utilizzare il comando seguente

$ coda filearticle

Questo comando recupererà l'ultima parte del documento.





Puoi leggere due file alla volta ed estrarre anche la parte superiore e inferiore dei documenti.

$ file headsay filearticle



$ file di coda filearticolo

24. comando wc

In questo argomento imparerai a conoscere il comando 'wc'. Il comando Wc ci dice il numero di caratteri, parole e righe di un documento.

Quindi prova questo comando sul tuo file "fileessay".

$ wc dossier

E controlla i valori.



Qui, 31 rappresenta il numero di parole, 712 il numero di righe e 4908 il numero di caratteri in questo documento di "saggio".

Puoi modificare il contenuto del file, quindi utilizzare di nuovo questo comando 'wc' per vedere la differenza visibile.



Puoi anche controllare questi attributi separatamente. Ad esempio, per conoscere il numero di caratteri in questo file 'fileessay', digita il seguente comando nel terminale.

$ wc -c saggio di file



Usa '-l' per ottenere il numero di righe e '-w' per il numero di parole in questo comando.

$ wc -l saggio di file $ wc -w saggio di file



Puoi anche ottenere il numero di caratteri dalla riga più lunga del file. In questo, prima di tutto, il comando controllerà la riga più lunga del documento, quindi ti mostrerà il numero di caratteri che ha attualmente.

$ wc -L saggio di file

Esegui il comando per vedere il risultato della query.

25. Sorgenti dei pacchetti e aggiornamento

Prima di tutto, devi sapere cos'è un pacchetto? Un pacchetto si riferisce a un file compresso contenente tutti i file forniti con una particolare applicazione. Le ultime distribuzioni Linux hanno repository standard che includono molto software che desideri avere sul tuo sistema Linux. I gestori di pacchetti integrati gestiscono l'intera procedura di installazione. L'integrità del sistema viene mantenuta assicurando che il software installato sia noto al gestore pacchetti.

Saresti in grado di scaricare il software dal repository nei seguenti casi. Il primo è che il pacchetto non si trova nel repository, il secondo è che un pacchetto è sviluppato da qualcuno e non è stato ancora rilasciato, e l'ultimo motivo è che devi installare un pacchetto con dipendenze o opzioni personalizzate che tali dipendenze non sono generali

Qualsiasi pacchetto può essere facilmente installato utilizzando il comando sudo. Sudo è per diventare l'utente root o superutente. Esistono alcune attività che non puoi eseguire senza essere il superutente; l'aggiornamento del repository è uno di questi. Digita il seguente comando per aggiornare il repository tramite il terminale.

$ sudo apt-get update

Inserisci la tua password per concedere l'autorizzazione, quindi attendi il completamento di questo processo.



26. Gestione dei pacchetti, ricerca, installazione, rimozione

'apt-cache' è il semplice comando utilizzato per cercare un pacchetto tramite il terminale.

$ apt-cache cerca yum



Con questo comando cercherai il pacchetto 'yum'. Quindi questo è un semplice comando per cercare il nome del pacchetto che desideri cercare. Questo comando di ricerca mostrerà tutto ciò che riguarda yum.

$ sudo apt-get install yum



Per disinstallare questo pacchetto yum, puoi semplicemente usare il seguente comando

$ sudo apt-get rimuovi yum

Per eliminare qualsiasi pacchetto con le sue impostazioni di configurazione, viene utilizzato il comando di eliminazione.

$ sudo apt-get purge yum

27. Registrazione

In Linux, i registri sono archiviati nella directory '/var/log'. Se vuoi vedere i file di registro, usa il seguente comando.

$ ls /var/log



From the output, you can see there exist various log files in your system, like some of them are related to authorization, security, and some are related to kernel, system boot, system log, etc.

To view the content inside of these files, you have to use the ‘cat’ command with the path of the log file. Example command execution is given below.

$ cat /var/log/auth.log







The output shows all the information related to the authorization and security things you have done today, all the files and sessions in which you used your root permissions and worked as a superuser.

28. Services

This topic is about services, okay, so you are going to discuss services in Linux. First, understand the basics of the services. Services in Linux are the background tasks that are waiting to be used. These background applications or sets of applications are the set of essential tasks running in the background, and you don’t even know. An example of typical services would be apache and MySQL.

Now let’s see how you can work with services on how you can start, stop, restart, and even check the status of it or check all the services that are running on your system. First of all, you will open up your terminal by pressing CTRL+ALT+T.

here you are going to write

$ service –status-all



It will tell you about all the services which are running in the background, and ‘+’ means that the service is up and running and it is active the ‘-’ means that the service is not active and it is not running, or maybe it is unrecognized.

Let’s explore the ‘Apache’ service. First of all, you are going to write ‘service’ and then the service name, which is essentially Apache, and then you write ‘status.’

$ service apache2 status



The green dot shows that it is running, and the white dot shows that it has been stopped.

Press ‘CTRL+c’ so that you can come out of it, and you can simply write your command in the terminal.

$ service apache2 start



$ service apache2 status

$ service apache2 restart





29. Processes

The process is a computer program in action and carryout the task of the operating systems. Now, what if you want to, you know, see, or check what are the processes that are like going on your system.

$ ps



Here you can see that you have a list of the processes which are like going on. The PID is nothing but a unique process ID that is given to the process, so it is ideal for defining and identifying a process or anything any entity by the ID number. TTY is the terminal from it is running, and time is the CPU time that it has taken to run the process or complete the process, and CMD is the basic name of the process.

Let’s run an example and see how you can check out the processes and run them. If you run a process named Xlogo, you hit enter, and you can see that this is a process it takes a lot of time here, and you cannot run anything right here.



To write anything, you have to press CTRL+C. It is visible that the Xlogo window is now gone.

To shift this process into the background, what you can do is that you can write

$ xlogo &

You can see that now this process is running in the background.

30. Utilities

Utilities are also known as commands in Linux.

Utilities are also known as commands; although there is no real differentiation between a command and a utility, there is still a difference between Linux shell commands and standard Linux commands. The utility is nothing but a tool to run a command. ‘ls’, ‘chmod’, ‘mdir’ are some of the utilities used in general.

31. Kernel Modules

Kernel modules are stored in the home directory or the root folder. These are the drivers that can be loaded and unloaded as well as needed or at the boot time. The kernel is the low-level aspect of your computer that sits between the user and hardware, and its job is to how to you know, talk to CPU to communicate with the memory and the communication with the devices. It takes all the information from the application and communication with the hardware, and it also takes all the information from the hardware, and it communicates with the application, so you can say that kernel is a bridge which takes the information from the application to the hardware and from the hardware to the application. For the kernel to communicate with the hardware, it needs to have some specific modules. It needs to have a module that can tell it how to do that, and those modules are available and built-in, and a few of them can be imported. They are externally available, and you can use them as you need them.

Use the following command to check the list of the available modules in your system.

$ lsmod





So here, you can see the name of the modules in the first row, and the second row is for a module, and the third one is just the comments or the information against each driver or each kernel module.

To uninstall a module named ‘lp’, you can write

$ sudo rmmod lp

32. Adding and changing users

This topic is about adding users and changing users. When you add a user, you will add it to a specific group, or you can also create a user as if you don’t want to add it to any group then the user will you will be created and it will generate its own like sort of a unique identity and a unique group sort of thing.

Open up our terminal, so before you add a user to the group, there are a couple of things that you need to know. You should know that in which group you are going to add the user. To know which groups exist on our system, you need to write this command

$ cat /etc/group

You can see that you have several groups available. Let’s say you want to add a user to this group, so l the user name you want to name the user as John.

$ sudo useradd -d /home/john -s /bin/bash -g colord -m john



As you created the users successfully, you can write

$ cat /etc/passwd





Here you can see that you have a user named John, and this 126 is the group ID of the group ‘colord’.

33. User group and user privileges

In this topic, you are going to learn how to create and delete a user as well as a group and also discuss the user privileges.

Open up the terminal and create a user with its unique group. You can add users individually as well.

$ sudo useradd -m johny

And now confirm the existence of this user by opening the content of the ‘passwd’ file

$ cat /etc/passwd







What if you want to create another specific group, and you want to add users to that so adding users to that is very simple, and it is discussed in the previous topic. Now write a command to create a unique group so that you can add any member to it.

$ sudo groupadd Linuxusers

Check the content of the group file

$ cat /etc/group





You can also delete the group by using the ‘groupdel’ command

$ sudo groupdel Linuxusers

And again, check the group file to confirm its deletion.

$ cat /etc/group



34. Using sudo

sudo stands for ‘superuser do ’. The idea is that you cannot perform certain actions without being a superuser, and you can ask why is that so? You cannot perform any installation or changes in the root folder without being a superuser because your system needs to be saved so no other user can make any changes other than you. So you have to put in your password, and you need to make your system make sure that it’s you, and then you can make changes in the root folder; otherwise, whatever commands you would write, it would give you the error or the warning. Whenever you see that permission denied message, it means that you need to work as a superuser because these changes are going to affect your root folder.

Using the sudo command, you can update your system.

$ sudo apt-get update



You can create or delete a new directory and many more actions by becoming a superuser.

$ sudo mkdir newDirectory $ ls

35. Network UI

Openup the terminal and write here the first command, which is

$ sudo ip link



Press enter and see different network interfaces. The number one is this ‘lo’, which stands for Linux host, and others are the ethernet networks. You can see there is a MAC address, which tells us that it is the ether link. If you see here we have ‘UP’, it means that it is ready and available and it can be used so up just tells you that it is available. It doesn’t mean that it is being used; it means that it is available to use. ‘LOWER_UP’ shows that a link is established at the physical layer of the network.

We will also see you know the IP addresses and how do we check them.

$ sudo ip addr



To get the information about all of the commands related to ip link, type

$ man ip link





Try some of those commands for a better understanding of the topic.

36. DNS (incomplete)

$ hostnamectl set-hostname SERVER.EXAMPLE.COM
10.0.2.15
~$ sudo nano /etc/network/interfaces
$ sudo apt-get install bind9 bind9utils
$ cd /etc/bind
$ nano etc/bind/name.conf

37. Changing nameservers

Open your terminal by using ‘CTRL+ALT+T’ and write the following command in it.

$ sudo nano /etc/resolve.conf





This is the configuration file that has been opened. Now, we are going to write ‘8.8.8.8’ and then we’re going to change another server we’re going to write here ‘8.8.4.4’ so save it, write it out, and then we exit it.

Now before doing anything, let’s let us check that if the changes have been made in the file successfully or not. Write this command ping, which is the packet internet groper, so P is for packet I for Internet, and G is for groper. It communicates between the server and the source and the server and the host. It will verify that our main service has been changed and they’re like a set.

$ ping 8.8.8.8



We have set the name server as 8.8.8.8, and now you can see we have started to get reserves; we are getting all the packets, and the communication has begun.

Press ‘CTRL+C’ and you can see it has shown us all the details about the packets which have been sent, received and the information about the packet lost.

38. Basic Troubleshooting

We are going to discuss some basic troubleshooting commands on this topic. Before everything, whenever you get to a Linux host, run the following command to know the version of the Linux.

$ uname -a



This is essential to know because of the version across different distributions of Linux; the commands might differ. But these commands will work on any Linux distribution, so the first command that we are going to discuss the ping command.

Ping is used for network reachability tests, so if you want to test the network reachability, you will write this ping command. Let’s try to send five requests, and we send it to the IP address 8.8.8.8

$ ping -c5 8.8.8.8



Now it would send like five requests, and you can see that five packets have been transmitted, and five have been received, and in that whole scenario, there is a zero percent packet loss.

You can also test the ping command on some IP address where you know there might be a packet loss or something. Give a random IP address and test the command.

$ ping 2.2.2.2



Press ‘CTRL+C’ to know the results.

Ping can also be used with the DNS name as well; you can test it with the ‘www.google.com’.

$ ping www.google.com



Now let’s discuss another command, which is ‘traceroute’. This traceroute command trace all the path of the network, and it displays you each activity on each hop.

$ traceroute 8.8.8.8



Results have shown you all the activity through every hop. There is another command that will troubleshoot commands that we would like to discuss, which is ‘dig’. let’s try digging amazon.com, so we have tried to dig amazon.com

$ dig www.amazon.com



We can get the message size, the name, server IP, QE time.

There is another command, ‘netstat’, which represents the network status statistics; it displays you all the active sockets and internet connection.

$ netstat

$ netstat -l



This command will display all the programs which are currently listening and all the internet connections which are listening as well.

39. Informational utilities

Let’s look at some utilities which could provide information about your networking subsystem. The first command is the ‘arp’ command. arp stands for address resolution protocol, so the idea is that every machine has a unique address like every DNS has a unique address in the form of an IP address similarly every machine has a unique address as well which is known as MAC address. ‘arp’ or the address resolution protocol matches the IP address with the MAC address. Locally wherever you want to communicate or you want to communicate in that case, we need a MAC address specifically for local communication from one machine to another machine on the same network or from one machine to the router on the same network.

$ arp -a



There is another informational utility, which is ‘route.’

$ route



you can see a routing table as a result of the route command execution.

You can also use another utility to view the routing table, but this one shows the IP addresses of the destination instead of its name.

$ netstat -rn

$ man netstat





40. Packet Captures

In this topic, you will learn how to capture packets, and we can do that using some packet capturing tool. The most used tool for this purpose is ‘wireshark’. Write the following command to begin its installation on your system.

$ sudo apt-get install wireshark



Enter your password when it asks for it. After that, it would ask you for the configuration of Wireshark that if you want to give access to non-superusers so you have to select yes because we want to give access to non-superusers as well and now it would start to you know unpack the packet.





After its installation, open the Wireshark software; first of all, go here on the capture options, and you can see that we have input as cisco remote capture random pattern generator and ssh remote capture, UDP listener. Select the random packet generator, and once you click start and if you do not see any of these options, ten simply restart your system. Sometimes you need to restore the system.

Run a few commands before starting the process of packet capturing and to make sure that you set everything. First of all, check the group of the Wireshark

$ sudo addgroup -system wireshark

Make sure that this group exists.

After that write another command

$ sudo setcap cap_net_raw,cap_net_admin=eip /usr/bin/dumpcap

After that, add the user to the Wireshark group.



$ sudo usermod -a -G wireshark linuxhint

Now go back to the Wireshark software, and under the same settings, you will see the packet capturing process.



41. IP Tables

In this topic, we are going to discuss IP tables. IP tables are just a set of rules which define your network’s behavior, your machine’s behavior on your network.

The command to view the IP table is given below

$ sudo iptables -L



you can see this is the first chain is the input, then the second chain that we have is the forward chain, then we have the output chain. Whatever rules you will give to this in this IP table, your machine will follow it. This input rule or the input policy is for sending that traffic to itself like your machine right now whatever input it is taking like if you send traffic you’re sending traffic from your machine to your machine is called the input chain. Whatever rules you will set here, they will be for your machine or your localhost.

Output chain would send from your machine to some other machine out there in the world or out there on the network that would be the output chain. You can set and define rules for dealing with the output traffic from here, the traffic that you’re sending from your machine to the outside world to any other machine. In this example, you are trying to send traffic from your machine to the outside world to any other machine.

For sending a packet to the local host, execute the following command

$ ping 127.0.0.1



Now let’s say we define a rule here, and we do not want to send any packet to ourselves. We define a rule, and we drop the package that we intend to send to ourselves. For that, we set a rule in the IP tables.

$ sudo iptables -A INPUT -d 127.0.0.1 -p icmp -j DROP $ sudo iptables -L



You can see that this command has been executed successfully, so now, if you check the IP tables, you can see that this is a rule that has been added to the input chain, right. You can also define rules for the OUTPUT chain. An example of this is given below.

$ sudo iptables -A OUTPUT -d 8.8.8.8 -p icmp -j DROP $ sudo iptables -L

42. SSH servers

In this topic, you are going to learn how you can enable SSH and install an open server in your system. If your system is an SSH client, then it can connect to any SSH server out there using a simple command. It can connect to any of the SSH servers, and it can use the operating system remotely. To check that if SSH is installed or enabled on your system, type ssh and press enter.

$ ssh

If you see, you know things like this.



then it means that you are an SSH client, or your machine is an SSH client.

simply if you want to connect your machine to a remote machine and you want to use it like any server out there which is hundreds of miles away from you, you can do that by writing a command like this

$ ssh username@ip -5252

SSH then the username of that server, then the IP address of that server, and then if there is a special port, you can write here.

Now you are going to learn going to connect to your localhost. It means that you are going to connect to our machine and use your operating system. First of all, check whether SSH is enabled in your system or not.

$ ssh localhost



After this step, install the open shh server on your system

$ sudo apt-get install openssh-server



$ ssh localhost





Now check the status of the SSH service by using the following command.

$ sudo service ssh status



You can also make a different kind of changes in this whole procedure. You can edit the file for that.

$ sudo nano /etc/ssh/ssh_config



43. Netcat

Netcat is a popular network security tool. It was introduced in 1995. Netcat runs as a client to initiate the connections with other computers, and it can also operate as a server or listener in some specific settings. Some common usages of Netcat are using it as a chat or messaging service or file transfers. Netcat is also used for port scanning purposes.

To know that your system has netcat or not, type the command given below in your terminal.

$ nc -h





Next, you are going to learn how to create a chat service using Netcat on a terminal.

For this, you have to open two windows of the terminal. One is then considered ad server and the other window as a client. Use the following command in the server terminal for the establishment of a connection.

$ sudo nc -l -p 23

Here 23 is the port number. At the client-side, execute the following command.

$ nc localhost 23

And here we are with our chat service.



44. Installing Apache, MySQL, Php

First of all, we are going to install Apache, but before that, update your repository

$ sudo apt-get update



After updating the repository, install apache2 on your system.

$ sudo apt-get install apache2



You can confirm its existence by checking the system services and by typing localhost in your web browser.



The next package is the PHP, so you have to write the following command on your terminal.

$ sudo apt install php-pear php-fpm php-dev php-zip php-curl php-xmlrpc php-gd php-mysql php-mbstring php-xml libapache2-mod-php



Now, test the terminal by executing the following command.

$ php -r ‘echo “nnYour PHP iNSTALLATION IS WORKING FINE. nnn”;





Execute the following command for the installation of MySQL.

$ sudo apt-get install mysql-server

After that, run some test commands on this MySQL terminal for testing.

$ sudo mysql -u root -p

> create database testdb;> show databases;



To install PHPMyAdmin, follow these steps:

$ sudo apt-get install phpmyadmin













45. Best youtube editors

We have plenty of editors that we can install, which are best. The first one that we are going to recommend is ‘Sublime text’; then, we have ‘brackets,’ and the one you are going to install on Ubuntu is named ‘Atom’.

$ snap install atom –classic





You can open it up, and then you can open all sorts of reading web files JS files, HTML files, CSS, or PHP files, whatever files related to the web development sort of thing.

46. Bash script

Open up your terminal by pressing ‘CTRL+ALT+T’. In this window, you can write and execute commands, and you will also get the instant output for that too. Below is a simple example is given for a better understanding of a bash script.

In step 1, you can view the list of files in your current working directory. Execute the ‘ls’ command for this purpose.

Now, let’s create and edit a bash script file through the terminal. For that, write the following ‘nano’ command in your terminal.

$ nano bashscript.sh

#! /bin/bash
touch bashtextfile.txt
chmod 777 bashtextfile.txt

$ ls



Now let’s create another file using this bash script. You can use the ‘touch’ command for creating the file and ‘chmod’ for changing the file privileges.

Write out the content using ‘ctrl+o’ and exit this window. Now execute ‘bashscript.sh’ and list the files to see if the ‘bashtextfile.txt’ is created or not.



The ‘bashscript.sh’ is not executable yet. Change the file permissions of this file by the ‘chmod’ command.

$ chmod 775 bashscript.sh

‘775’ is the file privileges given to the owner, groups, and public. File privileges are already well explained in the previous topic.

$ ls



You can also write some statements using the ‘echo’ command.

$ nano bashcript.sh #! /bin/bash
touch bashtextfile.txt
chmod 777 bashtextfile.txt
echo “this is linuxhint.com”



47. Python scripts

To work with python scripts, First of all, install python3 in your system using the terminal.

$ sudo install python3

Follow the installation procedure and install it. After the successful installation of python, test it on the terminal



Write some python commands to see the results.

$ python3

$ print(‘hello World’)



There are other methods of running python using the terminal, which is considered to be the conventional one. First, create a file using the ‘.py’ extension and write all of your python code you want to execute and save the file. To execute this file, simply write the following command in the terminal, and you will get your desired results in seconds.

$ python3 pythonscript.pyPrint(‘hello world’)

$ ls

$ python pythonscript.py

48. C programs

To work with ‘C programs’ using terminal, first of all, you should know whether ‘gcc’ is installed on your system or not and what is the version of ‘gcc’. To know this thing, write the following command in the terminal.

$ gcc –version



Now install the ‘build-essential’ package in your system.

$ sudo apt install build-essential



Create a ‘c’ file using the touch command.

$ touch hello.c

List the files to check its existence.

$ ls



Write the program in this ‘hello.c’ file for which you want to get the output.

#include
int main()
{
printf(“hello World”);
return 0;
}



After that, execute the file on the terminal, using the following command.

$ gcc hello.c -o test $ ./test

Now see the desired result.





Watch FULL VIDEO Course of 4 HOURS:


Debian
  1. Installa Linux Malware Detect su Debian / Ubuntu / LinuxMint - Uno scanner di malware per il sistema operativo Linux

  2. MX Linux contro Ubuntu

  3. 7-Zip per Linux

  4. Il prompt di sistema di Ubuntu per la mia password non è falsificabile?

  5. Amazon Linux vs. Ubuntu per Amazon EC2

Multipass:esegui VM Ubuntu su richiesta per qualsiasi sistema Linux

I 5 migliori editor PDF gratuiti per Ubuntu Linux nel 2022

Comandi di base di Linux per principianti

Software di editing video gratuito VidCutter per Ubuntu Linux

I 25 migliori software gratuiti di imaging medico per sistemi Linux

Processo di avvio di Linux:spiegato passo dopo passo per i principianti