[root@root ~]# cat /etc/redhat-release CentOS release 6.5 (Final)
[root@root ~]# uname -r 2.6.32-431.el6.x86_64
[root@root ~]# runlevel N 3
[root@root ~]# vim /etc/hostname [root@root ~]# cat /etc/hostname ywb [root@root ~]# reboot [root@ywb ~]#
[root@root ~]# hostnamectl set-hostname ywb [root@root ~]# bash [root@ywb ~]#
[root@yangqwnbo ~]# hostname -I 192.168.200.54
[root@root /]# stat -c %a yangwenbo 644
[root@root /]# stat -c %A yangwenbo -rw-r--r--
[root@root /]# yunwei=yangwenbo [root@root /]# echo $yunwei yangwenbo
[root@root /]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg_root-lv_root 18G 1.1G 16G 7% / tmpfs 491M 0 491M 0% /dev/shm /dev/sda1 485M 33M 427M 8% /boot
[root@root /]# who root tty1 2018-07-27 05:42 root pts/0 2018-07-27 05:43 (192.168.200.1)
[root@root /]# whoami root
[root@yangwenbo /]# awk --version GNU Awk 3.1.7 Copyright (C) 1989, 1991-2009 Free Software Foundation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
[root@yangwenbo etc]# echo "`hostname -I` www.baidu.com" >> /etc/hosts [root@yangwenbo etc]# ping www.baidu.com PING www.baidu.com (192.168.200.54) 56(84) bytes of data. 64 bytes from www.baidu.com (192.168.200.54): icmp_seq=1 ttl=64 time=0.024 ms 64 bytes from www.baidu.com (192.168.200.54): icmp_seq=2 ttl=64 time=0.051 ms 64 bytes from www.baidu.com (192.168.200.54): icmp_seq=3 ttl=64 time=0.072 ms ^C --- www.baidu.com ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2326ms rtt min/avg/max/mdev = 0.024/0.049/0.072/0.019 ms [root@yangwenbo etc]# cat /etc/hosts | tail -1 `192.168.200.54` www.baidu.com
/etc/resolv.conf
DNS客戶機配置文件,用於設置DNS服務器的IP地址及DNS域名,還包含了主機的域名搜索順序。該文件是由域名解析器(resolver,一個根據主機名解析IP地址的庫)使用的配置文件。node
[root@yangwenbo etc]# cat /etc/resolv.conf ; generated by /sbin/dhclient-script search localdomain nameserver 192.168.200.1
虛擬機中NET
設置列表
linux
pstree
進程樹aux
專門查看cpu
和內存find
找head
和tail
的使用wc -l
的使用rpm
安裝程序rpm -q
精確查找某個安裝包是否安裝rpm -qi
查看安裝包的詳細信息rpm -qa
查看全部已裝安裝包表rpm -ivh
安裝包名字: 安裝某個安裝包rpm -e
安裝包名字 強行卸載某個安裝包gzip
壓縮文件tar
文件打包chkconfig
Linux
中有兩個特殊文件:黑洞文件與無限流
/dev/null
:黑洞文件,不論什麼文件內容被重定向到這個文件裏,內容都消失了。/dev/zero
:無限數據流文件,不論你從多大的數據都能取得出來,然而取出來的數據沒有任何內容顯示,就是純粹的佔大小。
舉例:
git
ps
與kill
pstree
進程樹ps aux
專門查看cpu
和內存kill
kill
根據pid殺pkill
killall
根據服務名殺
- 保護帳號信息的兩個重要路徑:
/etc/passwd
與/etc/shadow
- 保護組帳號信息的兩個重要路徑:
/etc/group
與/etc/gshadow
vim
用戶名/bin/bash
改爲/sbin/nologin
source /etc/passwd
(即時生效)
- 在Linux中,規定目錄最高權限爲777,文件最高權限爲666
- 當umask的值爲0022時,
- 目錄的默認最高權限爲(777—022=)755
- 文件的默認最高權限爲(666—022=)644
chmod
修改目錄或文件的權限chown
修改屬主或屬組lsattr
命令的使用i
鎖i
鎖i
鎖a
鎖a
鎖a
鎖a
鎖原理su
與sudo
su
命令的使用sudo
命令的使用使用
visudo
命令進入編輯redis
inode
號的軟,硬連接inode
號與Block
inode
號的軟連接inode
號的硬連接