1.查看linux系统位数
getconf LONG_BIT
2.查找文件
find / -name httpd.conf --查找文件名为httpd.conf的文件httpd.conf的文件
whereis httpd.conf
3.创建用户
useradd test
4.修改密码
passwd test
5.linux清屏
clear
ctrl+l
6.更改文件夹及子目录所有者为es、更改文件夹及子目录组为es
chown -R es elasticsearch
chgrp -R es elasticsearch
简略写法:chown -R es:es elasticsearch
7.查看端口占用情况
lsof -i:9200
netstat -ntlp
8.软链接
ln -s /usr/local/elasticsearch-1.7.1/ /usr/local/elasticsearch
9.查看本机关于IPTABLES的设置情况
iptables -L -n
systemctl status firewalld查看当前防火墙状态
systemctl start firewalld启动防火墙
systemctl stop firewalld关闭防火墙
10.开放端口
--CentOS Linux release 7
sudo firewall-cmd --zone=public --add-port=9200/tcp --permanent
sudo firewall-cmd --reload
--CentOS Linux release 6
(1)LINUX下通过命令开启允许对外访问的网络端口:
/sbin/iptables -I INPUT -p tcp --dport 8080 -j ACCEPT #开启8080端口
/etc/rc.d/init.d/iptables save #保存配置
/etc/rc.d/init.d/iptables restart #重启服务
(2)查看端口是否开放
/etc/init.d/iptables status
11.查看linux版本
more /etc/issue
cat /etc/redhat-release
12.插件安装
/usr/local/elasticsearch/bin/plugin install mobz/elasticsearch-head
13.复制文件到指定位置
sz elasticsearch.yml --选择存放位置
rz -y --选择要复制的文件
14.查看SELinux状态:
(1)/usr/sbin/sestatus -v ##如果SELinux status参数为enabled即为开启状态
SELinux status: enabled
(2)getenforce ##也可以用这个命令检查
关闭SELinux:
(1)临时关闭(不用重启机器):
setenforce 0 ##设置SELinux 成为permissive模式
##setenforce 1 设置SELinux 成为enforcing模式
(2)修改配置文件需要重启机器:
修改/etc/selinux/config 文件
将SELINUX=enforcing改为SELINUX=disabled
重启机器即可
15. 重命名文件
mv CentOS-Base.repo rhel-debuginfo.repo
16.文件复制
(1)复制源文件test1下的test01文件,目标目录为test2。
直接可以用: cp /TEST/test1/test01 /TEST/test2
(2)复制整个文件夹
可以用cp -r /TEST/test1/* /TEST/test2
scp:不同服务器间的拷贝
从 本地 复制到 远程
scp /home/daisy/full.tar.gz root@172.19.2.75:/home/root (然后会提示你输入另外那台172.19.2.75主机的root用户的登录密码,接着就开始copy了),复制目录加参数 -r 即可
从 远程 复制到 本地
scp root@/172.19.2.75:/home/root/full.tar.gz /home/daisy/full.tar.gz
17.硬件时钟与系统时钟同步
# hwclock --hctosys 或者 # clock --hctosys hc代表硬件时间,sys代表系统时间,即用硬件时钟同步系统时钟
18.修改时间
date命令将日期设置为2014年6月18日
---- date -s 06/18/14
将时间设置为14点20分50秒
---- date -s 14:20:50
将时间设置为2014年6月18日14点16分30秒(MMDDhhmmYYYY.ss)
----date 0618141614.30
19.设置快捷命令
vi ~/.bashrc alias=?
例如:alias rm='rm -i'
source ~/.bashrc立即生效