2018年7月24日 星期二

bash: cannot create temp file for here-document: No space left on device

於終端機上按tab (auto-complete)出現下列錯誤:
bash: cannot create temp file for here-document: No space left on device

[root@localhost bin]# df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root   44G   44G   20K 100% /
devtmpfs                 3.9G     0  3.9G   0% /dev
tmpfs                    3.9G     0  3.9G   0% /dev/shm
tmpfs                    3.9G  420M  3.5G  11% /run
tmpfs                    3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/sda1               1014M  226M  789M  23% /boot
tmpfs                    783M   12K  783M   1% /run/user/42
tmpfs                    783M     0  783M   0% /run/user/0
tmpfs                    783M     0  783M   0% /run/user/1000

HDD滿載了

ANS:

1.使用命令df -h 檢查磁碟狀況

2.使用命令du -h --max-depth=1 /var/log/* 檢查/var/log下檔案的大小

3.使用命令du -sh /* 一層一層檢查檔案大小

2018年3月31日 星期六

Linux using proxy


====CentOS yum using proxy====
#vi /etc/yum.conf
proxy http://proxy-server-ip:port

====Ubuntu 16.04 apt using proxy====
#vi /etc/apt/apt.conf
Acquire::http::Proxy "http://proxy-server-ip::8080";


====git using proxy====
git config http.proxy http://proxy.server:port
git config http.proxy http://myusername:mypassword@proxy.server:port

git config --global http.proxy http://proxy.server:port

====wget using proxy====
~/.wgetrc
use_proxy = on
http_proxy =  http://username:password@proxy.server.address:port/
https_proxy =  http://username:password@proxy.server.address:port/

ftp_proxy =  http://username:password@proxy.server.address:port/

2018年3月30日 星期五

Check PowerShell version

PS E:\> get-host


Name             : ConsoleHost
Version          : 5.1.14393.1944
InstanceId       : 0a7a283a-5bed-4c0a-8853-3517117e5814
UI               : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture   : en-US
CurrentUICulture : en-US
PrivateData      : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
DebuggerEnabled  : True
IsRunspacePushed : False
Runspace         : System.Management.Automation.Runspaces.LocalRunspace


PS E:\> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.14393.1944
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.14393.1944
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1


PS E:\> $host.Version

Major  Minor  Build  Revision
-----  -----  -----  --------
5      1      14393  1944


PS E:\> $PSVersionTable.PSVersion

Major  Minor  Build  Revision
-----  -----  -----  --------
5      1      14393  1944

2018年3月26日 星期一

Get IP Address at CentOS 7


ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1  -d'/'

ip -f inet a show eth0| grep inet| awk '{ print $2}' | cut -d/ -f1