Linux常用命令杂记

1.[root@thousand ~]# cat /proc/version   //查看内核

2.[root@thousand ~]# lsb_release -a   //查看版本号

3.[root@thousand ~]# ifconfig       //查看网卡信息

4.[root@thousand ~]# setup       //打开网卡配置桌面版

5.[root@thousand ~]# ifup       //获取dhcp ip

6.[root@thousand ~]# mkdir /data    //创建一个/data的文件目录

7.[root@thousand ~]# touch stu{1..10000}  //创建一万个文件

8.[root@thousand ~]# echo 'Iam studying linux'>test1.txt 
 //如果文件存在会清空内容写入''内容,如果不存在会创建一个文件
[root@thousand ~]# cat test1.txt
Iam studying Linux

 9.[root@thousand ~]# echo 'hello' >> test.txt   //这样会是在这个文件后面添加(追加)''内容,如果不存在会创建一个文件
[root@thousand ~]#echo'111 2222 3333'>>test.txt

10.[root@thousand ~]# yum install tree  -y     //不存在tree的使用时,安装tree

11.[root@thousand ~]# mkdir -p /oldboy/test      //连续创建目录要-p

12.[root@thousand ~]# alias       //查看系统现有别名
alias cp='cp -i'
alias l.='ls -d .* --color=auto'
alias ll='ls -l --color=auto'
alias ls='ls --color=auto'
alias mv='mv -i'
alias rm='rm -i'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
13.[root@thousand ~]# unalias cp   删除cp别名

14.data -s  “时间”      //修改时间

15.data    //查看时间

16.[root@thousand ~]# service network restart   //重启网络服务

17.[root@thousand ~]#ps -ef |grep ssh   //查看进程的命令

18.[root@thousand ~]# netstat -lntup |grep ssh

19.[root@thousand ~]# /etc/init.d/iptables stop     //关闭防火墙

20.[root@thousand ~]# netstat -lntup |grep 22          //查看22服务器监听端口

21.[root@thousand ~]# /etc/init.d/sshd restart       //ssh重启方法

22.[root@thousand ~]# rz     //回车后可以选择要传的文件,不能传目录

23.init 数字(0-6)    //切换模式

24.runlevel          //查看当前系统运行级别

25.shutdown -h now   (halt、init 0) //现在直接关机

26.reboot (shutdown -r now 、int 6)      //重启服务器

27.[root@thousand ~]# /etc/init.d/iptables stop    //临时关闭防火墙

28.[root@thousand ~]# /etc/init.d/iptables status  //显示防火墙状态

29.[root@thousand ~]# chkconfig iptables off     //一直关闭防火墙

30.[root@thousand ~]# cat /etc/sysconfig/i18n     //查看编码方式

31.#export TMOUT=10      //超过十秒自动退出

32.#history            //查看历史命令  !数字:可以查看第几条历史命令

33.#history -c        //清空所有史命令

34.[root@thousand ~]# history -d n   //删除第n条的历史记录

35.[root@thousand ~]# export HISTFILESIZE=415

36.[root@thousand ~]# export HISTSIZE=5        //命令行历史记录数量

37.[root@thousand ~]# export HISTFILESIZE=5    //命令行命令对应的记录数

38.[root@oldboy ~]# cat /etc/issue       //查看版本信息

39.[root@thousand ~]# >/etc/issue        //大于号重定向,及清空文件内容

40.[root@thousand ~]# echo $HISTSIZE     //显示历史命令的条数

41.#aspell -c 文件名      //检查文件的单词书写改错等
 

猜你喜欢

转载自blog.csdn.net/qq_24036403/article/details/93308304