I am writing a script to modify settings on my Ubuntu server.  I have the following line in it:  sudo sed 's/PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config   The problem is that the change will not remain.  It simply changes the 'no' back to 'yes'.  When the command executes, the modified file immediately displays in the terminal showing the 'no', but when I cat the file or open it in vim it shows a 'yes' again.  Additionaly, I can open sshd_config in vim and modify it manually and the change remains just fine.  Any thoughts?  Thanks.
Replacing strings in files based on certain search criteria is a very common task. How can I    replace string foo with bar in all files in the current directory? do the same recursively for sub directories? replace only if the file name matches another string? replace only if the string is found in a certain context? replace if the string is on a certain line number? replace multiple strings with the same replacement replace multiple strings with different replacements
I know the  processors have been around for a long time and are mostly used in servers, but I am curious, why do people not use the Xeons in a high performance desktop?    As far as I know about the best desktop processor out there now is the  line. The i7's and Xeons are both quad-core processors, what is the main difference in these? I just saw that the MacBook Pro's are using the quad core Xeons instead of the i7's. List AppDomains in Process What to do when visa admission expires during lockdown? How do I uninstall Pandoc in Ubuntu 19.10 (and install most recent version) I have an old version of Pandoc installed, but I'd like to install the latest version of Pandoc.   To begin I've run the following to get rid of the old version:  sudo apt-get autoremove --purge pandoc  But when I check that everything is uninstalled by running: pandoc --version Then pandoc 2.2.3.2 pops up.  I can't seem to get rid of this old version of pandoc so that I can install a new one.  Could you advise me on how I can get rid of the old version and install the new one please. Reflexive and relation Please give me feedback on my answer to this question. Question:  For all $x,y\in R$ define that $x\equiv y$ if $x^{2}=y^{2}$. Then $\equiv$ is an equivalence relation on $R$, there are infinitely many equivalence classes, one of them consists of one element and the rest consist of two elements. Answer: False, since;  $x\equiv y$   if $x^{2}=y^{2}$  on $R$  To show $\equiv$   is reflexive, we need to show that ,  $\forall x\in R:X\equiv x.$  Let $x\in R$,   $X\equiv x$   if $X^{2}=x^{2}$  , which is obvious.  $[x]\triangleq:\{y\in R/x\equiv y\}$  $[0]=[y\in R/0\equiv y\},$  when $y=0$,  Then $y^{2}=0^{2}=0$  Thus; there are not many infinity many equivalence classes. Find $f$ where $f'(x) = f(1+x)$ Let $f \colon \mathbb{R} \rightarrow  \mathbb{R}$ be a smooth function such that $$f'(x) = f(1+x)$$ How can we find the general form of $f$? I thought of some differential equations, but not sure how to use them here. Thanks. Create a floating div on top of divs Retagging questions in terms of possible answer technologies When entering the title of this query I was pointed to , which has tentatively endorsed this concept, especially once an answer has been accepted.  Can I get a confirmation that it is actually good practice before an answer has been accepted? (IMHO it is not.)  Two examples:   : I didn't need a WCF answer, which I would have assumed if I had seen the question tagged with WCF even if I didn't mention it in the question or title.   : It looks probable that the answer (if there is one) is related to AOP, but the questioner does not require it. possible to access custom labels dynamically? machine wakes only on local magic packet I've got a Debian server, which I would like to wake up remotely using a tool like wakeonlan.  I have assigned the server a static internal IP 192.168.0.14 and set up the appropriate port forwarding in the router (which otherwise has a very limited admin interface).  When I am logged in to the same network, I can wake the server using the subnet IP, but I cannot wake the server using the public IP of the router.  What I do not understand: When the server is running and I listen on the server with netcat nc -ulv -p 9, I can see the packet coming in in both cases (both when sending to the subnet IP and when sending to the public IP of the router).  If the packet arrives in both cases, why does the machine wake up only in one of them? At the very end of Deathly Hallows, after Harry repaired his own wand with the Elder Wand, he tells Dumbledore's Portrait in the office:     “I’m putting the Elder Wand,” he told Dumbledore, who was watching him with    enormous affection and admiration, “back where it came from. It can stay there. If I die a    natural death like Ignotus, its power will be broken, won’t it? The previous master will    never have been defeated. That’ll be the end of it.   Now, this seems incredibly foolish to me.  "The previous master will never have been defeated" would only have been assuredely true if Harry had died right after depositing the Elder Wand back into Dumbledore's Tomb.   If not, Harry (the Wand owner) would still be alive, and at the risk of being Disarmed (as was shown with Harry and Draco Malfoy, it doesn't matter if the Elder Wand's owner is defeated by death or simple disarming, AND it's not even required that the Disarming would involve the Elder Wand!).  So, if Harry merely put the Elder Wand back into the Tomb, and some years later, someone would disarm him (or, even worse, kill him) - then that someone would become the Elder Wand owner, either by accident or by design:    By accident - Harry is likely to get into plenty of magical duels in the future. Even discounting friendly one (teaching people the Expelliramus), he plans on becoming an Auror!  By design - plenty of people have been in the Great Hall hearing Harry explaining to Voldemort that he, Harry, was now the owner of the Elder Wand, so the fact of his ownership would most assuredly NOT remain a secret, inviting countless people tempted by owning the Deathstick to hunt Harry down. Oh, and the location is now also known!   So "its power will be broken" is quite unlikely to come true!  Is Harry hopelessly wrong? Or am I missing something in the above logic? Was this addressed in canon/JKR info? Why the default eth0 interface is down by default on CentOS? My "Meta" rep on Photo.SE differs from my main rep Is it logically correct to assert that the expectation of the momentum $$\langle \hat p \rangle=0$$ for any bound state because it is bound to some finite region? What is the physical interpretation of the fact that $$\langle \hat p \rangle=0$$ in an energy eigenstate $\psi_n(x,t)$  but $$\langle \hat p \rangle\neq0$$ in some superposition state $$\psi(x,t)=c_m\psi_m(x,t)+c_n\psi_n(x,t)~?$$ Here $\psi_n(x,t)$ the eigenstates of the Hamiltonian, for example, in the problem of particle in a box (say). In some books the word "if" is used in definitions and it is not clear if they actually mean "iff" (i.e "if and only if"). I'd like to know if in mathematical literature in general "if" in definitions means "iff".  For example I am reading "Essential topology" and the following definition is written:     In a topological space $T$, a collection $B$ of open subsets of $T$ is said   to form a basis for the topology on $T$ if every open subset of $T$ can be written as a union of sets in $B$.   Should I assume the converse in such a case? Should I assume that given a basis $B$ for a topological space, every open set can be written as a union of sets in $B$?  This is just an example, I am not asking specifically about this sentence. How do I remove top bar on secondary monitor?? How to send mail from the command line? How to send mail from the command line? Encountered an error while updating through Synaptic Manager. Subsequent updates gave the error at the bottom of the output. I'm a noob so any help is appreciated.  al@al:~$ sudo apt-get -f upgrade Reading package lists... Done Building dependency tree        Reading state information... Done Correcting dependencies... Done The following NEW packages will be installed:   libjack-jackd2-0:i386 The following packages have been kept back:   linux-headers-generic skype 0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded. Need to get 0 B/202 kB of archives. After this operation, 493 kB of additional disk space will be used. Do you want to continue [Y/n]? y (Reading database ... 310056 files and directories currently installed.) Unpacking libjack-jackd2-0:i386 (from .../libjack-jackd2-0_1.9.8~dfsg.2-1precise1_i386.deb) ... dpkg: error processing /var/cache/apt/archives/libjack-jackd2-0_1.9.8~dfsg.2-1precise1_i386.deb (--unpack):  './usr/share/doc/libjack-jackd2-0/buildinfo.gz' is different from the same file on the system dpkg-deb: error: subprocess paste was killed by signal (Broken pipe) Errors were encountered while processing:  /var/cache/apt/archives/libjack-jackd2-0_1.9.8~dfsg.2-1precise1_i386.deb E: Sub-process /usr/bin/dpkg returned an error code (1) What is the best (idiomatic) way to check the type of a Python variable? I need to know if a variable in Python is a string or a dict.  Is there anything wrong with the following code?  if type(x) == type(str()):     do_something_with_a_string(x) elif type(x) == type(dict()):     do_somethting_with_a_dict(x) else:     raise ValueError   Update: I accepted avisser's answer (though I will change my mind if someone explains why isinstance is preferred over type(x) is).  But thanks to nakedfanatic for reminding me that it's often cleaner to use a dict (as a case statement) than an if/elif/else series.  Let me elaborate on my use case.  If a variable is a string, I need to put it in a list.  If it's a dict, I need a list of the unique values.  Here's what I came up with:  def value_list(x):     cases = {str: lambda t: [t],              dict: lambda t: list(set(t.values()))}     try:         return cases[type(x)](x)     except KeyError:         return None   If isinstance is preferred, how would you write this value_list() function? Can you please explain this to me?          Could you please explain this to me?   I am unable to figure out which to use which situation. I did google, and some posts say they are both the same, even if the second one is more formal. Other posts say could is the past tense of can, but in the above example, I don't think could is used as past tense of can.  What is correct way to use these words?