基本命令
用户和组
磁盘管理
网络
shell编程
PAHT=$PATH:/home/jsj
echo $PATH
基本命令
ls -a 显示隐藏文件
less 分屏查看
cat file |grep then 在file文件中查找then字符
cp /etc/passwd -s lnspasswd //软连接,
cp /etc/passwd lnhpasswd //硬链接,
//压缩
tar zcvf tt.tar tt
//解压缩
tar zxvf tt.tar
linux-3
cat& 直接把cat扔到后台
ctrl+z 把当前命令扔到后台,
ctrl+c 终止当前命令
find
find subdir -name file1
find /etc/passwd -user root
find / -user jsj -exec ls -l {} ;
find /etc/mail
find /etc/mail 2>/dev/null
find /tmp type f -user jsj 2>/dev/null
ps
ps -a
ps -e
cat & //
bg //切到后台
fg //切到前台
++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++
linux-5
test0
test1
helo.c 源程序
gcc -c hello.c 生成目标文件hello.o
gcc -o hello helllo.o 用hello.o生成可执行文件hello
test2
gcc -E hello.c -o hello.i 预编译生成hello.i
gcc -S hello.i -o hello.S 编译生成hello.S
gcc -o hello.o -c hello.S 汇编生成hello.o
gcc -o hello hello.o 链接生成hello
99乘法表
void main(){
int i;
int j;
for(i = 1;i<=9;i++){
for(j=1;j<=i;j++){
printf("%d*%d = %d “,j,i,i*j);
}
printf(”\n");
}
}
鸡兔同笼:
++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++
8.文件权限管理
http://122.206.151.202/welcome.php
9.基本磁盘和文件系统管理
分区,创文件系统,挂载
1、硬盘分区 fdisk
2、创文件系统,mkfs -t ext4 /dev/sdb1
检查fsck -a /dev/sdb1
创建挂载点 /mnt/s**
3、
自动挂载:
/etc/fstab
/dev/sdb1 /mnt/s** ext4 defaults 0 0
mount /dev/sdb1 /mnt/s**
mount -o ro /dev/sdb6 /mnt/sdb6
10.RAID磁盘阵列
mdadm -C /dev/md1 -a yes -l 5 -n 3 /dev/sdc /dev/sdd /dev/sde /dev/sdf
mdadm -C /dev/md1 -a yes -l 5 -n 4 /dev/sdc /dev/sdd /dev/sde /dev/sdf
mdadm /dev/md1 -f /dev/sdf 标记失效
mdadm /dev/md1 -r /dev/sdf 移除
mdadm --zero-superblock /dev/sdf
mdadm -D /dev/md1
mdadm /dev/md1 --add-spare /dev/sdf
mdadm -D /dev/md1
======
mdadm /dev/md1 --add /dev/sdg 添加一个新的RAID成员
11.LVM逻辑卷管理
pvcreate /dev/sdb1 /dev/sdb5 /dev/sdb6 /dev/sdb7
vgcreate vg0 /dev/sdb1 /dev/sdb5
lvcreate -n lv0 -L 2G vg0
mkfs -t ext4 /dev/vg0/lv0
mount /dev/vg0/lv0 /mnt/201808010028/lv0
关闭磁盘阵列
umount /dev/md0
mdadm -S /dev/md0
mdadm --zero-superblock /dev/sdb1
rm -f /dev/md0
建立物理卷
pvcreate /dev/sdb1 /dev/sdb5 /dev/sdb6 /dev/sdb7
建立卷组
==============================
缩小逻辑卷
1、先卸载
umount /dev/vg0/lv0
2、缩小文件系统
resize2fs /dev/vg0/lv0 5G
e2fsck -f /dev/vg0/lv0(检查文件系统完整性)
3、缩小lv
lvreduce -L 5G /dev/vg0/lv0
删除逻辑卷、卷组、物理卷(顺序不能乱)
umount /mnt/201808010028/lv0
lvremove /dev/vg0/lv0
vgremove vg0
pvremove /dev/sdb1
pvremove /dev/sdb5
pvremove /dev/sdb6
pvremove /dev/sdb7
++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++
14 DHCP
设置新的主机名
hostnamectl set-hostname newname
hostname newname
重启hostnamed服务
systemctl restart systemd-hostnamed
重启网络服务
systemctl restart network
DHCP配置
++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++
FTP服务
安装时错误解决
rm -rf /var/run/yum.pid
/etc/vsftpd/vsftpd.conf
anonymous_enable=YES
anon_upload_enable=YES
anon_umask=022
anon_root=/var/ftp
anon_mkdir_write_enable=YES
anon_other_write_enable=YES
开放防火墙
systemctl restart vsftpd
systemctl enable vsftpd
setenforce 0
firewall-cmd --permanent --add-service=ftp
firewall-cmd --reload