» Linux の記事

~ wget and grep the json key value ~

connie 2017.08.30 | Linux | | No Comments

# wget -qO- http://freegeoip.net/json/
{“ip”:”8.8.8.8″,”country_code”:”HK”,”country_name”:”Hong Kong”,”region_code”:””,”region_name”:””,”city”:”San Po Kong”,”zip_code”:””,”time_zone”:”Asia/Hong_Kong”,”latitude”:11.11,”longitude”:11.11,”metro_code”:0}

# wget -qO- http://freegeoip.net/json/ | grep -Po ‘(?<=”ip”:”)[^”]*’
8.8.8.8

~ linux shellscript cannot executed ~

connie 2016.11.17 | Linux | | No Comments

因為coding 問題,另shellscript 不能正確運行DOS format VS UNIX

qq%e6%88%aa%e5%9c%9620161117161746

apt-get install dos2unix
dos2unix file.sh

 

~ Hosts file location ~

connie 2016.10.20 | Linux | | No Comments

Win7
C:\Windows\System32\drivers\etc
linux
/etc/hosts

~ use Find 來找linux 內的file ~

connie 2013.01.09 | Linux | | No Comments

linux command 搵folder 入面 jpg,png,gif 以外的files
假設要找尋的folder 為 /var/www 的所有file

find . ! -name '*.jpg' ! -name '*.png' ! -name '*.gif'

 

~ Linux Check login ~

connie 2013.01.03 | Linux | | No Comments

To show users who are logged in to the system

who

To show the list of users who have logged in last

last

To show the list of all reboots

last reboot

To print the content of the last login log from /var/log/lastlog

lastlog

To List out the login history for certain acc

last [username]

 

~ VI 常用 command ~

connie 2012.12.17 | Linux | | No Comments

有時有d server 無nano , 唯有用VI

Shift + g 頁尾
:wq save
i Insert mode
ESC 出返insert mode
:q! quit without save

 

| HOME |