Skip to main content

Posts

Showing posts from April, 2015

Sort running process using command line

In Linux, grep can be used to sort running processes via the terminal or command line. It can easily be done by typing ps ax then pipe grep and the filter parameters. Example: ps ax | grep "mail*" It will search for any proccess that its name starts with mail. In Windows sorting running processes can also be done using command line. Using the command prompt window, by typing "tasklist" the command will show all running process or services. Depends on your environment and running processes working on the background, it will either show more or less output. To sort the output, it needs to pipe tasklist output to another command which is "findstr.exe". Type this command below on the command prompt window to sort the output. tasklist | findstr /b "c" It will sort the tasklist output for any running processes that starts with letter "c", like chrome.exe cmd.exe, csrss.exe etc. If need to...

Windows export firewall policy

Use netsh in Windows 7 to export firewall policy using command line. Open an elevated command prompt and type the netshell command below. netsh advfirewall export d:\myfirewall.txt If everything works fine it will display "Ok." It's exported using a filename with ".txt" extension, but the output is not readable using any text editor. You can save the file to a USB drive as a backup or import the firewall policy to another computer. To import the exported firewall policy use this command: netsh advfirewall import d:\myfirewall.txt Just replace the word export with "import" and specified the path location of the file. A very simple way to export firewall policies. If you want to dig further check out Technet link below: https://technet.microsoft.com/en-us/library/cc770887%28v=ws.10%29.aspx If you don't like doing it using command line, exporting firewall policy can also be done using GUI. Open "Windows Firewall wi...

Send email using vb.net

A quick code snippet to send email using VB.Net, works fine in VS 2010. my_email_address@myEmail.com - this is the email account that will be used to send out email My_SimplE_PassW@rd - password of the email account that is used to send out the email my_recipient@Recipient_email.com - the recipient of the email or the person who will receive the email SmtpServer.Port = 25 – change this port number if the email server blocks port 25 SmtpServer.Host = "mail.my_server_name" – change to the email server name or ask your email administrator Try             Dim SmtpServer As New SmtpClient()             Dim mail As New MailMessage()             SmtpServer.Credentials = New   _             Net.NetworkCredential("my_email_address@...

Get total copy time of Rsync

  Prefix the “rsync” command with the “time” command. It would be useful to estimate total time to transfer or backup files and folders to another server or other storage device. Example: time rsync -av C20150416T025057Z.zip "/media/MyBackup"   Sample output: time rsync -av C20150416T025057Z.zip "/media/MyBackup" sending incremental file list C20150416T025057Z.zip sent 2146220138 bytes   received 31 bytes   18422490.72 bytes/sec total size is 2145958091   speedup is 1.00 real 1m56.548s user 0m25.358s sys 0m15.137s The "real" time is will display the accumulated time once the whole process is done. If a log file is used in conjunction with the rsync command, the log file would be very large and it might slow down the copying process. Since it will log a  file, then copy a file so two process are executed one after the other. Every file being copied will be appended to the log file. Anyway, if y...

Change drive letter using command line

If you are scared using command line changing drive letter can be done via GUI using the disk management tools interface. If you are command line junkie, in Windows 7 or Windows 8 to change drive letter using command line is quite straight forward as well. And one advantage of using command line if you need to change one or more computers, you don't need to disturb the user or visit the workstation. Scripting using command line will automate the process. To change using command line, open an elevated command prompt and type: diskpart On diskpart window, type: list volume and press enter List volume will show all the volume available on the computer. Select the volume you wish to change the drive letter. Select volume 0 and press enter Above command will select volume 0. To changed drive letter of volume 0. Type this command: Assign Letter=B and press enter Assign letter=b, is quite straight forward command. It will assig...

How to mount NFS shares in Linux

To mount NFS shares in Linux such as NAS NFS shares, Linux NFS shares or other devices which supports NFS sharing. This example command below I used to mount an NFS share from a NAS device. Of course you need to check whether your NAS device supports NFS, you can check this from the admin panel of the NAS device. Consult the manual of your device or visit manufacturer's website. 1. First is to configure NAS which folder to be shared using NFS 2. Set options whether the NFS share would be a read only share or read and write. 3. Once everything is setup on the NAS.    - On the Linux box type this command below: showmount -e 192.168.1.7 change the IP Address to the IP Address of NAS device or the IP Address which has NFS shares. From my environment it has this output: Export list for 192.168.1.7: /c/backup    * /c/Videos (everyone) The output of showmount -e IP.Address basically shows NFS shares. If the output ...