标签:linux运维之道
pwd -p 返回链接的真实路径
cd /usr/src
cd ..
cd -
cd 家
ls -al
ls -ld /root
ls -lt
cp /etc/hosts /tmp/host
cp -r /var/log/ /tmp
find -name hello.doc
find /root-name "*.log"
find -iname "Jacob"
find / -empty
find / -group tom
find / -mtime -3
find / -mtime +4
find / -mtime 2
find ./ -size +10M
find ./ -type f
find ./ -user tom
find ./ -size +1M -exec ls -l {} \;
find / -size +1M -a -type f
du -sh
cat -n /etc/passwd
cat -b /etc/passwd
head -c 20k /root/install.log
tail -f /var/log/messages
wc -l
-w
-c
grep --color th test.txt
grep -i the test.txt
grep -w num test.txt
grep -v the test.txt
echo "hello world."
echo -e "\\"
\\
\n
\t
ln -s /test/ /var/test/
ln /test/hello.txt /test/hi.txt
gzip hell.txt
gzip -d hello.txt.gz
bzip2 hello.txt
bzip2 -d hello.txt.bz2
tar -cf etc.tar /etc
tar -czf boot.tar.gz /boot
tar -cjf etc.tar.bz2
tar -tvf boot.tar.gz
tar -xvf etc.tar
tar -xzf boot.tar.gz
tar -xjf etc.tar.bz2
tar -xzf boot.tar.gz -C /tmp
history
!500
ctrl+l clear
which find
vim编辑
a A
i I
o O
gg
G
nG
^ $
w b
x
dd
ndd
rx
yy
p
P
/host n N
:s/root/admin/
:s/root/admin/g
:3,5s/root/admin/g
:%s/nologin/fault/g
:set nu
:split
ctrl+w +l
+j
:vsplit
ctrl+w+h
+l
useradd -c administartor -d /home/admin -e 2013-12-24 \
-g root -G bin,adm,mail admin
useradd -s /sbin/nologin -M user2
groupadd -g 1000 jerry
id root
echo "123456" | passwd --stdin tom
passwd -l tom
passwd -u tom
passwd -d tom
usermod -d /home/tom tom #/home/tom存在
usermod -e 2013-12-24 tom
usermod -g mail tom
usermod -s /bin/bash tom
usermod -u 1001 tom
userdel -r tom
groupdel jerry
chmod a=rw install.log
chmod a+x install.log
chmod 644 install.log
chmod --reference=install.log.syslog install.log
chown :root install
账户管理案例
mkdir -p /var/{teach,office}
groupadd teach
groupadd office
useradd -g teach Op_teach
useradd -g office Op_office
useradd -g teach endy
useradd -g office lucy
gpasswd -A Op_teach teach
gpasswd -A Op_office office
chmod Op_teach.teach /var/teach
chmod Op_office.office /var/office
chmod 755 /var/{teach.office}
fdisk -l
fdisk /dev/sda
partprobe /dev/sda
mkfs.ext4 /dev/sdc1
mkswap /dev/sdc2
mount /dev/cdrom /media
umount /dev/cdrom
vim /etc/fstab
mount -a
创建RAID
(fdisk fd )
mdadm -C /dev/md0 -l 0 -n 3 /dev/sdb1 /dev/sdc1 /dev/sdd1
mdadm -C /dev/md5 -l 5 -n 3 -x 1 /dev/sdb2 /dev/sdc2 /dev/sdd2 /dev/sde2
mdadm --detail /dev/md0
mdadm --detail /dev/md5
mkfs.ext4 /dev/md0
echo "DEVICE /dev/sdb1 /dev/sdb2 /dev/sdc1 /dev/sdc2 /dev/sdd1 /dev/sdd2 /dev/sde2" > /etc/mdadm.conf
mdadm -Evs >> /dev/mdadm.conf
echo "/dev/md0 /raid0 ext4 defaults 0 0 " >>/etc/fstab
echo "/dev/md0 /raid0 ext4 defaults 0 0 " >>/etc/fstab
time dd if=/dev/zero of=txt bs=1M count=1000
rpm -ivh ftp-0.17-51.1.el6.x86_64.rpm
rpm -e ftp
rpm -q ftp
rpm -aq
rpm -qi bash
rpm -ql bash
rpm -qc bash
rpm -qf /etc/inittab
rpm -qpi ftp-0.xxxxxxxxxxxx.rpm
/etc/yum.repos.d/media.repo
[media]
name=CentOS=6.7
baseurl=file:///media/CentOS-6.3_Final
enable=1
gpgcheck=0
gpgkey=
yum install dialog
yum -y expect
yum remove dialog
yum list
yum clean all
yum grouplist
yum groupintall "chinese support"
yum -y intall gcc pcre pcre-devel libtool
tar -xjf httpd-2.2.23.tar.bz2 -C /usr/src/
tar -xzf apr-1.4.6.tar.gz -C /usr/src
cd /usr/src/apr-1.4.6/
./configure && make && make install
cd /usr/src/apr-util-1.5.1
./configure --with-apr=/usr/local/apr
make && make install
...
/usr/local/apache2/bin/apachectl start
date -s "2012-11-12 14:00"
hwclock -w
service sshd reload
chkconfig --list
chkconfig --list sshd
chkconfig --level 15 sshd off
chkconfig sshd on
service atd start
at 23:11
tar -cjf log.tar.bz2 /var/log
shutdown -h now
at -l
at -c 1
at -d 1
service crond start
chkconfig crond on
crontab -e
23 23 * *5 tar -czf log.tar.gz /var/log
00 */3 * * * who
crontab -l
crontab -r
/etc/cron.d
/etc/cron.hourly
/etc/cron.daily
/etc/cron.weekly
uptime
free [-b|-k|-m]
df -hT
df -i
ifconfig
netstat -nutlp
ps -e
ps -ef
top
M 内存 N PID z 高亮
top -d 1 -p 1,2
ifconfig eth0 192.168.0.31 netmask 255.255.255.0
ifconfig eth0 down
ifconfig eth0 up
hostname
hostname centos.example.com
hostname -i
route
route -n
route add default gw 192.168.0.254
route add -net 172.16.0.0/16 gw 192.168.0.254
route add -net 192.56.76.0 netmask 255.255.255.0 dev eth0
route del default gw 192.168.0.254
route del -net 172.16.0.0/16
cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="
BOOTPROTO="static"
HWADDR="
NM_CONTROLLED=“
ONBOOT="
TYPE="
IPADDR="192.168
PREFIX="24"
GATEWAY="192.168.0.254"
DNS1="202.106.46.151"
service network restart
vim /etc/sysconfig/network-scripts/route-eth0
service network restart
ping
traceroute
traceroute -I www.google.com
nslookup www.google.com
dig www.google.com
netstat -an
netstat -nutlp
/lib/modules/`uname -r`/
lsmod
modprobe ip_vs
lsmod | grep ip_vs
modprobe -r ip_vs
modinfo ip_vs
echo "modprobe ip_vs" >> /etc/rc.sysinit
echo "1" > /proc/sys/net/ipv4/ip_forward
echo "1" > /proc/sys/net/ipv4/icmp_echo_ignore_all
echo "108248" > /proc/sys/fs/file-max
vim /etc/sysctl.conf
net.ipv4.ip_forward = 1
net.ipv4.icmp_echo_ignore_all = 1
fs.file-max = 108248
标签:linux运维之道
原文地址:http://11264900.blog.51cto.com/11254900/1747080