Skip to content

Bash Renaming Files

Everything that you can do on your screen you can do with your terminal. Here is a simple example that I stole from somewhere. For example a file called "Netskope.bck". If you want to rename it you can simply execute:

bash
sudo ps aux | grep Netskope | grep -v grep | awk '{ print "sudo kill -9", $2 }' | sh
sudo mv /Library/Application\ Support/Netskope /Library/Application\ Support/0_disabled_Netskope
sudo mv /Library/Application\ Support/0_disabled_Netskope /Library/Application\ Support/Netskope

What the above does is to kill the process the program is running. You need to run it with super do or sudo.

If you want to rename the file back, just run:

bash
sudo mv /Applications/Remove\ Netskope\ Client.app.bck /Applications/Remove\ Netskope\ Client.app
sudo mv /Library/Application\ Support/Netskope.bck /Library/Application\ Support/Netskope
sudo ps aux | grep Netskope | grep -v grep | awk '{ print "sudo kill -9", $2 }' | sh

Obviously this is just an example on how to rename a file. Solely for demonstrative purposes.