LINUX

netstat -lntu

as replied by @askmish will give you list of services running on your system on tcp and udp ports where

  • -l = only services which are listening on some port
  • -n = show port number, don’t try to resolve the service name
  • -t = tcp ports
  • -u = udp ports
  • -p = name of the program

You don’t need the ‘p’ parameter as you’re only interested in getting which ports are free and not which program is running on it.

This only shows which ports on your system are used up, though. This doesn’t tell you the status of your network e.g. if you’re behind NAT and you want some services to be accessible from outside. Or if the firewall is blocking the port for outside visitors. In that case, nmap comes to the rescue. WARNING: Use nmap only on networks which are under your control. Also, there are firewall rules which can block nmap pings, you’ll have to fiddle around with options to get correct results.

2016.09.27 更新
netstat -peanut 用这个参数更可以列出是哪个程序在占用哪个端口

Windows

netstat -ano 可以直接列出PID,然后到任务管理器里面可以根据PID查看是哪个程序。

Key/Symbol Explanation
Windows PC keyboards have a Windows key that looks like a four-pane window
Command Apple Mac computers have a command key.
Menu PC keyboards also have a Menu key that looks like an cursor pointing to a menu.
Esc Esc (Escape) key
F1 – F12 Information about the F1 through F12 keyboard keys.
F13 – F24 Information about the F13 through F24 keyboard keys.
Tab Tab key
Caps lock Caps lock key
Shift Shift key
Ctrl Ctrl (Control) key
Fn Fn (Function) key
Alt Alt (Alternate) key (PC Only; Mac users have Option key)
Spacebar Spacebar key
Arrows Up, Down, Left, Right Arrow keys
Back Space Back space (or Backspace) key
Delete Delete or Del key
Enter Enter key
Prt Scrn Print screen key
Scroll lock Scroll lock key
Pause Pause key
Break Break key
Insert Insert key
Home Home key
Page up Page up or pg up key
Page down Page down or pg dn key
End End key
Num Lock Num Lock key
~ Tilde
` Acute, Back quote, grave, grave accent, left quote, open quote, or a push
! Exclamation mark, Exclamation point, or Bang
@ Ampersat, Arobase, Asperand, At, or At symbol
# Octothorpe, Number, Pound, sharp, or Hash
£ Pounds Sterling or Pound symbol
Euro
$ Dollar sign or generic currency
¢ Cent sign
¥ Chinese/Japenese Yuan
§ Micro or Section
% Percent
° Degree
^ Caret or Circumflex
& Ampersand, Epershand, or And
* Asterisk and sometimes referred to as star.
( Open parenthesis
) Close parenthesis
Hyphen, Minus or Dash
_ Underscore
+ Plus
= Equal
{ Open Brace, squiggly brackets, or curly bracket
} Close Brace, squiggly brackets, or curly bracket
[ Open bracket
] Closed bracket
| Pipe, Or, or Vertical bar
\ Backslash or Reverse Solidus
/ Forward slash, Solidus, Virgule, or Whack
: Colon
; Semicolon
Quote, Quotation mark, or Inverted commas
Apostrophe or Single Quote
Less Than or Angle brackets
Greater Than or Angle brackets
, Comma
. Period, dot or Full Stop
? Question Mark

现在的笔记本、台式机,都不用BIOS,改成用UEFI了。

想要体验下UEFI但又不想在搞砸自己的系统咋办?

当然是在免费的VMWARE PLAYER里面使用UEFI了!

但是UEFI默认在VMWARE PLAYER里面是关闭的。这个时候就需要使用这个OpenSource的工具了:

VM_TWEAKER

vmtweaker

打开这个Enable “efi” BIOS boot type,你就可以体验UEFI了。

 

最近在Ubuntu上安装LAMP,并假设Wordpress。发现权限无论怎么设,除非设置为执行Apache的用户,才能避开这个问题。

弄了半天,最后发现在wp-config.php里面加入这句话可以解决这个问题:

define('FS_METHOD', 'direct');

在安装完Win10以后,才发现居然没有打开硬盘的AHCI模式。怎么办?

别急,其实很简单。不用重装Win10的。照下面步骤来就行。

  1. 管理员权限打开命令提示符
  2. 使用这个命令打开启动自动进入安全模式:
    bcdedit /set {current} safeboot minimal
  3. 重启电脑进入BIOS
  4. 更改硬盘工作模式为AHCI,保存退出
  5. Win10会以安全模式启动
  6. 在安全模式下用管理员权限打开命令提示符窗口
  7. 执行如下命令关闭启动自动进入安全模式
    bcdedit /deletevalue {current} safeboot
  8. 重启电脑以正常模式进入Win10
  9. Duang~成功!

如下命令

grep -rnw '/path/to/somewhere/' -e "pattern"

-r 或者 -R 为递归查找, -n 是行号 -w 为要求全匹配. -l (小写L) 参数可以只列出文件名.

除此以外, –exclude 或者 –include 参数可以提供更有效的查找。比如:

grep --include=\*.{c,h} -rnw '/path/to/somewhere/' -e "pattern"

这个可以查找扩展名为.c或者.h的文件. –exclude的用法也类似:

grep --exclude=*.o -rnw '/path/to/somewhere/' -e "pattern"

上面这行命令在搜索中会排除扩展名为.0的文件。和包含/不包含文件一样,目录也可以使用 –exclude-dir 和 –include-dir 参数。 比如下面列出怎么使用 –exclude-dir:

grep --exclude-dir={dir1,dir2,*.dst} -rnw '/path/to/somewhere/' -e "pattern"

如果单是遍历查找文件的话可以用

find . -name '*.xml'

如果想遍历删除某种类型的文件的话,可以用

 find . -name '*.xml' -type f -delete

很多喜欢Win7,Win8的朋友正在经受着整天提示升级Win10的骚扰。就是不升,怎么着~哈哈

那怎样去掉这个恼人的提示呢?

卸载KB3035583,然后选择忽略此更新。

Done

If you are using a wired connection on your PC or using a USB connection with your 3G or 4G LTE dongle, you can share this connection to other devices. This means you can connect other smartphones, tablets and even laptops to this connection by creating aportable wireless hotspot on Windows 10. There is no direct UI to create the hotspot, but you can easily do it using few commands.

In this article, we will show you how to get started in creating a wireless hotspot in Windows 10.

To get started, right click on the Windows start button and click Command prompt (admin). This will open the command prompt in administrator mode.

Now type the following command;

netsh wlan set hostednetwork mode=allow ssid=AdHoc key=password

In the above command, you can add your own value for SSID and enter your key. Now press enter.

Now to start the network, type the below command;

netsh wlan start hostednetwork

Now that ad-hoc connection is created with passkey, you need to share the existing connection.

Once the hosted network is enabled, you can see MyWiFi connection listed in the network and sharing center. Now the network needs an internet connection and for this, you need to share the existing active Internet connection. Right click on your existing internet connection and select properties.

Now select the Sharing tab in properties. Check the box against “Allow other network users to connect through this computer’s internet connection”. Then select the newly created Wi-fi connection from the drop down list. Now save the details and close the properties.

Now you can see Internet available on the new hotspot connection created.

In case you want to stop the hosted network, use this command;

netsh wlan stop hostednetwork

If you find this method difficult, you can probably use tools like Virtual Hotspot,Connectify or mHotspot.

Ref: http://www.nirmaltv.com/2015/08/18/how-to-create-a-wi-fi-hotspot-in-windows-10/