Two questions about bash commands / Linux [closed] - linux

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I need answers for those questions:
How and where can I change default app in user profile in Linux?
How can I save changes in vi editor without exiting? I guess it's w q q! but I'm not sure.

How and where can I change default app in user profile in Linux?
I guess you refer to the editor. If so, use the following:
export EDITOR=vi #or whatever other editor
To make it permanent, add this line to the .bashrc file in the home of the user, that is in ~/.bashrc.
How can I save changes in vi editor without exiting? I guess it's w q q! but I'm not sure.
use :w to save. You have to be in the command mode (go there pushing Esc).

Related

Bash prompt display username starting with $ [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 months ago.
Improve this question
I have registered some linux machines intro AD with sssd and it works great, but I have an issue with the bash prompt. Some AD usernames start with $ and the prompt refuses to display it, so now I'm left with the string similar to #servername:~$
If I do an export PS1="\$USER#\H" it gets displayed correctly.
Any ideas on how to make bash prompt either escape the special character, or make sssd edit the bashrc with the "correct" format?
This is more of a Linux configuration question and would work better in unix.stackexchange.com or askubuntu, but generally to change default user configuration you'd want to edit the files in /etc/skel.

Split vim window with one file read/write and one file read-only [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
I am editing a file using vim. I want to open another file (which currently exists) from within the same vim session and split my screen doing so. I want it to be read-only because I don't want to risk accidentally editing it.
If I try :sp another_file.txt, it opens it in read/write mode.
How do I do this?
:view command is what you are looking for. It opens buffer in readonly mode.
You can try :sv file.txt to open file in split window.

make 'srm' the default command instead 'rm' in linux [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
I want force users to use 'srm' instead of 'rm' command. is there any solution to execute 'srm' command when users run rm command? or deny users permissions to run 'rm'?
Just create an alias:
alias rm='srm'
You can put this command in the .bashrc file for the user you have to keep under control, so that it is automatically loaded at login.
You can also put it into /etc/bashrc, so that it's loaded for ALL the users.
You can use aliases to do this.
Create an alias as ,
alais rm="srm"
Add this in to the bash_profile or bashrc file or even better create a bash_alias file that will be called from bashrc file.
For a general intro on Aliases, refer this http://bit.do/freblogg-aliases

How to log terminal keystrokes in ubuntu [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I want to log whatever is happening in my terminal in a text file . I want to save all session information in the log file. We can do this in putty. But I dont know how to achieve the same in simple terminal in ubuntu. Also, is it possible to use putty to open a terminal for localhost? I tried doing that . But does not work.
You can record your terminal session (assuming you're using Bash) by doing script.
You probably want script -k which records input and output.
So in all, doing something like script -k logfilename you will get what you want!

How to save apache2 file [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I am new to linux and the command line. I am using VirtualBox with linux/ubuntu and needed to open my httpd.conf file to add the following:
ServerName localhost
Now I am stuck here and cannot figure out how to save this and go back to the command line. I know this is easy for the pros but I am completely new at this.
Thanks!
P.S. I searched Google and stackoverflow as I was sure this would have already been answered but I could not find anything on it.
Here is the screen shot.
http://i451.photobucket.com/albums/qq235/tech0925/asdfsafsf_zps80a61cd1.png
You can open your file for example with vi
vi /path/to/your/httpd.conf
after the file is open you can change to edit/insert modus of vi
:i
and edit your file. After editing you cann write and close your file
:wq
//edit:
you can store your file with nano (your editor)
CTRL+x
yes

Resources