The main thing i am interested in is the 3rd point below.
In short I am worried about having a virus and what will suffice to remove it.
I am on Mac and am running the latest version of Catalina. I do a lot of stuff on the command line using iTerm2 as an emulator and fish as the shell. As a package manager i use homebrew.
The problem: my shell stopped recognizing commands like ls, brew, locate, ... added slashes to the end of directory names and changed my prompt to @HUAWEI (wtf). All this happened without any direct interaction on my side. I found nothing like this online.
What i did prior to the problem occurring: I updated and upgraded homebrew (more than one day before), I installed the cisco anyconnect client (one day before) and I downloaded a pdf from an untrustworthy page (about 7 hours before).
Here is what i wonder about: 1) Does this sound like a virus to you? 2) If it were/is a virus - is it usually enough to reinstall macos from recovery or reformat the drive and then reinstalling? 3) What about the iCloud backup. After i reinstalled would i not just redownload any infected files from the cloud.
How should i deal with this in general? I.e. when are viruses in backups a problem?
I am well aware that this is very context specific.