Common shell command logging under Linux

Source: Internet
Author: User
Tags scp command

Hardware Chapter

    • CPU-related
Lscpu                   #查看的是cpu的统计信息. Cat/proc/cpuinfo       #查看CPU信息详细信息, such as the model of each CPU, frequency, etc.
    • Memory-related
Free-m                 #概要查看内存情况  The unit here is Mbcat/proc/meminfo       #查看内存详细信息
    • Disk-related
Lsblk                   #查看硬盘和分区分布, display very intuitive df-h                   #查看各分区使用情况cat/proc/partitions    #查看硬盘和分区mount | column-t       #查看挂接的分区状态
    • Nic Related
Lspci | Grep-i ' ETH '   #查看网卡硬件信息ifconfig            -a #查看系统的所有网络接口ethtool eth0 #如果要查看某个网络接口的详细信息 such as detailed parameters and indicators for eth0

Software article

    • Kernel-related
Uname-a #查看版本当前操作系统内核信息)
Cat/proc/version #查看当前操作系统版本信息
Cat/etc/issue #查看版本当前操作系统发行版信息
Cat/etc/redhat-release #同上
Cat/etc/suse-release #suse系统下才可使用
Lsb_release-a #用来查看linux兼容性的发行版信息
Lsmod #列出加载的内核模块
    • Internet
Ifconfig                #查看所有网络接口的属性iptables-L             #查看防火墙设置service iptables status #查看防火墙状态service iptables stop   # Shut down the firewall route-n                #查看路由表netstat-lntp           #查看所有监听端口netstat-antp           #查看所有已经建立的连接netstat-S              #查看网络统计信息进程netstat -at             #列出所有tcp端口netstat-au             #列出所有udp端口netstat-lt             #只列出所有监听tcp端口
    • System Management
Top                     #查看系统所有进程的详细信息, such as CPU, memory, etc., a lot of information! DF-LH                  #查看硬盘大小及使用率mount                   #挂接远程目录, NFS, local shared directory to Linux hostname                #查看/Modify Computer name W                       #查看活动用户id                      # View specified user information last                    #查看用户登录日志cut-D:-f1/etc/passwd #查看系统所有用户cut-D:-f1/etc/group  #查看系统所有组crontab-L              # View the current user's scheduled Tasks service chkconfig–list         #列出所有系统服务chkconfig –list | grep on #列出所有启动的系统服务程序rpm-QA                 #查看所有安装的软件包uptime                  #查看系统运行时间, number of users, load    /sbin/chkconfig--list  #查看系统自动启动列表/sbin/chkconfig–add MySQL #把MySQL添加到系统的启动服务组里面
    • File related
LS-LHT                 #列出一个文件夹下所有文件及大小, access rights du-sh <dir>            #查看指定目录的大小 du-lh <dir>            #查看指定目录及各文件的大小 ln-s                   #建立软链接
    • Process-related
Pstree-p pid           #查看一个进程下的所有线程pstree  -              a #显示所有进程的所有详细信息, the same process name can be compressed display. Ps-ef                  #查看所有进程kill-9 pid             #杀死进程kill all test           #杀死进程kill-9 ' pgrep test '    #杀死进程./test.sh &             # Causes the program to run Nohup in the background./test.sh &       #使程序在后台运行
    • Compression decompression
Zip-r dir.zip dir file  #将目录dir, file files, etc. compressed into a zip package, zip-re dir.zip dir file #创建zip包, and encrypted unzip Dir.zip            #解压tar-zcvf di r.tar.gz dir file    #将目录dir, file files, etc. compressed to the TAR package tar-xf dir.tar.gz       #解压
    • Screen command

The biggest benefit of the screen command group is that when your shell exits or shuts down, the service you run does not matter, that is, we can open a set of services in screen without being affected by the disconnection of the terminal.

Screen-s Test          #创建一个名字为test的screenscreen-R test          #打开名字为test的screenscreen-R pid           #打开进程号为pid的screenscreen- LS              #列出所有的screenctrl + a,d              #当在一个screen时, exit Screenctrl + a,n              #当在一个screen时, switch to the next window Ctrl + A,c              # When in a screen, create a new window
    • SCP command
SCP local_file [Email protected]_ip:remote_dir    #拷贝本地文件到远程机器上scp-R local_dir [email protected]_ip:remote_dir  #拷贝本地整个目录到远程机器上
    • Package Installation Management Commands

Assuming that the package you want to install is called an app, note that commands here usually require sudo or root privileges.

CentOS system, Redhat system RPM-QA | grep app      #查找本机是否安装了app, Rpm-ivh app.rpm        #假设你有app的rpm包, installs sudo yum install app    #否则就在线安装yum Update app          #更新apprpm-e app              #删除已安装的app包//suse, openSUSE system Zypper Search app       #查找本机是否安装了app zypper install app      # Install the Zypper Update app       #更新zypper the Remove app       #删除zypper LR               #列出所有已定义的安装源. Zypper    ar            #添加新安装源. Zypper    RR            #删除指定的安装源zypper    Mr            #修改指定的安装源//ubuntu system apt-get install app     #安装apt-get update app      #更新apt the-get remove app      #删除    the Apt-cache search app    #搜索软件包dpkg-i app.deb         #假设你有app的deb包 to install directly

Common shell command logging under Linux

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.