bj_linux...

ls,cd,pwd,mkdir,mkdir,touch,rm,cp,mv ,vi,cat ,more ,find / -name * ,whereis (+命令)ls ,ln(hard link/ symbol link)


首次看到的信息,从头读到尾

date   显示和设置日期时间
stat    显示指定文件的相关信息
who\w whoami
id    显示当前用户的ID
hostname  显示主机名称
uname    显示操作系统信息
dmesg   显示系统启动信息
du     显示指定的文件(目录)已使用的磁盘空间
df    显示文件系统的磁盘空间的使用情况
free   显示当前内在和交换空间的使用情况
fdisk -l  显示磁盘信息
locale   显示当前语言环境

DOS下:echo %path% echo %JAVA_HOME%

Linux下:echo $PATH(linux下严格区分大小写)

查看文件内容:
[
more 1.txt
cat 1.txt
tac 1.txt
]


[if _fi
case _esac]

[

head help
eg:head -3 3.txt列出脑袋上的前三行

tail
]

find /etc -name *local


用户管理
{
useradd testuser
cd /home
ls
passwd testuser
cd /etc
more passwd
more group

useradd testuser2 -g testuser
more passwd
usermod testuser -g testg

删除用户:
1。删用户userdel testuser
2。删其主目录
   cd /home ls
   rm -rf testuser

su(swith user)

su testuser2  // exit

当一个新用户登录的时候,默认的当前路径是用户的主目录
}


file privilege
[
    chmod 755
    chmod +x 4 (4这个文件就有了可执行权限了``)
    chown
eg:chmod +x 4
   chmod -x 4
   chmod u+x 4
   chmod g+x 4
   chmod o+x 4

专业:    chmod 755 4
          chmod 777 4
     
   chown fangping 4
    ls -l
]


wc  统计指定文本文件的行数、字数、字符数

wall(waring all)警告所有人  { wall `date`}

重定向(Stdin Stdout )
[

 把命令执行的结果输入到cmd.txt
 重定向输入:
 1. ls   2. ls > cmd.txt 3. more cmd.txt 
 
 1. ls   2. ls >> cmd.txt 3. more cmd.txt  输两次

 1.dfes 2> cmd.txt   2.more cmd.txt  输出错误信息

  
 重定向输出: wall <aa.txt

]

csh/ksh/bsh/bash/sh(exit)


============================
常用
============================
grep
[
   more 4
   grep *** 4
]


管道(用的巨多)把上一个命令的执行结果交给下一个命令
[
    ls -Rl /etc |more

    cat /etc/passwd | wc

    cat /etc/passwd |grep alamps
 
    dmesg |grep eth0

    man bash |col -b > bash.txt   过滤  mam col

    ls -l |grep "^d"    只列出目录 [正则表达式  ^ :一行的开头]
 
    ls -l *|grep "^-" |wc -l    列出当前目录下有多少个文件

]


 

原文地址:https://www.cnblogs.com/alamps/p/1628472.html