Skip to main content

Posts

Showing posts from April, 2016

List all IP Addresses of a server

Multi-homed server, a server with multi-services and is set with different IPs is quite common if there is a budget constraint. It is always good to have a dedicated server do a single function provided there is enough luxury to do it.
So if you just inherited the network and all the servers in your environment have documentation which is poor to nothing, then pray hard that nothing will happen until you have it under control by proper documentation and familiarization.
It's quite tough to troubleshoot when a problem arises if no proper documentation to depend on and there will be a lot of surprises as the work journey goes on.
Listing or getting the IP Addresses on your entire server and having a proper documentation will definitely help and ease the tension during some issues.
It’s also easy to troubleshoot during a network outage or other circumstances that may arise.
Listing the IP Address of a server can be done in different ways.
Doing it remotely is quite convenient and of…

PowerShell Create Zip file and Extract Zip File

Create Zip File:

$source1="D:\core2\south2"
$destination1="D:\c2\zipfile.zip" #filename is important with ".zip" extension

Add-Type -assembly "system.io.compression.filesystem"

[io.compression.zipfile]::CreateFromDirectory($Source1, $destination1)




Extract Zip File:

$source2="D:\core2\zipfile.zip" #zipfile.zip file to be extracted
$destination2="D:\core2\south1"

Add-Type -assembly "system.io.compression.filesystem"

[io.compression.zipfile]::ExtractToDirectory($Source2, $destination2)



MSDN Reference:
https://msdn.microsoft.com/en-us/library/system.io.compression.zipfile(v=vs.110).aspx?cs-save-lang=1&cs-lang=vb#code-snippet-1

===========================================
Linux Android App cheat sheet:
https://play.google.com/store/apps/details?id=com.LinuxMobileKit

Free Android Apps:

Click on links below to find out more:

https://play.google.com/store/apps/details?id=soulrefresh.beautiful.prayer

Catholic Rosary Guide  for Android:

h…

Linux copy or backup files to remote machine

Copying or backing up files to the remote machine is a good practice if hard disk space is not a concern.
Having a backup on the same machine is like the old saying "putting eggs in one basket".
Backing up data on another machine would simply eradicate the worries of losing data provided that the backup is really a backup.
Backup should be tested as often as possible.
Backup is for disaster recovery and it should be able to cover the disaster and not add a burden.
In Linux "tar" is a good old tool which does a pretty awesome job to backup or copy files.
TAR - tape archiver, as the name implies it is designed for tape backup.
To automate backup using “cron” scheduler, "tar" is a good choice since it will only require the 'user name', 'remote machine IP address or hostname' and the path on the remote machine where the file should be copied.
Once the above requirements are known, tar will be able to copy to the remote machine and will not as…

Windows delete files in all directories

Deleting files are good and bad.
It is good to delete files because it will tidy up your computer, get rid of unwanted or outdated files and free up space on the drive.
It is bad to delete file or files if no backup is available and the data is of great importance.
So deleting files should be done carefully and cautiously to make sure that deleted data will not be needed anymore.
How to delete files automatically in all folders and subfolders?
The batch file will come handy to automate file deletion.
Below is an example that deletes files on the temp folder for any “dll” files.
This can be applied to any folder path but don't do this on the c:\windows folder or the system will be completely unusable.
Open a command prompt and copy and paste the commands below or save it to notepad and run the script as a batch file.
C:\Users\\AppData\Local\Temp>FOR /f "tokens=*" %a in ('dir *.dll/B /S') DO del %a
Above command will find all the “.dll” files on the temp folder …

Linux copy or move files with xargs

Copying or moving files via terminal or command line are quite easy and basic.
Working remotely in Linux can be done by typing via terminal and executing commands.
Typing the same commands all over again is not quite practical, so a lazy admin comes into play.
Lazy admin doesn't literally mean a lazy admin, but a guy who likes to automate things by using his knowledge and skills like scripting.
Crontab in Linux is a scheduler to automate and run scripts at a specified time.
Crontab is powerful if the script and the settings are configured properly; it will do the task without user intervention.
Some basic commands below to move or copy files and pipe to "xargs" command.
By typing: ls *.log this will filter the output for files with ".log" extension.
     ls *.log | mv $(xargs) /path/another_folder

Move Recursively:


    find  /path/log_folder/ -type f -name '*.log' | mv  $(xargs) /path/another_folder/

If filenames are the same files command will prompt to…