常用基本命令i. 文件操作命令参数格式作用lsa.l.hls -alh列出当前目录下的文件和文件夹ll ll列出文件和文件夹的详细情况cd 进入文件夹,输入cd 和文件夹首字母,按Tab键即可自动补全cat 查看或合并文件内容more/less more 文件名、less 文件名查看文件内容(一次显示一屏),按q退出查看headnhead -n 文件名查看文件前n行tailntail -n 文件名查看文件末尾n行wc wc 文件名查看文件总行数touch touch 文件名新建一个文件echo echo 新内容 > 文件名以覆盖的方式为文件追加内容,如果文件不存在则创建echo echo 新内容 >> 文件名以追加的方式为文件追加内容,如果文件不存在则创建cpa.f.i.r.v拷贝文件或目录mvf.i.v.格式: mv 源文件 目标文件移动文件或目录,也可以用于文件与目录重命名mv 原文件名 新文件名rm 删除文件:rm 文件名 、递归方式删除文件夹:rm -r 目录名删除文件或目录mkdirp新建文件夹:mkdir 目录名、递归创建文件夹组:mkdir -p 目录1/目录2/目录3新建文件夹rmdir rmdir 目录名删除文件夹(只能删除空文件夹!)lnsln -s 源文件 链接文件创建软链接,当源文件不存在时,链接文件失效ln ln 源文件 链接文件创建硬链接,一个文件有多个文件名,只有全部删除时才会删除ii. 归档与压缩、解压缩命令参数格式作用tarc.v.f.t.x打包文件,xx.tartard.r格式:tar zcvf xx.tar.gz 待压缩的文件压缩,xx.tar.gztarC(大写字母C)格式:tar zxvf 压缩包包名解压缩,xx.tar.gztarjcvftar jcvf 压缩包包名 待压缩文件压缩bzip2格式tarjxvftar jxvf 压缩包包名解压bzip2格式ziprtar jxvf 压缩包包名压缩zip格式iii. 常用配置命令参数格式作用which which 命令(如which ls)查看命令位置psa.u.x.w.r查看进程信息top 动态显示进程kill 杀死(终止)进程,有的进程不能直接杀死,这时需要加一个参数“-9”,表示强制结束reboot/shutdown/init 关机重启dfa.m.t.T检测磁盘空间ifconfig 查看或配置网卡信息iv. 日期操作date命令ii. 搜索grep 文本搜索命令v. 帮助命令格式作用相关help指令 –help查看指令帮助 man(manual)man 指令查看指令帮助,按q退出2. 用户管理详细介绍:鸟哥私房菜 - 第十四章、Linux 账号管理与 ACL 权限配置3. 权限管理4. 软件安装与卸载5. 常用服务器搭建及java开发环境配置linux搭建后端环境与服务器i. FTP服务器- vsftpd安装步骤:1. 安装vsftpd服务器sudo apt-get install vsftpd2. 进入vsftpd.conf文件配置sudo vi /etc/vsftpd.conf3. 具体设置设置anonymous_enable=NO,关闭匿名上传指定ftp上传目录 local_root=/home/joysoarkey/ftp允许本机登录 local_enable=YES修改允许登录的用户chroot_list_enable=YESchroot_list_file=/etc/vsftpd.chroot_list允许上传文件到FTP服务器write_enable=YES4. 新建文件vsftpd.chroot_listsudo vi /etc/vsftpd.chroot_list在其中放入被允许登录的ubuntu用户名5. 更改权限【重要】将/home/joysoarkey/ftp文件夹拥有者的权限减去wsudo chmod u-w /home/joysoarkey/ftp6. 重启FTP服务器sudo /etc/init.d/vsftpd restart若重启成功,则终端会显示以下信息[ ok ] Restarting vsftpd (via systemctl): vsftpd.service.在其他机器连接服务器(ip地址视具体情况而定),若显示登录成功则说明FTP服务正常,可以使用。C:\Users\Soarkey>ftp 192.168.0.104连接到 192.168.0.104。220 (vsFTPd 3.0.3)200 Always in UTF8 mode.用户(192.168.0.104:(none)): joysoarkey331 Please specify the password.密码:230 Login successful.ftp>7. 上传下载上传:put 文件名下载:get 文件名有图形化界面的开源ftp软件:FileZillaii.SSH服务器 - openssh-server1. 检查是否已经安装在终端输入ssh localhost,若出现以下提示说明未安装joysoarkey@Ubuntu-PC:$ ssh localhostssh: connect to host localhost port 22: Connection refused以下提示说明已经安装joysoarkey@Ubuntu-PC:$ ssh localhostjoysoarkey@localhost’s password: Welcome to Ubuntu 16.10 (GNU/Linux 4.8.0-59-generic x86_64)* Documentation: https://help.ubuntu.com* Management: https://landscape.canonical.com* Support: https://ubuntu.com/advantage0 packages can be updated.0 updates are security updates.Last login: Sun Jul 30 20:19:51 2017 from 192.168.0.1012. 安装ssh-serversudo apt-get install openssh-server3. 远程登录ssh 用户名@IPiii. 安装JDK1. 下载JDK链接:http://www.oracle.com/technet…2. 解压JDK设置存放路径为/opt(可自定义),进入到root账户,将下载好的JDK文件拷贝到/opt目录cp jdk-8u144-linux-i586.tar.gz /opt解压tar zxvf jdk-8u144-linux-i586.tar.gz 等待一段时间,JDK就解压完成了。JDK目录下有以下文件3. 设置环境变量在/etc/profile中进行JDK环境变量的编辑。vi /etc/profile在文件的最后加入以下几行(对应的位置填你的JDK解压目录)【注意不要输错】export JAVA_HOME=/opt/jdk1.8.0_144export JRE_HOME=/opt/jdk1.8.0_144/jreexport PATH=$JAVA_HOME/bin:$PATH export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar 配置完成之后,一定记得要用命令source /etc/profile刷新配置文件,让配置文件生效!!!4. 检验是否安装成功在终端输入java,出现以下界面说明已经安装配置成功了!恭喜!root@ubuntu:~$ javaUsage: java [-options] class [args…] (to execute a class) or java [-options] -jar jarfile [args…] (to execute a jar file)where options include: -d32 use a 32-bit data model if available -d64 use a 64-bit data model if available -client to select the “client” VM -server to select the “server” VM -minimal to select the “minimal” VM The default VM is client. -cp <class search path of directories and zip/jar files> -classpath <class search path of directories and zip/jar files> A : separated list of directories, JAR archives, and ZIP archives to search for class files. -D<name>=<value> set a system property -verbose:[class|gc|jni] enable verbose output -version print product version and exit -version:<value> Warning: this feature is deprecated and will be removed in a future release. require the specified version to run -showversion print product version and continue -jre-restrict-search | -no-jre-restrict-search Warning: this feature is deprecated and will be removed in a future release. include/exclude user private JREs in the version search -? -help print this help message -X print help on non-standard options -ea[:<packagename>…|:<classname>] -enableassertions[:<packagename>…|:<classname>] enable assertions with specified granularity -da[:<packagename>…|:<classname>] -disableassertions[:<packagename>…|:<classname>] disable assertions with specified granularity -esa | -enablesystemassertions enable system assertions -dsa | -disablesystemassertions disable system assertions -agentlib:<libname>[=<options>] load native agent library <libname>, e.g. -agentlib:hprof see also, -agentlib:jdwp=help and -agentlib:hprof=help -agentpath:<pathname>[=<options>] load native agent library by full pathname -javaagent:<jarpath>[=<options>] load Java programming language agent, see java.lang.instrument -splash:<imagepath> show splash screen with specified imageSee http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details.5. 编写一个java文件测试编辑Hello.java文件public class Hello{ public static void main(String[] args){ System.out.println(“Hello World!”); }}编译:javac Hello.java执行:java Hello顺利输出:Hello World!至此,JDK的配置已经完成!iv. Tomcat服务器1. 下载Tomcat链接:http://tomcat.apache.org/down…2. 解压Tomcat先将下载好的安装包拷贝到/opt中(目录可根据你自己喜好而定)cp apache-tomcat-9.0.0.M22.tar.gz /opt 解压tar zxvf apache-tomcat-9.0.0.M22.tar.gz3. 启动server服务进入到tomcat的bin目录下启动服务./startup.sh启动成功后会输出Using CATALINA_BASE: /opt/apache-tomcat-9.0.0.M22Using CATALINA_HOME: /opt/apache-tomcat-9.0.0.M22Using CATALINA_TMPDIR: /opt/apache-tomcat-9.0.0.M22/tempUsing JRE_HOME: /opt/jdk1.8.0_144Using CLASSPATH: /opt/apache-tomcat-9.0.0.M22/bin/bootstrap.jar:/opt/apache-tomcat-9.0.0.M22/bin/tomcat-juli.jarTomcat started.此时即可在浏览器中通过IP:8080访问tomcat了。v. 安装mysqlvi. 安装eclipse6. 相关资料极客学院wiki:一步一步学linuxubuntu下安装、启动和卸载SSHlinux配置java环境变量(详细) Ubuntu 16.04 mysql安装配置Linux下安装MySQLMysql命令行添加用户mysql修改root密码和设置权限