2014年7月15日 星期二

網路查詢command

用 arp -a 來從 mac 查 ip
再用 nbtstat -A ip 來從 ip 查電腦名稱
netstat -an 指令查 電腦有那些Port有被開啟

Grep For Windows – Findstr Example

在windows上使用grep,我覺得蠻實用的。
這是轉貼的文章,為了怕不見,我自己另外留一份copy.
http://www.mkyong.com/linux/grep-for-windows-findstr-example/



I love grep command on Linux, it helped to search and filter strings easily, always wonder what is the equivalent tool on Windows, and found this findstr recently.
In this article, I will share some of my favorite “grep” examples on Linux, and how to “port” it to Windows with “findstr” command.

1. Filter a result

1.1 Classic example to filter a listing result.
#Linux
$ ls -ls | grep mkyong
 
#Windows
c:\> dir | findstr mkyong
1.2 Add ignore case, and filter the listing result with multiple strings.
#Linux - Need '-E' option and Uses "|" to separate multiple search strings.
$ ls -ls | grep -iE "mkyong|music"
 
#Windows - Use spaces to separate multiple search strings
c:\> dir | findstr -i "mkyong music"
2. Search a File
2.1 Search matched string in a file.
#Linux 
$ grep mkyong test.txt
 
#Windows
c:\> findstr mkyong test.txt
2.2 Counting the number of matches.
#Linux
$ grep -c mkyong test.txt
 
#Windows - Piped with find /c command.
c:\> findstr -N "mkyong" test.txt | find /c ":"

3. Search a list of files

3.1 Search matched string in a list of files.
#Linux
$ grep mkyong -lr /path/folder
 
#Windows
c:\> findstr /M mkyong c:\folder\*
* (grep) -l , (findstr) /M = print only name of files containing matches.

4. Help

4.1 The most powerful command ~
#Linux 
$ grep --help 
$ man grep 
 
#Windows
c:\> findstr -?
Note
Do you have other examples? Does share it below, thanks.

References

  1. 15 Practical Grep Command Examples In Linux / UNIX
  2. Wikipedia : Findstr
  3. Grep for Windows Using FINDSTR




如何在Windows的事件檢視器event viewer,查詢開機關機的紀錄

Windows 如何 事件檢視器 查詢開機關機紀錄 Step1: 打開windows的 「 事件檢視器 」,開啟「 建立自訂檢視… 」視窗,在「事件記錄檔」選項,將「Windows 紀錄」內勾選「系統」選項。 Step2: 內含/排除事件識別碼: 」排除事件識別碼打「6005,6...