Under linux, the command line displays only the last file path name, very inconvenient, want to display the full path.
Environment background: linux, no root permissions, sudo (for server security, usually only to root administrator account and password, the general account sudo privileges only)
: Modify the environment variable PS1, vi to edit / etc / profile file to add the final line statement.
Command line prompt completely display the full name of the working directory:
Export PS1 = '[\ U @ H $ PWD \] $'
command line prompt lists only the last directory:
Export PS1 = '[\ U @ \ H \ W ] $ '
command line prompt display the full working directory, the current user directory will be used instead:
Export PS1 =' [\ @ U \ H \ W] $ '
modification is completed, the execution: source / etc / profile to validate the configuration i.e. can.
Interpretation command:
\ u Displays the current user account \ display h current hostname \ W displays only the current path to the last directory \ w shows the current absolute path (current user directory will be ~ instead of) $ PWD Displays the current full path \ $ Display command line '$ ' or '# ' symbol
Then the question is, when vi quit, ': wq!' After Enter Tip: E45: 'readonly' option is set (add to override!). The reason is that enough authority, non-root privileges.
Solution:! Q to exit, and then enter the command line sudo !!, vi to edit again.
sudo !! // interpretation: '!' sudo performed on a command, '!' indicates the previous command, linux usage can be found in Reference [3]
Reference:
[. 1] to modify the Linux command prompt display of the current path way
... e45 readonly option is set (add to override!): [2] VIM put the file permissions problem
ten magical usage [3] Linux command line under the "!"
------------- --------
Disclaimer: this article is the original article CSDN bloggers "yytang1", following the CC 4.0 by-sa copyright agreement, reproduced, please attach the original source link and this statement.
Original link: https: //blog.csdn.net/ytang_/article/details/78753200