Ls
The code is as follows:
$ ls #查看当前目录下文件
conf lnmp_install.sh README vhost_ngx_pagespeed.sh
init.sh ngx_pagespeed.sh Source vhost.sh
The code is as follows:
$ ls conf #查看conf目录下文件
index.html nginx.conf pureftpd-mysql.conf tz.php
Init.d.nginx pure-ftpd.conf Script.mysql
The code is as follows:
$ ls-a #显示所有文件 (contains hidden files that begin with dots (.).)
. conf lnmp_install.sh README vhost_ngx_pagespeed.sh
.. init.sh ngx_pagespeed.sh Source vhost.sh
The code is as follows:
$ ls-l #以长格式显示文件的详细信息, you can view file permissions, users, dates, etc.
Total 60
Drwxr-xr-x 2 root root 4096 18:14 conf
-rwxr-xr-x 1 root root 5720 18:14 init.sh
-rwxr-xr-x 1 root root 21011 18:14 lnmp_install.sh
-rwxr-xr-x 1 root root 1983 18:14 ngx_pagespeed.sh
-rw-r--r--1 root root 392 18:14 README
Drwxr-xr-x root root 4096 13:58 source
-rwxr-xr-x 1 root root 4865 21:58 vhost_ngx_pagespeed.sh
-rwxr-xr-x 1 root root 3774 18:14 vhost.sh
PWD #打印当前目录
The code is as follows:
# pwd
/root/lnmp
Cd
The code is as follows:
# CD ... /#进入上层目录
# CD ... /.. /#进入上上层目录
# cd ~ #进入当前用户的家目录
# cd/root/lnmp/conf #进入/root/lnmp/conf Directory
Mkdir
The code is as follows:
$ mkdir Linuxeye #创建一个linuxeye目录
$ mkdir-p backup/sql #递归创建目录 (created if directory does not exist)
Rm
The code is as follows:
$ rm init.sh #删除init. sh file (directory not deleted without the-R parameter)
$ rm-r conf #递归删除文件或目录 (You can delete the folder, the system will ask you whether to delete, enter Y to confirm, and then return)
$ RM-RF Backup #不会询问 (the-f parameter is used with caution) to delete files or directories directly recursively
Mv
The code is as follows:
$ mv Linux Linuxeye #将linux文件或者目录重命名为linuxeye
$ mv vhost.sh conf/#将vhost. SH move to the Conf directory
Cp
The code is as follows:
$ CP Linux Linuxeye #将linux文件复制一份命名为linuxeye (if a linuxeye directory exists, the Linux file is copied to the Linuxeye directory and the filename does not become Linux)
$ cp-r linuxeye/conf/#将linuxeye目录 (including inside file) copied to the Conf directory
Wget
The code is as follows:
$ wget//blog.linuxeye.com/wp-content/uploads/lnmp.tar.gz #下载文件, can add parameter-C breakpoint continuation;-T set timeout period followed by seconds
Cat && grep
The code is as follows:
$ Cat Vhost.sh | grep linuxeye #显示vhost. SH filters lines that contain linuxeye characters
Awk
Take a public network IP address
The code is as follows:
Ifconfig | grep ' inet addr: ' | Cut-d:-f2 | Grep-v ^10\. | Grep-v ^192\.168 | Grep-v ^172\. | Grep-v ^127\. | awk ' {print $} ' | awk ' {print;exit} '
System Resource Management
The code is as follows:
Df-h
FileSystem Size Used Avail use% mounted on
/dev/xvda 24G 13G 9.9G 55%/
Tmpfs 501M 108K 501M 1%/DEV/SHM
Top #动态查看进程消耗资源 (CPU, memory)
Top-h #查看各个线程资源消耗情况
Free-m # View memory, swap usage, top also can see
Compression and decompression
Tar
The code is as follows:
$ tar czf linuxeye.tar.gz./linuxeye #tar打包压缩
$ tar xzf linuxeye.tar.gz #解压
Zip & Unzip #加-Q parameter does not show the compression process
$ zip-r linuxeye.zip./linuxeye #zip压缩
$ unzip-q Linuxeye.zip #安静的zip解压