Handy Linux Commands



I use the following two commands to copy folders or files off all my servers. I use SSH keys to log in, so I don’t have to type the passwords. The epmall.txt file contains the hostname to each of my epm servers, one hostname per line. The first command below makes a unique directory, which in this example is the server’s hostname. The second command copies the scripts directory and all of its contents into the server named folder.

for server in `cat ~/epmall.txt`; do mkdir $server ; done
for server in `cat ~/epmall.txt`; do scp -r essadmin@$server:/usr/local/epm/scripts $server/. ; done

Unzipping Multiple Files:

unzip ‘*.zip’
for z in *.zip; do unzip $z; done


more coming soon.



Add a Comment

Your email address will not be published.