Minggu, 22 Juni 2014

How to hide/unhide files using Mac Terminal

Recently, my wife's thumb drive was infected with virus (of course win***s virus). The virus hides all the files and replace them with links. It was 6 years back when my hobby is collecting and studying computer viruses. From that hobby, I know that this virus is not replacing the files, but rather make new files (i.e. links) and hides the original files.

Followings are what I did with my Mac:

Step 1. Unhide the original files. 
1. I use Mac terminal (command + shift, and type "terminal").
2. Type this command (please note that Mac is case sensitive)

$ defaults write com.apple.Finder AppleShowAllFiles YES

3. Put the mouse cursor on the Finder icon in dock. Press alt/option button in your keyboard and do secondary click (double tap) on the icon. Click "relaunch".
4. Open Finder and go to thumb drive
5. Yes, the original files are now visible

Step 2. Remove all the links created by virus
1. command + click to all the .lnk files
2. double tap (secondary click/right click if you use mouse)
3. Move to trash

Step 3. Unhide all the original files
1. In terminal, go to /Volumes folder by using this command

$ cd /Volumes

2. To go to your thumb drive, you need to list all the files in the /Volumes by typing this command

$ ls

3. Now you should see your thumb drive. Say that your thumb drive name is ARWAN, then what you have to do is go to it with the following command (please note that Mac is case sensitive)

$ cd ARWAN 

4. Unhide all the files

$ chflags nohidden *.* 

5. The command will effect only the files. For the directory/ies, you have to do it manually. Say you want to unhide /myfolder

$ chflags nohidden /myfolder

Tidak ada komentar:

Posting Komentar