Questo forum utilizza i cookies
Questo forum fa uso di cookie per migliorare l'esperienza utente. I cookie sono piccoli file di testo memorizzati sul tuo browser. I cookie impostati dal forum possono essere utilizzati solo su questo sito e non costituiscono rischio per la sicurezza, vengono utilizzati unicamente per memorizzare le tue preferenze. Navigando sul sito accetti che RaspberryItaly installi i cookie sul tuo browser.
Per maggiori informazioni consulta l'informativa sui Cookie di RasberryItaly

Un cookie verra memorizzato nel browser indipendentemente dalla scelta per evitare che questa domanda ti venga posta di nuovo. Sarai in grado di modificare le impostazioni dei cookie in qualsiasi momento utilizzando il link nel footer.
  • Benvenuti su RaspberryItaly!
Benvenuto ospite! Login Login con Facebook Registrati Login with Facebook


Valutazione discussione:
  • 0 voto(i) - 0 media
  • 1
  • 2
  • 3
  • 4
  • 5

[-]
Tags
comandi prompt dei

Prompt dei comandi
#1
Ciao a tutti, vorrei modificare il prompt dei comandi da pi@raspberry a ad esempio pi@pippo.
Si può fare? Ho trovato istruzioni per cambiare il colore al prompt ma non mi sono azzardato a modificare il file .bashrc perchè molto diverso da quello che mostravano le istruzioni...
Risposta
#2
per cambiare da pi@raspberry a  pi@pippo devi chiamare il raspberry "pippo" Smile
cosa volevi scriverci di preciso?
non è un problema editare .bashrc
in sostanza modifichi la variabile
Codice:
PS1="[\\u@\\h:\\w] $"

prova questo: http://bashrcgenerator.com/ e poi copi il risultato con
Codice:
nano ~/.bashrc


Codice:
\a : an ASCII bell character (07)
\d : the date in “Weekday Month Date” format (e.g., “Tue May 26”)
\D{format} : the format is passed to strftime(3) and the result is inserted into the prompt string; an empty format results in a locale-specific time representation. The braces are required
\e : an ASCII escape character (033)
\h : the hostname up to the first ‘.’
\H : the hostname
\j : the number of jobs currently managed by the shell
\l : the basename of the shellâ€s terminal device name
\n : newline
\r : carriage return
\s : the name of the shell, the basename of $0 (the portion following the final slash)
\t : the current time in 24-hour HH:MM:SS format
\T : the current time in 12-hour HH:MM:SS format
\@ : the current time in 12-hour am/pm format
\A : the current time in 24-hour HH:MM format
\u : the username of the current user
\v : the version of bash (e.g., 2.00)
\V : the release of bash, version + patch level (e.g., 2.00.0)
\w : the current working directory, with $HOME abbreviated with a tilde
\W : the basename of the current working directory, with $HOME abbreviated with a tilde
\! : the history number of this command
\# : the command number of this command
\$ : if the effective UID is 0, a #, otherwise a $
\nnn : the character corresponding to the octal number nnn
\\ : a backslash
\[ : begin a sequence of non-printing characters, which could be used to embed a terminal control sequence into the prompt
\] : end a sequence of non-printing characters
Heart Libro  | Blog EnricoSartori.it | Idea YouTube
Se un utente ti è stato utile, aumenta la sua reputazione! premi il Pollicione! 
Risposta
#3
ciao

apri il file hosts e modifica il nome nell'ultima riga dopo il 127.0.1.1 con quello che vuoi tu
Codice:
sudo nano /etc/hosts
apri hostname e mettici lo stesso nome della riga di sopra
Codice:
sudo nano /etc/hostname
applica le modifiche al sistema con
Codice:
sudo /etc/init.d/hostname.sh

e riavvia con
Codice:
sudo reboot

al riavvio avrai un prompt tipo "luca@raspy", ipotizzando che il tuo utente si chiami "luca" e tu abbia scelto "raspy" in hosts e hostname.

era questo che ti serviva?



Coltiva linux, che windows si pianta da solo! (cit.)
Risposta
#4
(11/01/2018, 13:23)Painbrain Ha scritto: ciao

apri il file hosts e modifica il nome nell'ultima riga dopo il 127.0.1.1 con quello che vuoi tu
Codice:
sudo nano /etc/hosts
apri hostname e mettici lo stesso nome della riga di sopra
Codice:
sudo nano /etc/hostname
applica le modifiche al sistema con
Codice:
sudo /etc/init.d/hostname.sh

e riavvia con
Codice:
sudo reboot

al riavvio avrai un prompt tipo "luca@raspy", ipotizzando che il tuo utente si chiami "luca" e tu abbia scelto "raspy" in hosts e hostname.

era questo che ti serviva?

Si grazie! Il secondo file da editare nel mio raspberry era in ETC e si chiama HOSTNAME.
Fatto tutto!

(11/01/2018, 12:51)Enrico Sartori Ha scritto: per cambiare da pi@raspberry a  pi@pippo devi chiamare il raspberry "pippo" Smile
cosa volevi scriverci di preciso?
non è un problema editare .bashrc
in sostanza modifichi la variabile
Codice:
PS1="[\\u@\\h:\\w] $"

prova questo: http://bashrcgenerator.com/ e poi copi il risultato con
Codice:
nano ~/.bashrc


Codice:
\a : an ASCII bell character (07)
\d : the date in “Weekday Month Date” format (e.g., “Tue May 26”)
\D{format} : the format is passed to strftime(3) and the result is inserted into the prompt string; an empty format results in a locale-specific time representation. The braces are required
\e : an ASCII escape character (033)
\h : the hostname up to the first ‘.’
\H : the hostname
\j : the number of jobs currently managed by the shell
\l : the basename of the shellâ€s terminal device name
\n : newline
\r : carriage return
\s : the name of the shell, the basename of $0 (the portion following the final slash)
\t : the current time in 24-hour HH:MM:SS format
\T : the current time in 12-hour HH:MM:SS format
\@ : the current time in 12-hour am/pm format
\A : the current time in 24-hour HH:MM format
\u : the username of the current user
\v : the version of bash (e.g., 2.00)
\V : the release of bash, version + patch level (e.g., 2.00.0)
\w : the current working directory, with $HOME abbreviated with a tilde
\W : the basename of the current working directory, with $HOME abbreviated with a tilde
\! : the history number of this command
\# : the command number of this command
\$ : if the effective UID is 0, a #, otherwise a $
\nnn : the character corresponding to the octal number nnn
\\ : a backslash
\[ : begin a sequence of non-printing characters, which could be used to embed a terminal control sequence into the prompt
\] : end a sequence of non-printing characters

Perfetto! Grazie mille!
Risposta
  


Vai al forum:


Navigazione: 1 Ospite(i)
Forum con nuovi Post
Forum senza nuovi post
Forum bloccato
Forum Redirect