[root@localhost ~]#
[用户名@主机名 ~]#rm -f /tmp
/
开始|
mkdir -p /old/data/test
:wq
:q!
:set nu
cat -n 文件名
echo "字符串"
echo "chuan.edu.com" >> /data/chuan.txt
echo "chuan.com" > /data/chuan.txt
cp 原文件 目的目录
cp 原文件 原文件.bak
mv 原文件 目的目录
cp 原文件 新文件
rm 文件
find 寻找目录范围 -type f -name "文件名"
find / -type f -name "chuan.txt"
find /data -type f -name "*.txt"
+1M
表示大于1Mb,-1K
表示小于1Kbfind 寻找目录范围 -type d -name "目录名"
find / -type d -name "data"
find /root/ -type d -name "*.log" |xargs ls -l
find / -name "rabbitmq" -type d 2>/dev/null
seq 40 > ett.txt
awk 'NR==20' test.txt
awk 'NR>=20 && NR<=30' ett.txt
awk 'NR<5 || NR>35' ett.txt
准备数据
mkdir -p /chuan/test
cd /chuan
echo "chuan">test/del.sh
echo "chuan">test.sh
echo "chuan">t.sh
touch chuan.txt
touch alex.txt
sed 's#[a-zA-A]#SO#g' t.sh
sed -i.bak 's#[a-zA-A]#oldgirl#g' t.sh
find /chuan/ -type f -name "*.sh" |xargs sed 's#chuan#newgirl#g'
find /chuan/ -type f -name "*.sh" |xargs sed -i 's#chuan#newgirl#g'
find /chuan/ -type f -name "*.sh" |xargs cat
tar zcf /tmp/etc.tar.gz /etc/
tar tf etc.tar.gz
tar xf etc.tar.gz
yum install tree telnet -y
rpm -qa tree
rpm -qa tree telnet lrzsz
rpm -ql 命令名
rpm -ivh rpm包路径
./congigure
,可以在这里配置各种参数make
make install
ls -l /dev/cdrom
mount /dev/cdrom /mnt/
cd /mnt/
rpm -ivh /mnt/Packages/telnet-0.17-48.el6.x86_64.rpm
df -h
head /etc/passwd
head -5 /etc/passwd
,前五行tail /etc/passwd
tail -5 /etc/passwd
,后五行安装的命令不在三大基本仓库
[root@chuan ~]# yum install sl cowsay -y
Loaded plugins: fastestmirror, security
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.163.com
* updates: mirrors.nwsuaf.edu.cn
No package sl available.
No package cowsay available.
Error: Nothing to do
yum install epel-release -y
yum install sl cowsay -y
sl
cowsay "hello world"
/etc/init.d/iptables stop
chkconfig
chkconfig |grep iptables
chkconfig iptables off
runlevel
/etc/inittab
文件最后tail -1 /etc/inittab
cat /etc/redhat-release
uname -r
useradd chuan
id chuan
passwd chuan
su - chuan
whoami
shutdown -r 10
resuce installed system
ll /etc/selinux/config
sed 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config
sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config
vim /etc/selinux/config
getenforce
setenforce 0
分钟 小时 日期 月份 周几 执行命令
*
表示每次,* * * * *
表示每天每时每分执行一次*/n
,表示每隔n(分钟/小时/天)执行crontab -e
* * * * * echo chuck >> /tmp/chuan.txt
tail -f /tmp/chuan.txt
/usr/sbin/ntpdate ntp1.aliyun.com
date -s "20100101"
crontab -e
*/3 * * * * /usr/sbin/ntpdate ntp1.aliyun.com
date
,tail /var/log/cron
ls -l /var/log/cron
(root) CMD (echo chuck >> /tmp/chuan.txt)
You have mail in /var/spool/mail/root
*/3 * * * * /usr/sbin/ntpdate ntp1.aliyun.com > /dev/null 2>&1
*/3 * * * * /usr/sbin/ntpdate ntp1.aliyun.com > /dev/cron.log 2>&1
date
date -s "20180101"
/usr/sbin/btpdate ntp1.aliyun.com